Skip to content

Parked in the Trapframe

Exercise: 48k_user_mode · Fri Nov 13 · Length: 6:22 · Lecture: Week 12 · The trapframe, and why not the user's stack · Explainer: Parked in the Trapframe

A narrated walk through the explainer, for after the Nov 10 lecture and before Friday's session: for the length of a system call, the program's registers exist only in its trapframe, a page of the process's own, not the program's stack. The video reads the trapframe's slots, then steps through one getpid in an example process, from its ecall through the given uservec and usertrap, your ecall branch, and the given usertrapret to userret and back to user mode, watching the trap registers, the slots, and where the program's values are at each step. A broken case follows, a resume pc that lands inside the ecall, with what the program meets there; then where stvec points on each part of the trip. A second case, an answer that never reaches the program, passes the test and is wrong: keys typed into cargo run, for it and for the reference, show the difference. The video ends on what you write and the test's checks. It shows no solution code: only the registers, the trapframe's slots and the pc at each step, with example numbers.

Download the video (MP4, 9 MB) · Captions (WebVTT) · All six Week 12 videos