Page 1 of 1

[Solved] Ring3 interrupts playing with stack

Posted: Sun Mar 09, 2014 1:15 am
by PearOs
Hey guys! I think the TSS might be causing this, but I figured id ask here.

So in a program of mine I tried to call INT 80 in Ring3, no problem that works fine. However I push 3 values before the call, and then I notice after the interrupt begins running EIP, CS, Flags, User SS, and User SP are pushed onto the stack which is correct, however the stack like jumps up and the overwrites my values? Is this because on interrupts the CPU changes the stack if you are in Ring3?

Thanks

Re: Ring3 interrupts playing with stack

Posted: Sun Mar 09, 2014 1:19 am
by Combuster
Ring 3 can not force the location of the kernel stack, hence SS:ESP is always taken from the TSS on privilege increases.

Re: Ring3 interrupts playing with stack

Posted: Sun Mar 09, 2014 2:17 am
by PearOs
Combuster wrote:Ring 3 can not force the location of the kernel stack, hence SS:ESP is always taken from the TSS on privilege increases.
Yeah, its a much bigger problem. I'm on IRC working on it now.

Thanks