Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

x86 instruction set roadmap

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!

like image 303
Ruben Trancoso Avatar asked Jan 11 '10 19:01

Ruben Trancoso


People also ask

What does x86 instruction set do?

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.

How big is x86 instructions are there?

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.

What is x86-64 instruction set?

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.

What x86 instruction is represented by byte value 0x90?

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.


1 Answers

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).

like image 122
mmx Avatar answered Oct 14 '22 04:10

mmx