mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-25 18:29:49 +00:00
ppcopcodes: Add Privileged exception for SPRs.
Accessing an SPR with bit 4 set (> 15) requires supervisor privilege and should cause a supervisor-level instruction exception (privileged instruction type program exception).
This commit is contained in:
parent
0273867c49
commit
67a5c39b1c
@ -888,11 +888,14 @@ void dppc_interpreter::ppc_mfspr() {
|
||||
ppc_grab_dab(ppc_cur_instruction);
|
||||
uint32_t ref_spr = (reg_b << 5) | reg_a;
|
||||
|
||||
if (ref_spr & 0x10) {
|
||||
#ifdef CPU_PROFILING
|
||||
if (ref_spr > 31) {
|
||||
num_supervisor_instrs++;
|
||||
}
|
||||
#endif
|
||||
if (ppc_state.msr & MSR::PR) {
|
||||
ppc_exception_handler(Except_Type::EXC_PROGRAM, Exc_Cause::NOT_ALLOWED);
|
||||
}
|
||||
}
|
||||
|
||||
switch (ref_spr) {
|
||||
case SPR::RTCL_U:
|
||||
@ -915,11 +918,14 @@ void dppc_interpreter::ppc_mtspr() {
|
||||
ppc_grab_dab(ppc_cur_instruction);
|
||||
uint32_t ref_spr = (reg_b << 5) | reg_a;
|
||||
|
||||
if (ref_spr & 0x10) {
|
||||
#ifdef CPU_PROFILING
|
||||
if (ref_spr > 31) {
|
||||
num_supervisor_instrs++;
|
||||
}
|
||||
#endif
|
||||
if (ppc_state.msr & MSR::PR) {
|
||||
ppc_exception_handler(Except_Type::EXC_PROGRAM, Exc_Cause::NOT_ALLOWED);
|
||||
}
|
||||
}
|
||||
|
||||
if (ref_spr == SPR::PVR || (
|
||||
ref_spr == SPR::MQ && !is_601
|
||||
|
Loading…
Reference in New Issue
Block a user