target-cris: Replace DisasContext::env field with CRISCPU

This cleans up repeated cris_env_get_cpu() for cpu_abort().

Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Andreas Färber 2013-09-03 18:42:27 +02:00
parent a47dddd734
commit 0dd106c5f0
2 changed files with 16 additions and 16 deletions

View File

@ -74,7 +74,7 @@ static TCGv env_pc;
/* This is the state at translation time. */ /* This is the state at translation time. */
typedef struct DisasContext { typedef struct DisasContext {
CPUCRISState *env; CRISCPU *cpu;
target_ulong pc, ppc; target_ulong pc, ppc;
/* Decoder. */ /* Decoder. */
@ -129,7 +129,7 @@ static void gen_BUG(DisasContext *dc, const char *file, int line)
{ {
printf("BUG: pc=%x %s %d\n", dc->pc, file, line); printf("BUG: pc=%x %s %d\n", dc->pc, file, line);
qemu_log("BUG: pc=%x %s %d\n", dc->pc, file, line); qemu_log("BUG: pc=%x %s %d\n", dc->pc, file, line);
cpu_abort(CPU(cris_env_get_cpu(dc->env)), "%s:%d\n", file, line); cpu_abort(CPU(dc->cpu), "%s:%d\n", file, line);
} }
static const char *regnames[] = static const char *regnames[] =
@ -272,7 +272,7 @@ static int cris_fetch(CPUCRISState *env, DisasContext *dc, uint32_t addr,
break; break;
} }
default: default:
cpu_abort(CPU(cris_env_get_cpu(dc->env)), "Invalid fetch size %d\n", size); cpu_abort(CPU(dc->cpu), "Invalid fetch size %d\n", size);
break; break;
} }
return r; return r;
@ -1125,7 +1125,7 @@ static inline void cris_prepare_jmp (DisasContext *dc, unsigned int type)
static void gen_load64(DisasContext *dc, TCGv_i64 dst, TCGv addr) static void gen_load64(DisasContext *dc, TCGv_i64 dst, TCGv addr)
{ {
int mem_index = cpu_mmu_index(dc->env); int mem_index = cpu_mmu_index(&dc->cpu->env);
/* If we get a fault on a delayslot we must keep the jmp state in /* If we get a fault on a delayslot we must keep the jmp state in
the cpu-state to be able to re-execute the jmp. */ the cpu-state to be able to re-execute the jmp. */
@ -1139,7 +1139,7 @@ static void gen_load64(DisasContext *dc, TCGv_i64 dst, TCGv addr)
static void gen_load(DisasContext *dc, TCGv dst, TCGv addr, static void gen_load(DisasContext *dc, TCGv dst, TCGv addr,
unsigned int size, int sign) unsigned int size, int sign)
{ {
int mem_index = cpu_mmu_index(dc->env); int mem_index = cpu_mmu_index(&dc->cpu->env);
/* If we get a fault on a delayslot we must keep the jmp state in /* If we get a fault on a delayslot we must keep the jmp state in
the cpu-state to be able to re-execute the jmp. */ the cpu-state to be able to re-execute the jmp. */
@ -1154,7 +1154,7 @@ static void gen_load(DisasContext *dc, TCGv dst, TCGv addr,
static void gen_store (DisasContext *dc, TCGv addr, TCGv val, static void gen_store (DisasContext *dc, TCGv addr, TCGv val,
unsigned int size) unsigned int size)
{ {
int mem_index = cpu_mmu_index(dc->env); int mem_index = cpu_mmu_index(&dc->cpu->env);
/* If we get a fault on a delayslot we must keep the jmp state in /* If we get a fault on a delayslot we must keep the jmp state in
the cpu-state to be able to re-execute the jmp. */ the cpu-state to be able to re-execute the jmp. */
@ -3170,7 +3170,7 @@ gen_intermediate_code_internal(CRISCPU *cpu, TranslationBlock *tb,
* delayslot, like in real hw. * delayslot, like in real hw.
*/ */
pc_start = tb->pc & ~1; pc_start = tb->pc & ~1;
dc->env = env; dc->cpu = cpu;
dc->tb = tb; dc->tb = tb;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;
@ -3391,7 +3391,7 @@ gen_intermediate_code_internal(CRISCPU *cpu, TranslationBlock *tb,
#if !DISAS_CRIS #if !DISAS_CRIS
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
log_target_disas(env, pc_start, dc->pc - pc_start, log_target_disas(env, pc_start, dc->pc - pc_start,
dc->env->pregs[PR_VR]); env->pregs[PR_VR]);
qemu_log("\nisize=%d osize=%td\n", qemu_log("\nisize=%d osize=%td\n",
dc->pc - pc_start, tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf); dc->pc - pc_start, tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf);
} }

View File

@ -96,7 +96,7 @@ static void gen_store_v10_conditional(DisasContext *dc, TCGv addr, TCGv val,
static void gen_store_v10(DisasContext *dc, TCGv addr, TCGv val, static void gen_store_v10(DisasContext *dc, TCGv addr, TCGv val,
unsigned int size) unsigned int size)
{ {
int mem_index = cpu_mmu_index(dc->env); int mem_index = cpu_mmu_index(&dc->cpu->env);
/* If we get a fault on a delayslot we must keep the jmp state in /* If we get a fault on a delayslot we must keep the jmp state in
the cpu-state to be able to re-execute the jmp. */ the cpu-state to be able to re-execute the jmp. */
@ -340,7 +340,7 @@ static unsigned int dec10_quick_imm(DisasContext *dc)
default: default:
LOG_DIS("pc=%x mode=%x quickimm %d r%d r%d\n", LOG_DIS("pc=%x mode=%x quickimm %d r%d r%d\n",
dc->pc, dc->mode, dc->opcode, dc->src, dc->dst); dc->pc, dc->mode, dc->opcode, dc->src, dc->dst);
cpu_abort(CPU(cris_env_get_cpu(dc->env)), "Unhandled quickimm\n"); cpu_abort(CPU(dc->cpu), "Unhandled quickimm\n");
break; break;
} }
return 2; return 2;
@ -651,7 +651,7 @@ static unsigned int dec10_reg(DisasContext *dc)
case 2: tmp = 1; break; case 2: tmp = 1; break;
case 1: tmp = 0; break; case 1: tmp = 0; break;
default: default:
cpu_abort(CPU(cris_env_get_cpu(dc->env)), "Unhandled BIAP"); cpu_abort(CPU(dc->cpu), "Unhandled BIAP");
break; break;
} }
@ -669,7 +669,7 @@ static unsigned int dec10_reg(DisasContext *dc)
default: default:
LOG_DIS("pc=%x reg %d r%d r%d\n", dc->pc, LOG_DIS("pc=%x reg %d r%d r%d\n", dc->pc,
dc->opcode, dc->src, dc->dst); dc->opcode, dc->src, dc->dst);
cpu_abort(CPU(cris_env_get_cpu(dc->env)), "Unhandled opcode"); cpu_abort(CPU(dc->cpu), "Unhandled opcode");
break; break;
} }
} else { } else {
@ -745,7 +745,7 @@ static unsigned int dec10_reg(DisasContext *dc)
default: default:
LOG_DIS("pc=%x reg %d r%d r%d\n", dc->pc, LOG_DIS("pc=%x reg %d r%d r%d\n", dc->pc,
dc->opcode, dc->src, dc->dst); dc->opcode, dc->src, dc->dst);
cpu_abort(CPU(cris_env_get_cpu(dc->env)), "Unhandled opcode"); cpu_abort(CPU(dc->cpu), "Unhandled opcode");
break; break;
} }
} }
@ -1006,7 +1006,7 @@ static int dec10_bdap_m(CPUCRISState *env, DisasContext *dc, int size)
if (!dc->postinc && (dc->ir & (1 << 11))) { if (!dc->postinc && (dc->ir & (1 << 11))) {
int simm = dc->ir & 0xff; int simm = dc->ir & 0xff;
/* cpu_abort(dc->env, "Unhandled opcode"); */ /* cpu_abort(CPU(dc->cpu), "Unhandled opcode"); */
/* sign extended. */ /* sign extended. */
simm = (int8_t)simm; simm = (int8_t)simm;
@ -1105,7 +1105,7 @@ static unsigned int dec10_ind(CPUCRISState *env, DisasContext *dc)
default: default:
LOG_DIS("pc=%x var-ind.%d %d r%d r%d\n", LOG_DIS("pc=%x var-ind.%d %d r%d r%d\n",
dc->pc, size, dc->opcode, dc->src, dc->dst); dc->pc, size, dc->opcode, dc->src, dc->dst);
cpu_abort(CPU(cris_env_get_cpu(dc->env)), "Unhandled opcode"); cpu_abort(CPU(dc->cpu), "Unhandled opcode");
break; break;
} }
return insn_len; return insn_len;
@ -1198,7 +1198,7 @@ static unsigned int dec10_ind(CPUCRISState *env, DisasContext *dc)
break; break;
default: default:
LOG_DIS("ERROR pc=%x opcode=%d\n", dc->pc, dc->opcode); LOG_DIS("ERROR pc=%x opcode=%d\n", dc->pc, dc->opcode);
cpu_abort(CPU(cris_env_get_cpu(dc->env)), "Unhandled opcode"); cpu_abort(CPU(dc->cpu), "Unhandled opcode");
break; break;
} }