- 46635728670946901EDCA4062D650365295341CF87401AC4FBB7F78423FAF76B5C246A07EA8E5FC76FCD4B49FF669102F556F47F7C5A247670FD00FFEE665B80
+ AD646CEE418F8C037CDA4CB8DB4838733687E9D522537FCF080E044199B5B26DAEFA7ECDAC572E0E2A606F46492130CDE66A58AD33F12967809FAFD949A8D524
m/i_decode.asm
(261 . 16)(261 . 35)
49 ;-----------------------------------------------------------------------------
50
51 ;-----------------------------------------------------------------------------
52 ; Denote privileged (permitted in Kernel-Mode strictly) instructions.
53 ; Jump to given target if interrupts are DISABLED:
54 ;-----------------------------------------------------------------------------
55 %macro PRIVILEGED 0
56 %macro JMP_IF_IRQS_OFF 1
57 mov eax, CP0_Status ; eax := CP0_Status
58 and eax, 3 ; select only IE | EXL | ERL bits
59 sub eax, 1 ; if eax == 1, then interrupts enabled
60 jnz %1 ; so if interrupts not enabled, jump.
61 %endmacro
62 ;-----------------------------------------------------------------------------
63
64 ;-----------------------------------------------------------------------------
65 ; Jump to given target if CPU is currently in Kernel Mode:
66 ;-----------------------------------------------------------------------------
67 %macro JMP_IF_KERNELMODE 1
68 bt CP0_Status, CP0St_UM ; CF := CP0St_UM Flag
69 jnc %%proceed ; If UM = 0: Kernel Mode, proceed.
70 jnc %1 ; If UM = 0: Kernel Mode, proceed.
71 test CP0_Status, (1 << CP0St_EXL) | (1 << CP0St_ERL) ; EXL or ERL
72 jnz %%proceed ; If EXL && ERL: Kernel Mode, proceed.
73 jnz %1 ; If EXL or ERL: Kernel Mode, proceed.
74 %endmacro
75 ;-----------------------------------------------------------------------------
76
77 ;-----------------------------------------------------------------------------
78 ; Denote privileged (permitted in Kernel-Mode strictly) instructions.
79 ;-----------------------------------------------------------------------------
80 %macro PRIVILEGED 0
81 JMP_IF_KERNELMODE %%proceed ; If in Kernel Mode : proceed;
82 ;; We are NOT in kernel mode, but trying to execute a privileged inst:
83 SetEXC EXC_RI ; Set the 'Reserved Instr.' Exception.
84 jmp _Handle_Exception ; Go straight to exception handler.
85 jmp _Handle_Exception_Other ; Go straight to exception handler.
86 %%proceed ; We're in Kernel Mode, so proceed with the privileged instruction.
87 %endmacro
88 ;-----------------------------------------------------------------------------