Encoding:

POOL32A

000000

rt

rs

00

sel

MFGC0

10011

POOL32AXf

111100

6

5

5

2

3

5

6

Format:

MFGC0 rt, rs, sel

microMIPS

Move from Guest Coprocessor 0

Purpose:

Move from Guest Coprocessor 0

To move the contents of a guest coprocessor 0 register to a general register.

Description:

 GPR[rt] = Guest.CPR[0, rs, sel]

The contents of the guest context coprocessor 0 register speciied by the combination of rs and sel are sign-extended and loaded into general register rt. Note that not all guest context coprocessor 0 registers support the sel ield. In those instances, the sel ield must be zero.

When the guest context coprocessor 0 register speciied is the EntryLo0 or the EntryLo1 register, the RI/XI ields appear at bits 31:30 of the destination register. This feature supports 32-bit addressing mode compatibility on a

MIPS64 system.

Restrictions:

The results are UNDEFINED if the guest context coprocessor 0 does not contain the register speciied by rs and sel.

The guest context does not implement the Virtualization Module. Use of this instruction in guest-kernel mode will result in a Reserved Instruction exception, taken in guest mode.

MFGC0 must behave exactly the same as the corresponding guest MFC0instruction, exceptthatit will not cause exceptions that are speciic to guest, such as GPSI and GSFC. Speciically, if the guest register is replicated in guest context, then the read will return the register value, if the register is Reserved for Architecture/Implementation or is

Not Available,the read returns 0,ifthe registeris Shared (such as WatchHi)then the read will always return the register value except that ields invisible to guest are zeroed out.

If access to Coprocessor 0 is not enabled, a Coprocessor Unusable Exception is signaled.

Operation:

if IsCoprocessorEnabled(0) then
   if (Config3VZ = 0) then
      SignalException(ReservedInstruction, 0)
      break
   endif
   reg = rs
   data = Guest.CPR[0,reg,sel]
   if (reg,sel = EntryLo1 or reg,sel = EntryLo0 then
      GPR[rt]29..0 = data29..0
      GPR[rt]31 = data63
      GPR[rt]30 = data62
      GPR[rt]63..32 = sign_extend(data63)
   else
      GPR[rt] = sign_extend(data)
   endif
else
   SignalException(CoprocessorUnusable, 0)
endif

Exceptions:

Coprocessor Unusable

Reserved Instruction