Implement supervisor mode
PATCH 1/1 Implement supervisor mode
Hi all,
The patch below fully implements supervisor mode, and modify the the corresponding bits in CP0_Status_rw_bitmask for the CPU which support this mode.
Bye,
Aurelien
Index: target-mips/exec.h
===================================================================
RCS file: /sources/qemu/qemu/target-mips/exec.h,v
retrieving revision 1.34
exec.h +9 -4
@@ -261,16 +261,21 @@ static inline void compute_hflags(CPUSta MIPS_HFLAG_FPU | MIPS_HFLAG_UM);if (!(env->CP0_Status & (1 << CP0St_EXL)) && !(env->CP0_Status & (1 << CP0St_ERL)) && - !(env->hflags &MIPS_HFLAG_DM ) && - (env->CP0_Status & (1 << CP0St_UM))) - env->hflags |=MIPS_HFLAG_UM ; + !(env->hflags &MIPS_HFLAG_DM )) { +if (env->CP0_Status & (1 << CP0St_UM)) + env->hflags |=MIPS_HFLAG_UM ; +if (env->CP0_Status & (1 << CP0St_R0)) + env->hflags |=MIPS_HFLAG_SM ; + }#ifdef TARGET_MIPS64 if (!(env->hflags &MIPS_HFLAG_UM ) || (env->CP0_Status & (1 << CP0St_PX)) || (env->CP0_Status & (1 << CP0St_UX))) env->hflags |=MIPS_HFLAG_64 ;#endif -if ((env->CP0_Status & (1 << CP0St_CU0)) || !(env->hflags &MIPS_HFLAG_UM )) +if ((env->CP0_Status & (1 << CP0St_CU0)) || + (!(env->hflags &MIPS_HFLAG_UM ) && + !(env->hflags &MIPS_HFLAG_SM ))) env->hflags |=MIPS_HFLAG_CP0 ;if (env->CP0_Status & (1 << CP0St_CU1)) env->hflags |=MIPS_HFLAG_FPU ;
Index: target-mips/helper.c
===================================================================
RCS file: /sources/qemu/qemu/target-mips/helper.c,v retrieving revision 1.51
helper.c +34 -27
121 lines not on this page · raw message
Index: target-mips/translate_init.c
===================================================================
RCS file: /sources/qemu/qemu/target-mips/translate_init.c,v retrieving revision 1.22
translate_init.c +3 -3
@@ -141,7 +141,7 @@ static mips_def_t mips_defs[] = .SYNCI_Step = 32, .CCRes = 2, /* No DSP implemented. */ - .CP0_Status_rw_bitmask = 0x1278FF17, + .CP0_Status_rw_bitmask = 0x1278FF1F, .insn_flags = CPU_MIPS32R2 | ASE_MIPS16 | ASE_DSP, }, {
@@ -156,7 +156,7 @@ static mips_def_t mips_defs[] = .SYNCI_Step = 32, .CCRes = 2,/* No DSP implemented. */ - .CP0_Status_rw_bitmask = 0x3678FF17, + .CP0_Status_rw_bitmask = 0x3678FF1F, .CP1_fcr0 = (1 <<FCR0_F64 ) | (1 <<FCR0_L ) | (1 <<FCR0_W ) | (1 << FCR0_D) | (1 << FCR0_S) | (0x93 << FCR0_PRID), .insn_flags = CPU_MIPS32R2 | ASE_MIPS16 | ASE_DSP,
@@ -173,7 +173,7 @@ static mips_def_t mips_defs[] = .SYNCI_Step = 32, .CCRes = 2,/* No DSP implemented. */ - .CP0_Status_rw_bitmask = 0x3678FF17, + .CP0_Status_rw_bitmask = 0x3678FF1F,/* No DSP implemented. */ .CP0_TCStatus_rw_bitmask = (0 << CP0TCSt_TCU3) | (0 << CP0TCSt_TCU2) | (1 << CP0TCSt_TCU1) | (1 << CP0TCSt_TCU0) |
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net