Stack pb when CPL switching
Posted: Fri Nov 07, 2003 5:56 pm
I'm switching from CPL3 to CPL0 when I receive an IRQ0. Here's my IRQ0 handler :
well, task_tick is a simple C function that returns 0 if the current process has running its time out and .nosw is a label defined somewhere below.
the line (*) give 0x10C1BC to EAX, which is correct according to what the TSS.ESP0 field should contain, but ESP is 0x10C1A4 (0x10C1A8 without the push eax).
Shouldn't ESP be 0x10C1B8 = 0x10C1BC - 4 (push eax) ?
Where am I wrong ?
Code: Select all
int_irq0:
cli
push eax
call task_tick
test eax,eax
jnz .nosw
mov eax,[tss.esp0] ; (*)
cli
hlt
the line (*) give 0x10C1BC to EAX, which is correct according to what the TSS.ESP0 field should contain, but ESP is 0x10C1A4 (0x10C1A8 without the push eax).
Shouldn't ESP be 0x10C1B8 = 0x10C1BC - 4 (push eax) ?
Where am I wrong ?