hackclub / putting-the-you-in-cpu

A technical explainer by @kognise of how your computer runs programs, from start to finish.
https://cpu.land
MIT License
4.71k stars 145 forks source link

Reference on the MacOS "split" #38

Open ZPedro opened 10 months ago

ZPedro commented 10 months ago

https://fahrplan.events.ccc.de/congress/2007/Fahrplan/events/2303.en.html (first attachment; second attachment is the slides) provides a good summary of the behavior of the MacOS (then known as Mac OS X) kernel, XNU, including the memory space provided to processes. It was current as of 32-bit Mac OS X and support of 64-bit process by a 32-bit kernel, but not current with regard to the 64-bit-address-space kernel (AKA K64 in MacOS circles).

So I suggest you include the 4/4 "split" of Mac OS X next to the 3/1 and 2/2 splits found in operating systems of that vintage as illustration, but not necessarily dwell any further, to the extent these splits are less impactful than they once were. Indeed, the main point was to avoid significant memory remapping operations when crossing the userspace/kernel border (except for pre-K64 Mac OS X), but all that went out the window anyway with Meltdown, at which point it was realized keeping the kernel memory mapped while in userspace, even with forbidden access, was not hygienic. Which meant all operating systems were modified to unmap kernel pages when dropping to userspace (and to remap them upon kernel entry), except for a small set of always-mapped pages from which the kernel mappings can be rebootstrapped upon kernel entry, just like pre-K64 Mac OS X.