提交 f1b0aa5d 编写于 作者: T ths

Fix mfc0 and dmtc0 instructions on MIPS64, by Aurelien Jarno.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2819 c046a42c-6fe2-441c-8c8c-71466251a162
上级 6b4d2ba1
...@@ -1260,7 +1260,7 @@ void op_mtc0_entrylo0 (void) ...@@ -1260,7 +1260,7 @@ void op_mtc0_entrylo0 (void)
{ {
/* Large physaddr not implemented */ /* Large physaddr not implemented */
/* 1k pages not implemented */ /* 1k pages not implemented */
env->CP0_EntryLo0 = (int32_t)T0 & 0x3FFFFFFF; env->CP0_EntryLo0 = T0 & 0x3FFFFFFF;
RETURN(); RETURN();
} }
...@@ -1268,7 +1268,7 @@ void op_mtc0_entrylo1 (void) ...@@ -1268,7 +1268,7 @@ void op_mtc0_entrylo1 (void)
{ {
/* Large physaddr not implemented */ /* Large physaddr not implemented */
/* 1k pages not implemented */ /* 1k pages not implemented */
env->CP0_EntryLo1 = (int32_t)T0 & 0x3FFFFFFF; env->CP0_EntryLo1 = T0 & 0x3FFFFFFF;
RETURN(); RETURN();
} }
...@@ -1338,9 +1338,9 @@ void op_mtc0_status (void) ...@@ -1338,9 +1338,9 @@ void op_mtc0_status (void)
uint32_t val, old; uint32_t val, old;
uint32_t mask = env->Status_rw_bitmask; uint32_t mask = env->Status_rw_bitmask;
/* No reverse endianness, no MDMX/DSP, no 64bit ops, /* No reverse endianness, no MDMX/DSP, no 64bit ops
no 64bit addressing implemented. */ implemented. */
val = (int32_t)T0 & mask; val = T0 & mask;
old = env->CP0_Status; old = env->CP0_Status;
if (!(val & (1 << CP0St_EXL)) && if (!(val & (1 << CP0St_EXL)) &&
!(val & (1 << CP0St_ERL)) && !(val & (1 << CP0St_ERL)) &&
...@@ -1395,7 +1395,7 @@ void op_mtc0_cause (void) ...@@ -1395,7 +1395,7 @@ void op_mtc0_cause (void)
void op_mtc0_epc (void) void op_mtc0_epc (void)
{ {
env->CP0_EPC = (int32_t)T0; env->CP0_EPC = T0;
RETURN(); RETURN();
} }
...@@ -1424,7 +1424,7 @@ void op_mtc0_watchlo0 (void) ...@@ -1424,7 +1424,7 @@ void op_mtc0_watchlo0 (void)
{ {
/* Watch exceptions for instructions, data loads, data stores /* Watch exceptions for instructions, data loads, data stores
not implemented. */ not implemented. */
env->CP0_WatchLo = (int32_t)(T0 & ~0x7); env->CP0_WatchLo = (T0 & ~0x7);
RETURN(); RETURN();
} }
...@@ -1453,7 +1453,7 @@ void op_mtc0_debug (void) ...@@ -1453,7 +1453,7 @@ void op_mtc0_debug (void)
void op_mtc0_depc (void) void op_mtc0_depc (void)
{ {
env->CP0_DEPC = (int32_t)T0; env->CP0_DEPC = T0;
RETURN(); RETURN();
} }
...@@ -1489,7 +1489,7 @@ void op_mtc0_datahi (void) ...@@ -1489,7 +1489,7 @@ void op_mtc0_datahi (void)
void op_mtc0_errorepc (void) void op_mtc0_errorepc (void)
{ {
env->CP0_ErrorEPC = (int32_t)T0; env->CP0_ErrorEPC = T0;
RETURN(); RETURN();
} }
...@@ -1500,6 +1500,12 @@ void op_mtc0_desave (void) ...@@ -1500,6 +1500,12 @@ void op_mtc0_desave (void)
} }
#ifdef TARGET_MIPS64 #ifdef TARGET_MIPS64
void op_mtc0_xcontext (void)
{
env->CP0_XContext = (env->CP0_XContext & 0x1ffffffffULL) | (T0 & ~0x1ffffffffULL);
RETURN();
}
void op_dmfc0_entrylo0 (void) void op_dmfc0_entrylo0 (void)
{ {
T0 = env->CP0_EntryLo0; T0 = env->CP0_EntryLo0;
...@@ -1565,60 +1571,6 @@ void op_dmfc0_errorepc (void) ...@@ -1565,60 +1571,6 @@ void op_dmfc0_errorepc (void)
T0 = env->CP0_ErrorEPC; T0 = env->CP0_ErrorEPC;
RETURN(); RETURN();
} }
void op_dmtc0_entrylo0 (void)
{
/* Large physaddr not implemented */
/* 1k pages not implemented */
env->CP0_EntryLo0 = T0 & 0x3FFFFFFF;
RETURN();
}
void op_dmtc0_entrylo1 (void)
{
/* Large physaddr not implemented */
/* 1k pages not implemented */
env->CP0_EntryLo1 = T0 & 0x3FFFFFFF;
RETURN();
}
void op_dmtc0_context (void)
{
env->CP0_Context = (env->CP0_Context & 0x007FFFFF) | (T0 & ~0x007FFFFF);
RETURN();
}
void op_dmtc0_epc (void)
{
env->CP0_EPC = T0;
RETURN();
}
void op_dmtc0_watchlo0 (void)
{
/* Watch exceptions for instructions, data loads, data stores
not implemented. */
env->CP0_WatchLo = T0 & ~0x7;
RETURN();
}
void op_dmtc0_xcontext (void)
{
env->CP0_XContext = (env->CP0_XContext & 0xffffffff) | (T0 & ~0xffffffff);
RETURN();
}
void op_dmtc0_depc (void)
{
env->CP0_DEPC = T0;
RETURN();
}
void op_dmtc0_errorepc (void)
{
env->CP0_ErrorEPC = T0;
RETURN();
}
#endif /* TARGET_MIPS64 */ #endif /* TARGET_MIPS64 */
/* CP1 functions */ /* CP1 functions */
......
...@@ -2790,7 +2790,7 @@ static void gen_mtc0 (DisasContext *ctx, int reg, int sel) ...@@ -2790,7 +2790,7 @@ static void gen_mtc0 (DisasContext *ctx, int reg, int sel)
switch (sel) { switch (sel) {
case 0: case 0:
#ifdef TARGET_MIPS64 #ifdef TARGET_MIPS64
/* Nothing writable in lower 32 bits */ gen_op_mtc0_xcontext();
rn = "XContext"; rn = "XContext";
break; break;
#endif #endif
...@@ -3583,15 +3583,15 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) ...@@ -3583,15 +3583,15 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
rn = "Index"; rn = "Index";
break; break;
case 1: case 1:
// gen_op_dmtc0_mvpcontrol(); /* MT ASE */ // gen_op_mtc0_mvpcontrol(); /* MT ASE */
rn = "MVPControl"; rn = "MVPControl";
// break; // break;
case 2: case 2:
// gen_op_dmtc0_mvpconf0(); /* MT ASE */ // gen_op_mtc0_mvpconf0(); /* MT ASE */
rn = "MVPConf0"; rn = "MVPConf0";
// break; // break;
case 3: case 3:
// gen_op_dmtc0_mvpconf1(); /* MT ASE */ // gen_op_mtc0_mvpconf1(); /* MT ASE */
rn = "MVPConf1"; rn = "MVPConf1";
// break; // break;
default: default:
...@@ -3605,31 +3605,31 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) ...@@ -3605,31 +3605,31 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
rn = "Random"; rn = "Random";
break; break;
case 1: case 1:
// gen_op_dmtc0_vpecontrol(); /* MT ASE */ // gen_op_mtc0_vpecontrol(); /* MT ASE */
rn = "VPEControl"; rn = "VPEControl";
// break; // break;
case 2: case 2:
// gen_op_dmtc0_vpeconf0(); /* MT ASE */ // gen_op_mtc0_vpeconf0(); /* MT ASE */
rn = "VPEConf0"; rn = "VPEConf0";
// break; // break;
case 3: case 3:
// gen_op_dmtc0_vpeconf1(); /* MT ASE */ // gen_op_mtc0_vpeconf1(); /* MT ASE */
rn = "VPEConf1"; rn = "VPEConf1";
// break; // break;
case 4: case 4:
// gen_op_dmtc0_YQMask(); /* MT ASE */ // gen_op_mtc0_YQMask(); /* MT ASE */
rn = "YQMask"; rn = "YQMask";
// break; // break;
case 5: case 5:
// gen_op_dmtc0_vpeschedule(); /* MT ASE */ // gen_op_mtc0_vpeschedule(); /* MT ASE */
rn = "VPESchedule"; rn = "VPESchedule";
// break; // break;
case 6: case 6:
// gen_op_dmtc0_vpeschefback(); /* MT ASE */ // gen_op_mtc0_vpeschefback(); /* MT ASE */
rn = "VPEScheFBack"; rn = "VPEScheFBack";
// break; // break;
case 7: case 7:
// gen_op_dmtc0_vpeopt(); /* MT ASE */ // gen_op_mtc0_vpeopt(); /* MT ASE */
rn = "VPEOpt"; rn = "VPEOpt";
// break; // break;
default: default:
...@@ -3639,35 +3639,35 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) ...@@ -3639,35 +3639,35 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
case 2: case 2:
switch (sel) { switch (sel) {
case 0: case 0:
gen_op_dmtc0_entrylo0(); gen_op_mtc0_entrylo0();
rn = "EntryLo0"; rn = "EntryLo0";
break; break;
case 1: case 1:
// gen_op_dmtc0_tcstatus(); /* MT ASE */ // gen_op_mtc0_tcstatus(); /* MT ASE */
rn = "TCStatus"; rn = "TCStatus";
// break; // break;
case 2: case 2:
// gen_op_dmtc0_tcbind(); /* MT ASE */ // gen_op_mtc0_tcbind(); /* MT ASE */
rn = "TCBind"; rn = "TCBind";
// break; // break;
case 3: case 3:
// gen_op_dmtc0_tcrestart(); /* MT ASE */ // gen_op_mtc0_tcrestart(); /* MT ASE */
rn = "TCRestart"; rn = "TCRestart";
// break; // break;
case 4: case 4:
// gen_op_dmtc0_tchalt(); /* MT ASE */ // gen_op_mtc0_tchalt(); /* MT ASE */
rn = "TCHalt"; rn = "TCHalt";
// break; // break;
case 5: case 5:
// gen_op_dmtc0_tccontext(); /* MT ASE */ // gen_op_mtc0_tccontext(); /* MT ASE */
rn = "TCContext"; rn = "TCContext";
// break; // break;
case 6: case 6:
// gen_op_dmtc0_tcschedule(); /* MT ASE */ // gen_op_mtc0_tcschedule(); /* MT ASE */
rn = "TCSchedule"; rn = "TCSchedule";
// break; // break;
case 7: case 7:
// gen_op_dmtc0_tcschefback(); /* MT ASE */ // gen_op_mtc0_tcschefback(); /* MT ASE */
rn = "TCScheFBack"; rn = "TCScheFBack";
// break; // break;
default: default:
...@@ -3677,7 +3677,7 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) ...@@ -3677,7 +3677,7 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
case 3: case 3:
switch (sel) { switch (sel) {
case 0: case 0:
gen_op_dmtc0_entrylo1(); gen_op_mtc0_entrylo1();
rn = "EntryLo1"; rn = "EntryLo1";
break; break;
default: default:
...@@ -3687,11 +3687,11 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) ...@@ -3687,11 +3687,11 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
case 4: case 4:
switch (sel) { switch (sel) {
case 0: case 0:
gen_op_dmtc0_context(); gen_op_mtc0_context();
rn = "Context"; rn = "Context";
break; break;
case 1: case 1:
// gen_op_dmtc0_contextconfig(); /* SmartMIPS ASE */ // gen_op_mtc0_contextconfig(); /* SmartMIPS ASE */
rn = "ContextConfig"; rn = "ContextConfig";
// break; // break;
default: default:
...@@ -3719,23 +3719,23 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) ...@@ -3719,23 +3719,23 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
rn = "Wired"; rn = "Wired";
break; break;
case 1: case 1:
// gen_op_dmtc0_srsconf0(); /* shadow registers */ // gen_op_mtc0_srsconf0(); /* shadow registers */
rn = "SRSConf0"; rn = "SRSConf0";
// break; // break;
case 2: case 2:
// gen_op_dmtc0_srsconf1(); /* shadow registers */ // gen_op_mtc0_srsconf1(); /* shadow registers */
rn = "SRSConf1"; rn = "SRSConf1";
// break; // break;
case 3: case 3:
// gen_op_dmtc0_srsconf2(); /* shadow registers */ // gen_op_mtc0_srsconf2(); /* shadow registers */
rn = "SRSConf2"; rn = "SRSConf2";
// break; // break;
case 4: case 4:
// gen_op_dmtc0_srsconf3(); /* shadow registers */ // gen_op_mtc0_srsconf3(); /* shadow registers */
rn = "SRSConf3"; rn = "SRSConf3";
// break; // break;
case 5: case 5:
// gen_op_dmtc0_srsconf4(); /* shadow registers */ // gen_op_mtc0_srsconf4(); /* shadow registers */
rn = "SRSConf4"; rn = "SRSConf4";
// break; // break;
default: default:
...@@ -3831,7 +3831,7 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) ...@@ -3831,7 +3831,7 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
case 14: case 14:
switch (sel) { switch (sel) {
case 0: case 0:
gen_op_dmtc0_epc(); gen_op_mtc0_epc();
rn = "EPC"; rn = "EPC";
break; break;
default: default:
...@@ -3893,35 +3893,35 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) ...@@ -3893,35 +3893,35 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
case 18: case 18:
switch (sel) { switch (sel) {
case 0: case 0:
gen_op_dmtc0_watchlo0(); gen_op_mtc0_watchlo0();
rn = "WatchLo"; rn = "WatchLo";
break; break;
case 1: case 1:
// gen_op_dmtc0_watchlo1(); // gen_op_mtc0_watchlo1();
rn = "WatchLo1"; rn = "WatchLo1";
// break; // break;
case 2: case 2:
// gen_op_dmtc0_watchlo2(); // gen_op_mtc0_watchlo2();
rn = "WatchLo2"; rn = "WatchLo2";
// break; // break;
case 3: case 3:
// gen_op_dmtc0_watchlo3(); // gen_op_mtc0_watchlo3();
rn = "WatchLo3"; rn = "WatchLo3";
// break; // break;
case 4: case 4:
// gen_op_dmtc0_watchlo4(); // gen_op_mtc0_watchlo4();
rn = "WatchLo4"; rn = "WatchLo4";
// break; // break;
case 5: case 5:
// gen_op_dmtc0_watchlo5(); // gen_op_mtc0_watchlo5();
rn = "WatchLo5"; rn = "WatchLo5";
// break; // break;
case 6: case 6:
// gen_op_dmtc0_watchlo6(); // gen_op_mtc0_watchlo6();
rn = "WatchLo6"; rn = "WatchLo6";
// break; // break;
case 7: case 7:
// gen_op_dmtc0_watchlo7(); // gen_op_mtc0_watchlo7();
rn = "WatchLo7"; rn = "WatchLo7";
// break; // break;
default: default:
...@@ -3935,31 +3935,31 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) ...@@ -3935,31 +3935,31 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
rn = "WatchHi"; rn = "WatchHi";
break; break;
case 1: case 1:
// gen_op_dmtc0_watchhi1(); // gen_op_mtc0_watchhi1();
rn = "WatchHi1"; rn = "WatchHi1";
// break; // break;
case 2: case 2:
// gen_op_dmtc0_watchhi2(); // gen_op_mtc0_watchhi2();
rn = "WatchHi2"; rn = "WatchHi2";
// break; // break;
case 3: case 3:
// gen_op_dmtc0_watchhi3(); // gen_op_mtc0_watchhi3();
rn = "WatchHi3"; rn = "WatchHi3";
// break; // break;
case 4: case 4:
// gen_op_dmtc0_watchhi4(); // gen_op_mtc0_watchhi4();
rn = "WatchHi4"; rn = "WatchHi4";
// break; // break;
case 5: case 5:
// gen_op_dmtc0_watchhi5(); // gen_op_mtc0_watchhi5();
rn = "WatchHi5"; rn = "WatchHi5";
// break; // break;
case 6: case 6:
// gen_op_dmtc0_watchhi6(); // gen_op_mtc0_watchhi6();
rn = "WatchHi6"; rn = "WatchHi6";
// break; // break;
case 7: case 7:
// gen_op_dmtc0_watchhi7(); // gen_op_mtc0_watchhi7();
rn = "WatchHi7"; rn = "WatchHi7";
// break; // break;
default: default:
...@@ -3970,7 +3970,7 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) ...@@ -3970,7 +3970,7 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
switch (sel) { switch (sel) {
case 0: case 0:
#ifdef TARGET_MIPS64 #ifdef TARGET_MIPS64
gen_op_dmtc0_xcontext(); gen_op_mtc0_xcontext();
rn = "XContext"; rn = "XContext";
break; break;
#endif #endif
...@@ -4000,19 +4000,19 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) ...@@ -4000,19 +4000,19 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
rn = "Debug"; rn = "Debug";
break; break;
case 1: case 1:
// gen_op_dmtc0_tracecontrol(); /* PDtrace support */ // gen_op_mtc0_tracecontrol(); /* PDtrace support */
rn = "TraceControl"; rn = "TraceControl";
// break; // break;
case 2: case 2:
// gen_op_dmtc0_tracecontrol2(); /* PDtrace support */ // gen_op_mtc0_tracecontrol2(); /* PDtrace support */
rn = "TraceControl2"; rn = "TraceControl2";
// break; // break;
case 3: case 3:
// gen_op_dmtc0_usertracedata(); /* PDtrace support */ // gen_op_mtc0_usertracedata(); /* PDtrace support */
rn = "UserTraceData"; rn = "UserTraceData";
// break; // break;
case 4: case 4:
// gen_op_dmtc0_debug(); /* PDtrace support */ // gen_op_mtc0_debug(); /* PDtrace support */
rn = "TraceBPC"; rn = "TraceBPC";
// break; // break;
default: default:
...@@ -4024,7 +4024,7 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) ...@@ -4024,7 +4024,7 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
case 24: case 24:
switch (sel) { switch (sel) {
case 0: case 0:
gen_op_dmtc0_depc(); /* EJTAG support */ gen_op_mtc0_depc(); /* EJTAG support */
rn = "DEPC"; rn = "DEPC";
break; break;
default: default:
...@@ -4038,31 +4038,31 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) ...@@ -4038,31 +4038,31 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
rn = "Performance0"; rn = "Performance0";
break; break;
case 1: case 1:
// gen_op_dmtc0_performance1(); // gen_op_mtc0_performance1();
rn = "Performance1"; rn = "Performance1";
// break; // break;
case 2: case 2:
// gen_op_dmtc0_performance2(); // gen_op_mtc0_performance2();
rn = "Performance2"; rn = "Performance2";
// break; // break;
case 3: case 3:
// gen_op_dmtc0_performance3(); // gen_op_mtc0_performance3();
rn = "Performance3"; rn = "Performance3";
// break; // break;
case 4: case 4:
// gen_op_dmtc0_performance4(); // gen_op_mtc0_performance4();
rn = "Performance4"; rn = "Performance4";
// break; // break;
case 5: case 5:
// gen_op_dmtc0_performance5(); // gen_op_mtc0_performance5();
rn = "Performance5"; rn = "Performance5";
// break; // break;
case 6: case 6:
// gen_op_dmtc0_performance6(); // gen_op_mtc0_performance6();
rn = "Performance6"; rn = "Performance6";
// break; // break;
case 7: case 7:
// gen_op_dmtc0_performance7(); // gen_op_mtc0_performance7();
rn = "Performance7"; rn = "Performance7";
// break; // break;
default: default:
...@@ -4127,7 +4127,7 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) ...@@ -4127,7 +4127,7 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
case 30: case 30:
switch (sel) { switch (sel) {
case 0: case 0:
gen_op_dmtc0_errorepc(); gen_op_mtc0_errorepc();
rn = "ErrorEPC"; rn = "ErrorEPC";
break; break;
default: default:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册