Pype.Clicker wrote:
"insulated" ? is that officially in the book ? (i'm just curious; i wouldn't have expected that term in that context).
yes , it's the original words.
the kernel implements this by pushing a context layer on the kernel stack before calling the handler, this context layer, like a stack frame, contains the information needed by the handler to restore the previous execution context upon return.
the above is sentence after that.
I guess what they mean is that, even if the handler potentially can modify content on the kernel stack below it, it should refrain to do so otherwise things might go bad.
hi, would you give me an example of the potentiality?
thanks.
the tutorial of bran also write as that.
Code: Select all
/* All of our Exception handling Interrupt Service Routines will
* point to this function. This will tell us what exception has
* happened! Right now, we simply halt the system by hitting an
* endless loop. All ISRs disable interrupts while they are being
* serviced as a 'locking' mechanism to prevent an IRQ from
* happening and messing up kernel data structures */
void fault_handler(struct regs *r)
{
if (r->int_no < 32)
{
puts(exception_messages[r->int_no]);
puts(" Exception. System Halted!\n");
for (;;);
}
}
isr_common_stub:
pusha
push ds
push es
push fs
push gs
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov eax, esp
push eax
mov eax, _fault_handler
call eax
pop eax
pop gs
pop fs
pop es
pop ds
popa
add esp, 8
iret
i wonder whether I can rewrite it as
Code: Select all
/* All of our Exception handling Interrupt Service Routines will
* point to this function. This will tell us what exception has
* happened! Right now, we simply halt the system by hitting an
* endless loop. All ISRs disable interrupts while they are being
* serviced as a 'locking' mechanism to prevent an IRQ from
* happening and messing up kernel data structures */
void fault_handler(struct regs *r)
{
if (r->int_no < 32)
{
puts(exception_messages[r->int_no]);
puts(" Exception. System Halted!\n");
for (;;);
}
}
isr_common_stub:
call _fault_handler
add esp, 8
iret
if not, why? thanks much.