ISR Code

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
SFX

ISR Code

Post by SFX »

Hi,

I was looking through one of the sample kernel's from Bona Fide and was wondering about the code in the ISR's, this is the code

Code: Select all

     pusha
     push ds
     push es
     push fs
     push gs
     mov eax,0x10    ; Data segment
     mov ds,eax
     mov es,eax
     cld
     call _int_00    ; Divide by Zero #DE
     pop gs
     pop fs
     pop es
     pop ds
     popa
     iret
Is it neccessary to load the data segments inside each ISR?

All other samples I have seen do not do this so I was wondering why it is done here and if it is needed.

cheers.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:ISR Code

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 9:15 pm, edited 1 time in total.
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:ISR Code

Post by Pype.Clicker »

SFX wrote: Is it neccessary to load the data segments inside each ISR?
It might sound useless as long as you only have a kernel (thus the DS segment never changes -- or at least you believe it doesn't)

but as soon as user-level process will be used, you'll find that user-mode has a different DS selector than kernel (even if just for access right) ... so saving/restoring segments registers like DS, ES, FS and GS (don't forget user code might not be written in C) is mandatory for any ISR.
Post Reply