aboutsummaryrefslogtreecommitdiff
path: root/target/m68k/helper.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2019-03-22 18:23:25 -0700
committerRichard Henderson <richard.henderson@linaro.org>2019-06-10 07:03:42 -0700
commita8d92fd869c601f723b82d9736a2d78ae640b8a2 (patch)
treeb86e711609bc21c0e208faa9226be473122f078d /target/m68k/helper.c
parent6dd40a906d83b642224443f8b60aa96659945ca3 (diff)
target/m68k: Use env_cpu
Cleanup in the boilerplate that each target must define. The combination CPU(m68k_env_get_cpu) should have used ENV_GET_CPU to begin; use env_cpu now. Acked-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/m68k/helper.c')
-rw-r--r--target/m68k/helper.c33
1 files changed, 12 insertions, 21 deletions
diff --git a/target/m68k/helper.c b/target/m68k/helper.c
index 6db93bdd81..31aacb51c6 100644
--- a/target/m68k/helper.c
+++ b/target/m68k/helper.c
@@ -168,8 +168,6 @@ void m68k_cpu_init_gdb(M68kCPU *cpu)
void HELPER(cf_movec_to)(CPUM68KState *env, uint32_t reg, uint32_t val)
{
- M68kCPU *cpu = m68k_env_get_cpu(env);
-
switch (reg) {
case M68K_CR_CACR:
env->cacr = val;
@@ -186,7 +184,7 @@ void HELPER(cf_movec_to)(CPUM68KState *env, uint32_t reg, uint32_t val)
break;
/* TODO: Implement control registers. */
default:
- cpu_abort(CPU(cpu),
+ cpu_abort(env_cpu(env),
"Unimplemented control register write 0x%x = 0x%x\n",
reg, val);
}
@@ -194,8 +192,6 @@ void HELPER(cf_movec_to)(CPUM68KState *env, uint32_t reg, uint32_t val)
void HELPER(m68k_movec_to)(CPUM68KState *env, uint32_t reg, uint32_t val)
{
- M68kCPU *cpu = m68k_env_get_cpu(env);
-
switch (reg) {
/* MC680[1234]0 */
case M68K_CR_SFC:
@@ -248,14 +244,13 @@ void HELPER(m68k_movec_to)(CPUM68KState *env, uint32_t reg, uint32_t val)
env->mmu.ttr[M68K_DTTR1] = val;
return;
}
- cpu_abort(CPU(cpu), "Unimplemented control register write 0x%x = 0x%x\n",
+ cpu_abort(env_cpu(env),
+ "Unimplemented control register write 0x%x = 0x%x\n",
reg, val);
}
uint32_t HELPER(m68k_movec_from)(CPUM68KState *env, uint32_t reg)
{
- M68kCPU *cpu = m68k_env_get_cpu(env);
-
switch (reg) {
/* MC680[1234]0 */
case M68K_CR_SFC:
@@ -292,7 +287,7 @@ uint32_t HELPER(m68k_movec_from)(CPUM68KState *env, uint32_t reg)
case M68K_CR_DTT1:
return env->mmu.ttr[M68K_DTTR1];
}
- cpu_abort(CPU(cpu), "Unimplemented control register read 0x%x\n",
+ cpu_abort(env_cpu(env), "Unimplemented control register read 0x%x\n",
reg);
}
@@ -388,8 +383,7 @@ static void dump_address_map(CPUM68KState *env, uint32_t root_pointer)
uint32_t last_logical, last_physical;
int32_t size;
int last_attr = -1, attr = -1;
- M68kCPU *cpu = m68k_env_get_cpu(env);
- CPUState *cs = CPU(cpu);
+ CPUState *cs = env_cpu(env);
MemTxResult txres;
if (env->mmu.tcr & M68K_TCR_PAGE_8K) {
@@ -630,8 +624,7 @@ static int get_physical_address(CPUM68KState *env, hwaddr *physical,
int *prot, target_ulong address,
int access_type, target_ulong *page_size)
{
- M68kCPU *cpu = m68k_env_get_cpu(env);
- CPUState *cs = CPU(cpu);
+ CPUState *cs = env_cpu(env);
uint32_t entry;
uint32_t next;
target_ulong page_mask;
@@ -1175,7 +1168,7 @@ void HELPER(mac_set_flags)(CPUM68KState *env, uint32_t acc)
z = n; \
break; \
default: \
- cpu_abort(CPU(m68k_env_get_cpu(env)), "Bad CC_OP %d", op); \
+ cpu_abort(env_cpu(env), "Bad CC_OP %d", op); \
} \
} while (0)
@@ -1358,8 +1351,6 @@ void HELPER(set_mac_extu)(CPUM68KState *env, uint32_t val, uint32_t acc)
#if defined(CONFIG_SOFTMMU)
void HELPER(ptest)(CPUM68KState *env, uint32_t addr, uint32_t is_read)
{
- M68kCPU *cpu = m68k_env_get_cpu(env);
- CPUState *cs = CPU(cpu);
hwaddr physical;
int access_type;
int prot;
@@ -1384,7 +1375,7 @@ void HELPER(ptest)(CPUM68KState *env, uint32_t addr, uint32_t is_read)
if (ret == 0) {
addr &= TARGET_PAGE_MASK;
physical += addr & (page_size - 1);
- tlb_set_page(cs, addr, physical,
+ tlb_set_page(env_cpu(env), addr, physical,
prot, access_type & ACCESS_SUPER ?
MMU_KERNEL_IDX : MMU_USER_IDX, page_size);
}
@@ -1392,18 +1383,18 @@ void HELPER(ptest)(CPUM68KState *env, uint32_t addr, uint32_t is_read)
void HELPER(pflush)(CPUM68KState *env, uint32_t addr, uint32_t opmode)
{
- M68kCPU *cpu = m68k_env_get_cpu(env);
+ CPUState *cs = env_cpu(env);
switch (opmode) {
case 0: /* Flush page entry if not global */
case 1: /* Flush page entry */
- tlb_flush_page(CPU(cpu), addr);
+ tlb_flush_page(cs, addr);
break;
case 2: /* Flush all except global entries */
- tlb_flush(CPU(cpu));
+ tlb_flush(cs);
break;
case 3: /* Flush all entries */
- tlb_flush(CPU(cpu));
+ tlb_flush(cs);
break;
}
}