semihosting: Split out common_semi_has_synccache
We already have some larger ifdef blocks for ARM and RISCV; split out a boolean test for SYS_SYNCCACHE. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
3c820ddc1b
commit
a1df4bab43
@ -224,6 +224,12 @@ static inline target_ulong common_semi_stack_bottom(CPUState *cs)
|
|||||||
CPUARMState *env = &cpu->env;
|
CPUARMState *env = &cpu->env;
|
||||||
return is_a64(env) ? env->xregs[31] : env->regs[13];
|
return is_a64(env) ? env->xregs[31] : env->regs[13];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool common_semi_has_synccache(CPUArchState *env)
|
||||||
|
{
|
||||||
|
/* Ok for A64, invalid for A32/T32. */
|
||||||
|
return is_a64(env);
|
||||||
|
}
|
||||||
#endif /* TARGET_ARM */
|
#endif /* TARGET_ARM */
|
||||||
|
|
||||||
#ifdef TARGET_RISCV
|
#ifdef TARGET_RISCV
|
||||||
@ -260,6 +266,11 @@ static inline target_ulong common_semi_stack_bottom(CPUState *cs)
|
|||||||
CPURISCVState *env = &cpu->env;
|
CPURISCVState *env = &cpu->env;
|
||||||
return env->gpr[xSP];
|
return env->gpr[xSP];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool common_semi_has_synccache(CPUArchState *env)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1102,16 +1113,11 @@ void do_common_semihosting(CPUState *cs)
|
|||||||
* virtual address range. This is a nop for us since we don't
|
* virtual address range. This is a nop for us since we don't
|
||||||
* implement caches. This is only present on A64.
|
* implement caches. This is only present on A64.
|
||||||
*/
|
*/
|
||||||
#ifdef TARGET_ARM
|
if (common_semi_has_synccache(env)) {
|
||||||
if (is_a64(cs->env_ptr)) {
|
|
||||||
common_semi_set_ret(cs, 0);
|
common_semi_set_ret(cs, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
/* fall through */
|
||||||
#ifdef TARGET_RISCV
|
|
||||||
common_semi_set_ret(cs, 0);
|
|
||||||
#endif
|
|
||||||
/* fall through -- invalid for A32/T32 */
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr);
|
fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr);
|
||||||
cpu_dump_state(cs, stderr, 0);
|
cpu_dump_state(cs, stderr, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user