I've been looking at Intel machine language, both in the generated code that's shown in an assembly listing, and in a dump of the executable file itself, as generated from a program written in MASM. I can't figure out how the registers are referred to in the machine instructions. My PC (and obviously many others) has 16 registers, so 4 bits are needed to refer to all of them, 0 through 15. As an example I looked at the lea instruction, since it has a 1 one byte opcode, and only one format. Here is the assembler source:
lea rax, data2
lea rcx, data2
lea rdx, data2
Data2 is at offset 5 in the data portion of the program. Here is the generated machine language:
488D05FE 1F0000
488D0DF7 1F0000
488D15F0 1F0000
I know that the hex 48 denotes a 64 bit register operand and 8D is the opcode, but the rest is still a mystery. What purpose does the 1F0000 serve? Is it reference to the storage location, which is the same in all three instructions? If so, then 05FE, 0DF7, and 15F0 must represent the three registers, but in what notation?
I've spent a lot of time reading https://software.intel.com/en-us/download/intel-64-and-ia-32-architectures-sdm-combined-volumes-1-2a-2b-2c-2d-3a-3b-3c-3d-and-4, but I don't find it to be very helpful. For instance, it never numbers the bits and bytes in order to describe which bits of an instruction serve which function, and according to what scheme. It's full of details, but largely devoid of explanations.