IDT questions

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
Iniclub
Posts: 8
Joined: Sun Jul 15, 2007 3:05 am

IDT questions

Post by Iniclub »

Hello every body.
I have a simple question , shall I install the IDT befor enabling the protected mode or it dosn't matter . because I don't have enough space in my bootloader (4 bytes).
sancho1980
Member
Member
Posts: 199
Joined: Fri Jul 13, 2007 6:37 am
Location: Stuttgart/Germany
Contact:

Post by sancho1980 »

you can do that in protected mode, there's no need to do it in real mode; just make sure you enable interrupts ONLY AFTER loading the idt!!!
Gizmo
Member
Member
Posts: 41
Joined: Fri Aug 03, 2007 3:41 am

Post by Gizmo »

You can do it in either mode, but you must disable interrupts prior to entering pmode or installing the idt, and only enable interrupts after p-mode and the idt was installed.

When you install the pmode idt, you are replacing the real mode idt so not disabling interrupts will cause the cpu to use the wrong idt.

Use cli to disable maskable interrupts, and use sti to enable them.
Non-maskable interrupts can still happen so its best to make sure that no errors occur in the time it takes you to switch modes and update idt or else you will crash- its best to place lidt and the pmode switch as close as possible and to avoid doing anything in between them.
Iniclub
Posts: 8
Joined: Sun Jul 15, 2007 3:05 am

Post by Iniclub »

Thank you guys for you explanation and your time.
Post Reply