The story behind the x86_amd64 architecture
September 23, 2021
There are many fascinating things to understand about processors and how computer architecture works. R3’s newest product, Conclave, abstracts away a lot of the work you’d otherwise have to do in understanding the CPU, but it’s essential to understand what’s happening under the hood. Let’s zoom out a little bit to get a better view of what x86 is.
x86 Assembly in context
x86 has become a catchall term to refer to any 32-bit CPU architecture compatible with the x86 instruction set. A “32-bit” architecture sounds much more complicated than it is.
The term 32-bit means that the CPU was physically made to work with 232 possible addresses within memory. Remember that a “computer” is just a CPU, some RAM, and a hard drive— just larger RAM that takes longer to reach.
So if a computer is 32-bit, that means it only supports up to 4GB of RAM because 232 bits = 4,294,967,296.
So when the processor runs things within the instruction set, it indexes memory to find the relevant items and performs the correct operation. That’s it.
An instruction set refers to a group of possible processor functions that can be run on a processor. Imagine, for example, an ADD instruction set would take two numbers, A and B, add them, and return the result. So the instruction might look like this:
ADD eax, ebx
Here, eax and ebx are two of what can be many registers within a processor. What you probably know as variables are stored inside of “registers” within a CPU. I’ll define a register here as a stored integer with a specified address known to the processor that’s 32 bits in length. You could also think of CPU registers like hardcoded global variables.
Another movement to be aware of since we’re doing this little tour is the idea that CPUs should only support a couple of instructions like ADD, MULTIPLY, and DIVIDE, and just a few others. CPUs were being thrown around that had some ridiculous features in their instruction sets! CPUs were being branded and marketed like graphing calculators not too long ago. (If you don’t know what a graphing calculator is, you’re too young to read this post!)
This eventual name for this movement towards minimalist instruction sets was called RISC! The Reduced Instruction Set Architecture.
Now, where does x86 come from, you ask? Intel had a widely popular 8086 processor that had done well on the market, so they continued to name processors with an 86 at the end of the product names, undoubtedly leading to no confusion at all!
One of the enormous features of x86 was that it was backward compatible, meaning big industry players wouldn’t have to recompile their programs to use the latest processor. But these CPUs were still, of course, only capable of 32 bit addressing, and when almost any computer boots up, it doesn’t use 32-bit integers out of the box!
Modern CPUs start with a 16-bit mode that the original 8086 chips used and then transition during the boot process using a pile of hacks.
The backstory here is that Intel actually tried to clean this up with a proper 64-bit architecture called Itanium that was NOT backward compatible. AMD saw an opportunity here and marketed their new processors as being 64-bit and x86 compatible. Unfortunately, the industry, being industry, didn’t care to correct technical debt, and the backward compatible but less efficient processors caught on. AMD called this architecture x86_64, also known as x86_amd64.
Hopefully, this bit of history was useful! Happy coding ~