Search code examples
assemblyx86cpu-architectureterminologycpu-registers

What registers are considered "address registers" in Assembly?


Which registers are considered to be "Address registers" in Assembly? I thought that the answer would be something like: all segment registers, plus EBP, ESP, and EIP since they contain "addresses", if I can say that. But to my surprise the correct answer actually is: the segment registers and EIP. I couldn't find any type of explanation for this, tough. Why is it that the segment registers and EIP are called "address registers"? Why these registers specifically and not some others registers? (P.S. I'm using x86 NASM if it makes any difference)


Solution

  • For 80x86, there is no clear and authoritative definition of "address register"; and (unless there is a clear and authoritative definition - e.g. in the CPU manufacturer's manual) "address register" could be defined as anything you like.

    For one example, for 80x86, you could say that all general purpose registers can be used as an address (e.g. "mov eax,[eax]" or "mov eax,[ebx]" or ..) and therefore all general purpose registers are "address registers".

    For another example, for 80x86, you could say that segment registers contain a structure of stuff (visible value, base address, limit, type) and are therefore not "address registers", and almost all normal registers (EIP, ESP, ESI, EDI, ...) can only contain an offset within a segment (which is not an address on its own) and are therefore also not "address registers"; and that there are no address registers at all.