Interrupted for a long time, a look found a little more content.
I'm going to finish.
LAB1 Challenge 1
We need to set up a trap gate for system calls when we set up the interrupt-like scale.
That is
Switching privilege levels with interrupts
to kernel
When calling Tokernel, the kernel stack of the current function is removed from the TSS and the corresponding switch is made because of the privilege and conversion.
Press Stack EFlags CS Eip err trapno ds es SF gs Tregs etc
Push this call stack into the stack
The last execution of push ESP is to put the pointer on the top of the stack at the top of the stack as the tarp parameter TF incoming
Add an additional space in the dispatch to fill in the modified Trapframe
Put a new pointer into the stack
When the POP is returned it will use the new ESP stack as the return
Iret, it's just the right thing to do.
Because the stack when the stack of ESP and SS, but the stack is not required when the ESP and SS so the return of the stack frame is not ESP and SS??
To User
stack frame, but not complete, when stack is pressed
So in another place apply a stack frame full set ESP and SS return
Answer:
As far as hardware is concerned, there are two cases when executing iret, one is the permission level (kernel State or user state) of CS that is saved on the stack, regardless of SS and ESP, and the second is that the permission level saved on the stack is different from the current, and the SS and ESP need to be restored. The task of OS is to use the function of Iret to modify CS without altering the value of other registers.
(So to kernel when Iret will find CS privileges and consistency (has been modified, so there is no ESP and SS))
(to user similarly)
Attached: lab1_prinit_cur_status
Is the privileged bit that outputs the CS segment of the current few registers is also output for checking
Operating system LAB1 (2)