3

What is a special purpose register?

What are the names of the special purpose registers, with a little description of each?

3 Answers 3

4

Special purposes register are, as the name implies, registers which are designed for just a task. For example, cs, ds, gs and the other segment registers fall into the special purpose registers, because they exist to hold segments' number. eax, ecx etc are sgeneral purpose register because you can use them for everything without (almost) no limits. For example, you can't mov es, ds, but you can mov eax, ebx.
So, general purpose registers on the x86 are:

  • eax
  • ecx
  • edx
  • ebx
  • esi
  • edi
  • ebp
  • esp

And special purpose register are:

  • cs
  • ds
  • ss
  • es
  • fs
  • gs
  • eip
  • flag

I think they're all here, but if I forget one leave a comment ;)
BTW this might be a good resource (first non-wikipedia google's result for "special purpose register x86").

2
  • ESP is one of the GPRs, but it's also special purpose. Interrupts modify ESP to point to the kernel stack (if not in ring0 already), and push interrupt return context (EFLAGS and CS:EIP). Mar 17, 2018 at 7:55
  • Other special purpose registers include: the control registers (e.g. CR3 points to the top-level page directory), debug registers, and "model specific" registers. But some MSRs are standardized, e.g. in x86-64 the syscall entry point address, and the mask value for RFLAGS. The saved GS value for swapgs is another SPR. I think in 32-bit mode sysenter also uses an MSR for the entry point address, instead of having to reload or cache it from the IDT like int 0x80 would. Mar 17, 2018 at 7:59
3

From wikipedia - Processor register:

Special purpose registers ( SPR ) hold program state; they usually include the program counter (aka instruction pointer), stack pointer, and status register (aka processor status word). In embedded microprocessors, they can also correspond to specialized hardware elements.


General purpose registers (GPRs) can store both data and addresses, i.e., they are combined Data/Address registers.

2
  • can you please list the name of special purpose registers and general purpose registers separately? actually i am confused between the two...
    – sadia
    Apr 30, 2011 at 6:41
  • @sadia - did you even look at the wikipedia article I linked?
    – Oded
    Apr 30, 2011 at 6:43
1

I think with a little googling you could find tons of resources. But this is the short list for x86 processors:

CS: Code Segement
IP: Instruction Pointer
SS: Stack Segment
SP: Stack Pointer

There is more

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