ESP seems change itself automatically
Posted: Sun Jan 25, 2009 10:04 am
Hi, my test app runs at ring0, but with different stack address.
Kernel stack = 0x0009FFFF
App stack = 0x008FFFFF
before start the test app, I set ESP to 0x008FFFFF, then use INT IRET instructions to switch.
I made the app to issue the DE exception,
After the DE handler is done, I got back to kernel, but ESP value changes back to kernel stack range automatically. I expect it should be still within app stack range, since I don't performan inter-previlege switch, both ring0. Does anyone know why?
Kernel stack = 0x0009FFFF
App stack = 0x008FFFFF
before start the test app, I set ESP to 0x008FFFFF, then use INT IRET instructions to switch.
Code: Select all
InterruptHandler_42: pop dword [_eip]
pop ecx
pop dword [_eflags]
push 0 ;placeholder
push dword [_eflags]
push dword ecx
push dword 0x00800000
mov al,EOI
out PIC8259B_Port_Command,al
out PIC8259A_Port_Command,al
iret
Code: Select all
InterruptHandler_00: pushad
push gs
push fs
push ss
push es
push ds
call IDT_00 ;display registers
pop eax
pop eax
pop eax
pop eax
pop eax
popad
push dword [_eflags]
push dword 0x8
push dword [_eip]
iret