target/ppc: powerpc_excp: Consolidade TLB miss code
The only difference in the code for Instruction fetch, Data load and Data store TLB miss errors is that when called from an unsupported processor (i.e. not one of 602, 603, 603e, G2, 7x5 or 74xx), they abort with a message specific to the operation type (insn fetch, data load/store). If a processor does not support those interrupts we should not be registering them in init_excp_<proc> to begin with, so that error message would never be used. I'm leaving the message in for completeness, but making it generic and consolidating the three interrupts into the same case statement body. Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com> Message-Id: <20210601214649.785647-4-farosas@linux.ibm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
0c87018c7c
commit
51b385db58
|
@ -689,52 +689,20 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
|
||||||
"is not implemented yet !\n");
|
"is not implemented yet !\n");
|
||||||
break;
|
break;
|
||||||
case POWERPC_EXCP_IFTLB: /* Instruction fetch TLB error */
|
case POWERPC_EXCP_IFTLB: /* Instruction fetch TLB error */
|
||||||
switch (excp_model) {
|
|
||||||
case POWERPC_EXCP_602:
|
|
||||||
case POWERPC_EXCP_603:
|
|
||||||
case POWERPC_EXCP_603E:
|
|
||||||
case POWERPC_EXCP_G2:
|
|
||||||
goto tlb_miss_tgpr;
|
|
||||||
case POWERPC_EXCP_7x5:
|
|
||||||
goto tlb_miss;
|
|
||||||
case POWERPC_EXCP_74xx:
|
|
||||||
goto tlb_miss_74xx;
|
|
||||||
default:
|
|
||||||
cpu_abort(cs, "Invalid instruction TLB miss exception\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case POWERPC_EXCP_DLTLB: /* Data load TLB miss */
|
case POWERPC_EXCP_DLTLB: /* Data load TLB miss */
|
||||||
switch (excp_model) {
|
|
||||||
case POWERPC_EXCP_602:
|
|
||||||
case POWERPC_EXCP_603:
|
|
||||||
case POWERPC_EXCP_603E:
|
|
||||||
case POWERPC_EXCP_G2:
|
|
||||||
goto tlb_miss_tgpr;
|
|
||||||
case POWERPC_EXCP_7x5:
|
|
||||||
goto tlb_miss;
|
|
||||||
case POWERPC_EXCP_74xx:
|
|
||||||
goto tlb_miss_74xx;
|
|
||||||
default:
|
|
||||||
cpu_abort(cs, "Invalid data load TLB miss exception\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case POWERPC_EXCP_DSTLB: /* Data store TLB miss */
|
case POWERPC_EXCP_DSTLB: /* Data store TLB miss */
|
||||||
switch (excp_model) {
|
switch (excp_model) {
|
||||||
case POWERPC_EXCP_602:
|
case POWERPC_EXCP_602:
|
||||||
case POWERPC_EXCP_603:
|
case POWERPC_EXCP_603:
|
||||||
case POWERPC_EXCP_603E:
|
case POWERPC_EXCP_603E:
|
||||||
case POWERPC_EXCP_G2:
|
case POWERPC_EXCP_G2:
|
||||||
tlb_miss_tgpr:
|
|
||||||
/* Swap temporary saved registers with GPRs */
|
/* Swap temporary saved registers with GPRs */
|
||||||
if (!(new_msr & ((target_ulong)1 << MSR_TGPR))) {
|
if (!(new_msr & ((target_ulong)1 << MSR_TGPR))) {
|
||||||
new_msr |= (target_ulong)1 << MSR_TGPR;
|
new_msr |= (target_ulong)1 << MSR_TGPR;
|
||||||
hreg_swap_gpr_tgpr(env);
|
hreg_swap_gpr_tgpr(env);
|
||||||
}
|
}
|
||||||
goto tlb_miss;
|
/* fall through */
|
||||||
case POWERPC_EXCP_7x5:
|
case POWERPC_EXCP_7x5:
|
||||||
tlb_miss:
|
|
||||||
#if defined(DEBUG_SOFTWARE_TLB)
|
#if defined(DEBUG_SOFTWARE_TLB)
|
||||||
if (qemu_log_enabled()) {
|
if (qemu_log_enabled()) {
|
||||||
const char *es;
|
const char *es;
|
||||||
|
@ -769,7 +737,6 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
|
||||||
msr |= ((env->last_way + 1) & (env->nb_ways - 1)) << 17;
|
msr |= ((env->last_way + 1) & (env->nb_ways - 1)) << 17;
|
||||||
break;
|
break;
|
||||||
case POWERPC_EXCP_74xx:
|
case POWERPC_EXCP_74xx:
|
||||||
tlb_miss_74xx:
|
|
||||||
#if defined(DEBUG_SOFTWARE_TLB)
|
#if defined(DEBUG_SOFTWARE_TLB)
|
||||||
if (qemu_log_enabled()) {
|
if (qemu_log_enabled()) {
|
||||||
const char *es;
|
const char *es;
|
||||||
|
@ -799,7 +766,7 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
|
||||||
msr |= env->error_code; /* key bit */
|
msr |= env->error_code; /* key bit */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cpu_abort(cs, "Invalid data store TLB miss exception\n");
|
cpu_abort(cs, "Invalid TLB miss exception\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue