1

Some of the general purpose registers are used for some specific reasons. For example EAX is used as an accumulator and to store return values, ECX is used as a counter, ESI and EDI are used to store the src and dst address, respectively. similarly, ESP and EBP.

Is there any specific use case forEBX register? and Is there anything else that I have missed special use cases of general purpose registers?

Thank you.

1

1 Answer 1

4

• AX/EAX/RAX: Accumulator

• BX/EBX/RBX: Base index (for use with arrays)

• CX/ECX/RCX: Counter

• DX/EDX/RDX: Data/general

• SI/ESI/RSI: Source index for string operations.

• DI/EDI/RDI: Destination index for string operations.

• SP/ESP/RSP: Stack pointer for top address of the stack.

• BP/EBP/RBP: Stack base pointer for holding the address of the current stack frame.

• IP/EIP/RIP: Instruction pointer. Holds the program counter, the current instruction address.

Segment registers:

• CS: Code Segment (used for IP)

• DS: Data Segment (used for MOV)

• SS: Stack Segment (used for SP)

• ES: Destination Segment (used for MOVS, etc.)

• FS: local store

• GS: local store

3
  • Note that the original 8086 design had a lot more limitations on what you could do with which register that current processors have. There's still stuff like loop which works on cx or its extensions, but most instructions that needed a specific (set of) register(s) on 8086 work with any, or almost any, register now. May 25, 2015 at 14:20
  • specific case for [E/R]BX: xlat. May 26, 2015 at 4:13
  • RIP is not a general purpose register. R11 also has a special purpose in kernel code. And even the above registers have a lot more special purposes than what you listed
    – phuclv
    Oct 27, 2018 at 5:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.