| 177 |
#define RET_PRIVREG(ctx) \ |
#define RET_PRIVREG(ctx) \ |
| 178 |
RET_EXCP((ctx), EXCP_PROGRAM, EXCP_INVAL | EXCP_PRIV_REG) |
RET_EXCP((ctx), EXCP_PROGRAM, EXCP_INVAL | EXCP_PRIV_REG) |
| 179 |
|
|
| 180 |
#define RET_MTMSR(ctx) \ |
/* Stop translation */ |
|
RET_EXCP((ctx), EXCP_MTMSR, 0) |
|
|
|
|
| 181 |
static inline void RET_STOP (DisasContext *ctx) |
static inline void RET_STOP (DisasContext *ctx) |
| 182 |
{ |
{ |
| 183 |
RET_EXCP(ctx, EXCP_MTMSR, 0); |
gen_op_update_nip((ctx)->nip); |
| 184 |
|
ctx->exception = EXCP_MTMSR; |
| 185 |
} |
} |
| 186 |
|
|
| 187 |
|
/* No need to update nip here, as execution flow will change */ |
| 188 |
static inline void RET_CHG_FLOW (DisasContext *ctx) |
static inline void RET_CHG_FLOW (DisasContext *ctx) |
| 189 |
{ |
{ |
|
gen_op_raise_exception_err(EXCP_MTMSR, 0); |
|
| 190 |
ctx->exception = EXCP_MTMSR; |
ctx->exception = EXCP_MTMSR; |
| 191 |
} |
} |
| 192 |
|
|
| 2050 |
gen_op_store_T0_gpr(rD(ctx->opcode)); |
gen_op_store_T0_gpr(rD(ctx->opcode)); |
| 2051 |
} else { |
} else { |
| 2052 |
/* Privilege exception */ |
/* Privilege exception */ |
| 2053 |
|
if (loglevel) { |
| 2054 |
|
fprintf(logfile, "Trying to read priviledged spr %d %03x\n", |
| 2055 |
|
sprn, sprn); |
| 2056 |
|
} |
| 2057 |
printf("Trying to read priviledged spr %d %03x\n", sprn, sprn); |
printf("Trying to read priviledged spr %d %03x\n", sprn, sprn); |
| 2058 |
RET_PRIVREG(ctx); |
RET_PRIVREG(ctx); |
| 2059 |
} |
} |
| 2060 |
} else { |
} else { |
| 2061 |
/* Not defined */ |
/* Not defined */ |
| 2062 |
|
if (loglevel) { |
| 2063 |
|
fprintf(logfile, "Trying to read invalid spr %d %03x\n", |
| 2064 |
|
sprn, sprn); |
| 2065 |
|
} |
| 2066 |
printf("Trying to read invalid spr %d %03x\n", sprn, sprn); |
printf("Trying to read invalid spr %d %03x\n", sprn, sprn); |
| 2067 |
RET_EXCP(ctx, EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_SPR); |
RET_EXCP(ctx, EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_SPR); |
| 2068 |
} |
} |
| 2100 |
gen_op_load_gpr_T0(rS(ctx->opcode)); |
gen_op_load_gpr_T0(rS(ctx->opcode)); |
| 2101 |
gen_op_store_msr(); |
gen_op_store_msr(); |
| 2102 |
/* Must stop the translation as machine state (may have) changed */ |
/* Must stop the translation as machine state (may have) changed */ |
| 2103 |
RET_MTMSR(ctx); |
RET_STOP(ctx); |
| 2104 |
#endif |
#endif |
| 2105 |
} |
} |
| 2106 |
|
|
| 2122 |
(*write_cb)(ctx, sprn); |
(*write_cb)(ctx, sprn); |
| 2123 |
} else { |
} else { |
| 2124 |
/* Privilege exception */ |
/* Privilege exception */ |
| 2125 |
|
if (loglevel) { |
| 2126 |
|
fprintf(logfile, "Trying to write priviledged spr %d %03x\n", |
| 2127 |
|
sprn, sprn); |
| 2128 |
|
} |
| 2129 |
printf("Trying to write priviledged spr %d %03x\n", sprn, sprn); |
printf("Trying to write priviledged spr %d %03x\n", sprn, sprn); |
| 2130 |
RET_PRIVREG(ctx); |
RET_PRIVREG(ctx); |
| 2131 |
} |
} |
| 2132 |
} else { |
} else { |
| 2133 |
/* Not defined */ |
/* Not defined */ |
| 2134 |
|
if (loglevel) { |
| 2135 |
|
fprintf(logfile, "Trying to write invalid spr %d %03x\n", |
| 2136 |
|
sprn, sprn); |
| 2137 |
|
} |
| 2138 |
printf("Trying to write invalid spr %d %03x\n", sprn, sprn); |
printf("Trying to write invalid spr %d %03x\n", sprn, sprn); |
| 2139 |
RET_EXCP(ctx, EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_SPR); |
RET_EXCP(ctx, EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_SPR); |
| 2140 |
} |
} |
| 2293 |
} |
} |
| 2294 |
gen_op_load_gpr_T0(rS(ctx->opcode)); |
gen_op_load_gpr_T0(rS(ctx->opcode)); |
| 2295 |
gen_op_store_sr(SR(ctx->opcode)); |
gen_op_store_sr(SR(ctx->opcode)); |
| 2296 |
RET_MTMSR(ctx); |
RET_STOP(ctx); |
| 2297 |
#endif |
#endif |
| 2298 |
} |
} |
| 2299 |
|
|
| 2310 |
gen_op_load_gpr_T0(rS(ctx->opcode)); |
gen_op_load_gpr_T0(rS(ctx->opcode)); |
| 2311 |
gen_op_load_gpr_T1(rB(ctx->opcode)); |
gen_op_load_gpr_T1(rB(ctx->opcode)); |
| 2312 |
gen_op_store_srin(); |
gen_op_store_srin(); |
| 2313 |
RET_MTMSR(ctx); |
RET_STOP(ctx); |
| 2314 |
#endif |
#endif |
| 2315 |
} |
} |
| 2316 |
|
|
| 2329 |
return; |
return; |
| 2330 |
} |
} |
| 2331 |
gen_op_tlbia(); |
gen_op_tlbia(); |
| 2332 |
RET_MTMSR(ctx); |
RET_STOP(ctx); |
| 2333 |
#endif |
#endif |
| 2334 |
} |
} |
| 2335 |
|
|
| 2345 |
} |
} |
| 2346 |
gen_op_load_gpr_T0(rB(ctx->opcode)); |
gen_op_load_gpr_T0(rB(ctx->opcode)); |
| 2347 |
gen_op_tlbie(); |
gen_op_tlbie(); |
| 2348 |
RET_MTMSR(ctx); |
RET_STOP(ctx); |
| 2349 |
#endif |
#endif |
| 2350 |
} |
} |
| 2351 |
|
|
| 2362 |
/* This has no effect: it should ensure that all previous |
/* This has no effect: it should ensure that all previous |
| 2363 |
* tlbie have completed |
* tlbie have completed |
| 2364 |
*/ |
*/ |
| 2365 |
RET_MTMSR(ctx); |
RET_STOP(ctx); |
| 2366 |
#endif |
#endif |
| 2367 |
} |
} |
| 2368 |
|
|