Interrupt padding

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
stonedzealot

Interrupt padding

Post 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?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Interrupt padding

Post 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) ...
stonedzealot

Re:Interrupt padding

Post by stonedzealot »

ouch! that sucks! :P Thanks alot, pype
Post Reply