Page 1 of 1

ISR Code

Posted: Wed Aug 27, 2003 10:58 pm
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.

Re:ISR Code

Posted: Thu Aug 28, 2003 12:26 am
by Perica
..

Re:ISR Code

Posted: Thu Aug 28, 2003 1:29 am
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.