[Solved] Ring3 interrupts playing with stack

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
PearOs
Member
Member
Posts: 194
Joined: Mon Apr 08, 2013 3:03 pm
Location: Usually at my keyboard!

[Solved] Ring3 interrupts playing with stack

Post 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
Last edited by PearOs on Sun Mar 09, 2014 4:48 am, edited 1 time in total.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Ring3 interrupts playing with stack

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
PearOs
Member
Member
Posts: 194
Joined: Mon Apr 08, 2013 3:03 pm
Location: Usually at my keyboard!

Re: Ring3 interrupts playing with stack

Post 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
Post Reply