So I had this neat bug in my 3B2 emulator. Hear me out.
Build new kernel on SVR3. Kernel fails to boot, KERNEL TRAP! A full day of debugging. Turns out 12 bytes of kernel was being overwritten with garbage. Days more debugging. Things get WEIRD. The kernel object files are fine, the linked kernel is not. Yet more debugging. Then a breakthrough: New kernel get corrupted shortly after loading the objects and linking, but before saving to disk. HUH...
YET MORE debugging. Memory is being corrupted at physical address 0x200f000-0x200f00b. (Heh, foob). Once corrupted, `mkunix` saves in-memory image to disk, that's why disk file is corrupted. OK. But why corruption? MORE DEBUGGING.
And then, when looking through my 3B2 source code, I figure it out. The CIO card drivers use that EXACT MEMORY LOCATION to write test results to memory on boot-up. Except my implementation had a bug, and was doing it AFTER kernel boot. AUUGGH.
@twylo 12 bytes of garbage? you're underestimating the size of unix
"I appreciate SDF but it's a general-purpose server and the name doesn't make it obvious that it's about art." - Eugen Rochko