Return from callgate function
Posted: Thu Apr 28, 2005 11:00 pm
Hi
I'm newbit on OS kernel dev. I'm studying about callgate on ia32 protected mode.
Af far as I know, When user mode process call kernel mode module via callgate like following.
user_process:
...
call CALLGATE1_SELECTOR:0
...
then, eip, cs, arguments(if any), esp, ss are pushed automatically, and control goes to callgate function. (to CALLGATE1_SELECTOR:offset)
My question:
in the callgate function, after performing proper work, I used instruction RET to return to user process. but, RET in callgate function POPed and restored only EIP. So cs, esp, ss of user mode process weren't restored.
Is there any other process that I miss about return processes of callgate? Is there any other specific instruction than RET instruction for returning of callgate?
I'm newbit on OS kernel dev. I'm studying about callgate on ia32 protected mode.
Af far as I know, When user mode process call kernel mode module via callgate like following.
user_process:
...
call CALLGATE1_SELECTOR:0
...
then, eip, cs, arguments(if any), esp, ss are pushed automatically, and control goes to callgate function. (to CALLGATE1_SELECTOR:offset)
My question:
in the callgate function, after performing proper work, I used instruction RET to return to user process. but, RET in callgate function POPed and restored only EIP. So cs, esp, ss of user mode process weren't restored.
Is there any other process that I miss about return processes of callgate? Is there any other specific instruction than RET instruction for returning of callgate?