Page 1 of 1

Interrupt padding

Posted: Wed Mar 12, 2003 10:27 pm
by stonedzealot
I was looking at the source for Mr. Xsism's beautiful IDT Kernel, and noticed that all of his interrupt calls were prefaced with

Code: Select all

     pusha
     push ds
     push es
     push fs
     push gs
     mov eax,0x10    ; Data segment
     mov ds,eax
     mov es,eax
and of course finished with the appropriate pop statements and an iret. Is this code necessary for the interrupt to function?

Re:Interrupt padding

Posted: Thu Mar 13, 2003 4:40 am
by Pype.Clicker
an interrupt might occur anywhere anytime. As you wish to make it transparent to the interrupted process, you *must* make the registers saved before any interrupt-related process starts and restored after. Otherwise, the interrupted process could see its internal variables changed randomly (not good at all) ...

Re:Interrupt padding

Posted: Thu Mar 13, 2003 12:24 pm
by stonedzealot
ouch! that sucks! :P Thanks alot, pype