CS161 2019-02-06
Zhu, Justin

CS161 2019-02-06
Wed, Feb 6, 2019


Proc 1’s page table

300,000 hex. There’s rsp before syscall

We want to take interrupts in kernel mode in order for the hardware crash to be handled. Gently click so that hard disk get locked.

If interrupts happen in kernel mode, we would have a processor such that the hardware. Magical 5 registers are put on the same stack that it is currently running.

We do not call swapgs if the interrupt was not protected in current mode. If current gs is negative, we should swap.

testq checks if interrupts are disabled, then we enable interrupts. Pending interrupts will happen.

regs and yields tell CPU how to start a process back up.

A certain amount of preparation needed.

Kernel yields to the SCHEDULER.

We could have created an entire reg state, pushed every single register onto the stack. There’s a cheaper way to implement voluntary rather than involuntary.

YIELD is INVOLUNTARY, CHEAPER than regs.

iret is needed for kernel transition.

rax might change this call to yield. If rax needs to be preserved, a small number of registers are saved. Callee-saved registers. Those registers we have to save.

push instruction decrements rip

Yield(normal) and syscall(dangerous instruction) privilege difference

We could design with regs, yields, and syscall with registers needed for syscalls.

this->yield(); break; is the same thing as this->reg_ = regs; this->yield_noreturn();

there is only one kernel stack, no user mode, move from