Yield mechanisms
The timer interrupt case (INT_IRQ + INT_TIMER
in kernel.cc
) calls
proc::yield_noreturn()
. Change it to call proc::yield()
instead.
The SYSCALL_YIELD
case (in kernel.cc
) calls proc::yield()
. Change it to
call proc::yield_noreturn()
instead.
Changing the timer interrupt to call
proc::yield()
is simple:// this->regs_ = regs; // this->yield_noreturn(); this->yield(); break;
There’s no need to store an explicit resume point. When
proc::exception
returns (afterthis->yield()
resumes and returns), the interrupted process will resume.To use
proc::yield_noreturn()
inSYSCALL_YIELD
, we must set the system call’s return value by modifyingregs
explicitly. System calls, unlike general exceptions, have return values, and it’s important to get them right.// this->yield(); // return 0; -- sets reg_rax this->regs_ = regs; regs->reg_rax = 0; this->yield_noreturn(); // NB does not return // This comment will never be reached! // This one either! break;
System calls and information leaks
The syscall_entry
implementation can leak information from the kernel.
Explain how, and explain whether and why this is a problem. Find a good
reference online to a similar issue in Linux or another kernel.