I'm just touching the surface of the x86 instruction set after a long period of high level programming. It's been about 20 years I had my first read on x86 assembly programming and from my googlings I get just lost with the myriad of instruction set references; from ones that mix new generations of processors (286, 386, 486...) to others that add newer x86 instructions. Not to mention the AMD variations.
Since I'm planning on building a boot loader, my first thought was to be fully compliant with 'standard x86' but I can't figure out where in time it is or even if it exists anywhere.
Even Intel documentation seems follow the same path and like another one said, 'we need a x86 instruction set standardisation, the evolution of opcodes is chaotic'.
It's not my idea to hold the standardization banner. I just want to see the road and understand where is the safe place to walk. If anyone could help I'd appreciate a lot!
The x86 instruction set refers to the set of instructions that x86-compatible microprocessors support. The instructions are usually part of an executable program, often stored as a computer file and executed on the processor.
x86 instructions can be anywhere between 1 and 15 bytes long. The length is defined separately for each instruction, depending on the available modes of operation of the instruction, the number of required operands and more.
x86-64 (also known as x64, x86_64, AMD64, and Intel 64) is a 64-bit version of the x86 instruction set, first released in 1999. It introduced two new modes of operation, 64-bit mode and compatibility mode, along with a new 4-level paging mode.
0x90 is actually just one instruction of the 0x90 + r opcode family which stands for xchg r32, eax . eax is register 0, so 0x90 stands for xchg eax, eax which is a NOP. In long mode, 0x90 is special cased not to zero out the high 32 bit of rax to keep its function as a single byte NOP.
Historically, x86 has been very backward compatible. x86-64 has thrown away some very old instructions (like BCD instructions) but it's unlikely that these kind of changes are going to happen again (at least not until something huge as 64 bit address space transition happens).
If you want to ensure your code works on virtually all x86 processors out there, stick to the 386 instruction set (if your code is 32-bit) or early x86-64 instruction set (if it's 64-bit).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With