MIT 6.828 Lab4
Notes of MIT 6.828 Lab4
Part A: Multiprocessor Support and Cooperative Multitasking
Multiprocessor Support
LAPIC and MMIO
Exercise 1
Application Processor Bootstrap
Exercise 2
Question 1
kern/mpentry.S
is compiled and linked to run above KERNBASE
, which means that its link address will be above KERNBASE
. However, it’s actually loaded at physical address MPENTRY_PADDR
and starts without virtual memory enabled. Therefore, it must use MPBOOTPHYS
to calculate absolute addresses of its symbols.
Per-CPU State and Initialization
Locking
Exercise 5
Question 2
We still need separate kernel stack. Imagine a scenario that a cpu enters the kernel by a trap, it pushes a trapframe onto the kernel stack. If another cpu enters the kernel by a trap at the same time, it also pushes a trapframe onto the kernel stack. If they share the same stack, the two trapframes may overwrite each other.
Round-Robin Scheduling
Exercise 6
Question 3 & 4
Because
e
is located within the kernel stack, and this part of page table is the same among different address spaces.Because the context switch relys on the saving and restoring of the register set. The saving happens at the
trapEntry.S
andtrap()
. The restoring happens atenv_run()
which callsenv_pop_tf()
.