Handle some more exception types.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3886 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
ths 2008-01-04 17:52:57 +00:00
parent 9a5d878f6e
commit b67bfe8d9f

View File

@ -442,23 +442,13 @@ void do_interrupt (CPUState *env)
env->CP0_Cause &= ~(1 << CP0Ca_BD); env->CP0_Cause &= ~(1 << CP0Ca_BD);
env->PC[env->current_tc] = (int32_t)0xBFC00000; env->PC[env->current_tc] = (int32_t)0xBFC00000;
break; break;
case EXCP_MCHECK:
cause = 24;
goto set_EPC;
case EXCP_EXT_INTERRUPT: case EXCP_EXT_INTERRUPT:
cause = 0; cause = 0;
if (env->CP0_Cause & (1 << CP0Ca_IV)) if (env->CP0_Cause & (1 << CP0Ca_IV))
offset = 0x200; offset = 0x200;
goto set_EPC; goto set_EPC;
case EXCP_DWATCH: case EXCP_LTLBL:
cause = 23; cause = 1;
/* XXX: TODO: manage defered watch exceptions */
goto set_EPC;
case EXCP_AdEL:
cause = 4;
goto set_EPC;
case EXCP_AdES:
cause = 5;
goto set_EPC; goto set_EPC;
case EXCP_TLBL: case EXCP_TLBL:
cause = 2; cause = 2;
@ -476,6 +466,28 @@ void do_interrupt (CPUState *env)
offset = 0x000; offset = 0x000;
} }
goto set_EPC; goto set_EPC;
case EXCP_TLBS:
cause = 3;
if (env->error_code == 1 && !(env->CP0_Status & (1 << CP0St_EXL))) {
#if defined(TARGET_MIPS64)
int R = env->CP0_BadVAddr >> 62;
int UX = (env->CP0_Status & (1 << CP0St_UX)) != 0;
int SX = (env->CP0_Status & (1 << CP0St_SX)) != 0;
int KX = (env->CP0_Status & (1 << CP0St_KX)) != 0;
if ((R == 0 && UX) || (R == 1 && SX) || (R == 3 && KX))
offset = 0x080;
else
#endif
offset = 0x000;
}
goto set_EPC;
case EXCP_AdEL:
cause = 4;
goto set_EPC;
case EXCP_AdES:
cause = 5;
goto set_EPC;
case EXCP_IBE: case EXCP_IBE:
cause = 6; cause = 6;
goto set_EPC; goto set_EPC;
@ -505,27 +517,29 @@ void do_interrupt (CPUState *env)
case EXCP_FPE: case EXCP_FPE:
cause = 15; cause = 15;
goto set_EPC; goto set_EPC;
case EXCP_LTLBL: case EXCP_C2E:
cause = 1; cause = 18;
goto set_EPC; goto set_EPC;
case EXCP_TLBS: case EXCP_MDMX:
cause = 3; cause = 22;
if (env->error_code == 1 && !(env->CP0_Status & (1 << CP0St_EXL))) { goto set_EPC;
#if defined(TARGET_MIPS64) case EXCP_DWATCH:
int R = env->CP0_BadVAddr >> 62; cause = 23;
int UX = (env->CP0_Status & (1 << CP0St_UX)) != 0; /* XXX: TODO: manage defered watch exceptions */
int SX = (env->CP0_Status & (1 << CP0St_SX)) != 0; goto set_EPC;
int KX = (env->CP0_Status & (1 << CP0St_KX)) != 0; case EXCP_MCHECK:
cause = 24;
if ((R == 0 && UX) || (R == 1 && SX) || (R == 3 && KX))
offset = 0x080;
else
#endif
offset = 0x000;
}
goto set_EPC; goto set_EPC;
case EXCP_THREAD: case EXCP_THREAD:
cause = 25; cause = 25;
goto set_EPC;
case EXCP_CACHE:
cause = 30;
if (env->CP0_Status & (1 << CP0St_BEV)) {
offset = 0x100;
} else {
offset = 0x20000100;
}
set_EPC: set_EPC:
if (!(env->CP0_Status & (1 << CP0St_EXL))) { if (!(env->CP0_Status & (1 << CP0St_EXL))) {
if (env->hflags & MIPS_HFLAG_BMASK) { if (env->hflags & MIPS_HFLAG_BMASK) {