This is a really nerdy post that I don’t have the background for but hopefully I’ll pick up a fun fact or two or three along the way :))
Okay so the x86-64 instruction set is how the computer pretends it works to the user. its what the CPU eats for breakfast. it was invented a while ago, and has lots of complex things going on.
this post is about the registers, which are where the CPU stores the data its actually operating on.
oh god. cpu magic. “microarchitectural implementation details, like shadow registers”. what the fuck.
we have general purpose registers. these are where the computation happens.
we have special registers that store the current instruction pointer or status/flag register
we have segment registers which… index into special tables for accessing memory.
we have some special SIMD (vector operation) and floating point registers for doing fancy maths.
we have some special bound registers for hardware accelerated bounds checking (ie, am i allowed to access this piece of memory im asking for) but apparently it doesn’t work very well and nobody uses it.
there are some debug registers for supporting GDB and the like. registers for addresses containing breakpoint conditions and so on. woah. we have DR0, DR1, DR2, DR3, DR6 and DR7… but DR4 and DR5 have never existed? they just go to DR6 and 7 again.
control registers, these are the ones than manage and inspect the state of the CPU. lots of flags, states, flags, and so on…
“system table pointer registers” they hold sizes and pointers for various protected mode tables.
memory-type-ranger registers. they are shared across all cores in a multi-core chip. (okay, apparently the others aren’t). lmao, what are they doing??
“model specific registers” apparently things start getting fun now… okay so this is the mechanism by which manufacturers can add their own things. you get to them using a pair of instructions RDMSR and WRMSR which themselves read (the MSR id from) and write (the MSR contents to) two ordinary 32-bit registers (cos they date from the 32 bit days…).
Ordinarily this code can’t even be reached by ring-3 (ie, ordinary) code you have to use special code (?). theres some other privileged stuff here too. about 400 by the end of things.
and some other minor bits. final total, around 600
whats kind of amazing about this is this author is probably a turbo nerd, and has a whole internet of turbo nerds correcting them, and theres still lots that’s unclear and not well known. despite the fact that all of this was decisions made by people in the last 50 years, that are still manufactured and worked with daily.