Mips R3000

Only memory instructions are load/store.
No arithmetic/logical instructions on memory, only on registers or with immediates.
32 bit instructions and 32 bit registers
32 registers + 2 multiply/divide registers + PC
Branching/jumping have a delay - the next instruction happens before the jump.

Status Register

  • 16 bits.
  • 15-8 = interrupt mask bits
  • 0-5 = old, previous, current of KU/IM. KU = flag for kernel or user mode, IM = flag for if interrupts are enabled or disabled.

Exception Codes

Interrupts are just one kind of exception. Others include TLB load/store and address errors.

interrupts%20mips.png

Basically we save our current PC, shift the KU/IM flags from current to previous and previous to old, setting current = 0,0 (kernel mode, disable interrupts) and then set PC to exception vector address.

All information required to find out what caused the exception and restart after exception handling is in coprocessor
Registers.

To return back, we just right shift the KU/IM flags (old->prev, prev->current) and set PC back to saved PC.

Registers for System Calls

  1. User level sets certain registers to tell us type of syscall and arguments
  2. Some registers are preserved for return to user level
  3. Result of syscall placed in register

sys%20call%20registers.png