Skip to content

Headers Say Where

Exercise: 54k_elf_loader (extra credit) · Fri Dec 4 · Length: 6:26 · Reading: Week 15 · What a flat image costs · Explainer: Headers Say Where

A narrated walk through the explainer, for before Friday's session (Dec 4), to go with the Week 15 reading fork, wait, and the User Shell, for the extra credit: an ELF file says where its bytes go. Its header names the program's first instruction and where in the file the program headers are, and each loadable program header gives a range of the file, an address, a size in memory and permissions. The video reads an example file's header and the fields of a program header, then steps through its three loadable headers, each beside the page it fills, and the program's first instructions from its entry point. Three wrong loaders follow, kernels A, B and C, on the same example, each with where its program stops, and the one line the test printed for all three and for the skeleton; then kernel D, which passes the test and is wrong. The video ends on what you write, the test's own ELF file, and how to read a failure. It shows no solution code: only the headers' fields, the pages and their permissions, and the pc at each step, with an example file, or the test's own.

Download the video (MP4, 8 MB) · Captions (WebVTT) · All eleven Week 15 videos