GDT, IDT

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
K.J.

GDT, IDT

Post by K.J. »

Okay, I think that I have this right, your OS doesn't have sevral GDTs it has one GDT with several descriptors in it. Right?

Also, does anyone know where I can find a good example of setting up a IDT?

Thanks in advance,
K.J.
K.J.

Re: GDT, IDT

Post by K.J. »

Could someone please at least confirm the first part?

Thanks,
K.J.
Chris Giese

Re: GDT, IDT

Post by Chris Giese »

>Okay, I think that I have this right, your OS doesn't have sevral GDTs it has one GDT with several descriptors in it. Right?

Right.

>Also, does anyone know where I can find a good example of setting up a IDT?

This (NASM) code sets up handlers for all 256 INTs. There are also setvect() and getvect() functions to change the handlers from C:
http://www.execpc.com/~geezer/osd/code/osd6/kstart.asm

Similar code:
http://www.execpc.com/~geezer/osd/intr/x86-32.zip

In the current version of my Cosmos OS, there is no setvect() or getvect(): all interrupts go through one handler. This is simpler, but slower:
http://www.execpc.com/~geezer/os/index.htm#cosmos
K.J.

Re: GDT, IDT

Post by K.J. »

Thanks, that was just what I needed. :)

K.J.
K.J.

Re: GDT, IDT

Post by K.J. »

Could you maybe give me an example of using the getvect() and setvect functions please(from kstart.asm)?

Thanks,
K.J.
Chris Giese

Re: GDT, IDT

Post by Chris Giese »

>Could you maybe give me an example of using the getvect() and setvect functions please(from kstart.asm)?

http://www.execpc.com/~geezer/osd/code/osd6/main.c

down at the bottom, in main()
K.J.

Re: GDT, IDT

Post by K.J. »

Thanks, that's what I needed. However, your link to the file didn't work, but I found it in osd.zip.

Thanks,
K.J.
Post Reply