Registers

There are 32 general-purpose registers and 3 special registers on the MIPS r2k itself. There are also up to 32 registers each on up to four coprocessors. For CS161 purposes, there is only one coprocessor, coprocessor 0, which is the "system coprocessor"; it takes care of exceptions and virtual memory issues.
Register Symbolic
name
Save
by
Description
General registers
$0 z0, ZERO N/A Always contains 0, no matter what's written to it.
$1 AT caller Assembler temporary. See below.
$2 v0 caller Value 0. Used for computations; function return value is placed here. Also holds the system call number on syscall entry.
$3 v1 caller Value 1. Used for computations; upper word of 64-bit return value is placed here.
$4 a0 caller Argument 0. First function argument goes here.
$5 a1 caller Argument 1. Second function argument goes here.
$6 a2 caller Argument 2. Third function argument goes here.
$7 a3 caller Argument 3. Fourth function argument goes here. Also used as a flag value on system call return.
$8 t0 caller General-purpose temporary register.
$9 t1 caller General-purpose temporary register.
$10 t2 caller General-purpose temporary register.
$11 t3 caller General-purpose temporary register.
$12 t4 caller General-purpose temporary register.
$13 t5 caller General-purpose temporary register.
$14 t6 caller General-purpose temporary register.
$15 t7 caller General-purpose temporary register.
$16 s0 callee General-purpose saved register.
$17 s1 callee General-purpose saved register.
$18 s2 callee General-purpose saved register.
$19 s3 callee General-purpose saved register.
$20 s4 callee General-purpose saved register.
$21 s5 callee General-purpose saved register.
$22 s6 callee General-purpose saved register.
$23 s7 callee General-purpose saved register.
$24 t8 caller General-purpose temporary register.
$25 t9 caller General-purpose temporary register.
$26 k0 nobody Kernel scratch register.
$27 k1 nobody Kernel scratch register.
$28 gp global Global pointer. Constant for any given process.
$29 sp N/A Stack pointer.
$30 s8 callee Saved register #8 - conventionally, but not always, a frame pointer.
$31 ra caller Return address of function.
Special registers
HI - caller High-order word of 64-bit multiply result, or remainder of divide result.
LO - caller Low-order word of 64-bit multiply result, or quotient of divide result.
PC - N/A Program counter.
Coprocessor 0
cop0 $0 c0_index N/A TLB entry index register.
cop0 $1 c0_random N/A TLB randomized access register.
cop0 $2 c0_entrylo N/A Low-order word of "current" TLB entry.
cop0 $4 c0_context N/A Page-table lookup address.
cop0 $8 c0_vaddr N/A Virtual address associated with certain exceptions.
cop0 $10 c0_entryhi N/A High-order word of "current" TLB entry.
cop0 $0 c0_status N/A Processor status register.
cop0 $13 c0_cause N/A Exception cause register.
cop0 $14 c0_epc N/A PC at which exception occurred.

Hosted by uCoz