[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v14 04/22] cpu: Move synchronize_from_tb() to tcg_ops
From: |
Richard Henderson |
Subject: |
Re: [PATCH v14 04/22] cpu: Move synchronize_from_tb() to tcg_ops |
Date: |
Thu, 28 Jan 2021 13:01:47 -1000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 1/28/21 8:58 AM, Alex Bennée wrote:
> Looking at the function here I wonder if we should be worried about the
> thumb state? Peter?
>
> static void arm_cpu_set_pc(CPUState *cs, vaddr value)
> {
> ARMCPU *cpu = ARM_CPU(cs);
> CPUARMState *env = &cpu->env;
>
> if (is_a64(env)) {
> env->pc = value;
> env->thumb = 0;
> } else {
> env->regs[15] = value & ~1;
> env->thumb = value & 1;
> }
> }
Plausible. You could possibly test this via gdbstub, as there are not many
other users. I think it would be of the form:
(gdb) call foo()
where foo is a thumb function.
> #ifdef CONFIG_TCG
> void arm_cpu_synchronize_from_tb(CPUState *cs,
> const TranslationBlock *tb)
> {
> ARMCPU *cpu = ARM_CPU(cs);
> CPUARMState *env = &cpu->env;
>
> /*
> * It's OK to look at env for the current mode here, because it's
> * never possible for an AArch64 TB to chain to an AArch32 TB.
> */
> if (is_a64(env)) {
> env->pc = tb->pc;
> } else {
> env->regs[15] = tb->pc;
> }
> }
> #endif /* CONFIG_TCG */
This function need only handle any state that is "deferred" across goto_tb.
This is almost always simply the pc, e.g.
if (use_goto_tb(s, dest)) {
tcg_gen_goto_tb(n);
gen_set_pc_im(s, dest);
tcg_gen_exit_tb(s->base.tb, n);
A few targets do a bit more than that, especially vs delayed branches, but ARM
does not.
But there should be no thumb state that ought to be updated here.
r~
- [PATCH v14 00/22] i386 cleanup PART 2, Claudio Fontana, 2021/01/28
- [PATCH v14 02/22] target/riscv: remove CONFIG_TCG, as it is always TCG, Claudio Fontana, 2021/01/28
- [PATCH v14 03/22] accel/tcg: split TCG-only code from cpu_exec_realizefn, Claudio Fontana, 2021/01/28
- [PATCH v14 04/22] cpu: Move synchronize_from_tb() to tcg_ops, Claudio Fontana, 2021/01/28
- [PATCH v14 06/22] cpu: Move tlb_fill to tcg_ops, Claudio Fontana, 2021/01/28
- [PATCH v14 05/22] cpu: Move cpu_exec_* to tcg_ops, Claudio Fontana, 2021/01/28
- [PATCH v14 07/22] cpu: Move debug_excp_handler to tcg_ops, Claudio Fontana, 2021/01/28
- [PATCH v14 08/22] target/arm: do not use cc->do_interrupt for KVM directly, Claudio Fontana, 2021/01/28
- [PATCH v14 01/22] cpu: Introduce TCGCpuOperations struct, Claudio Fontana, 2021/01/28
- [PATCH v14 10/22] cpu: move cc->transaction_failed to tcg_ops, Claudio Fontana, 2021/01/28
- [PATCH v14 12/22] physmem: make watchpoint checking code TCG-only, Claudio Fontana, 2021/01/28
- [PATCH v14 11/22] cpu: move do_unaligned_access to tcg_ops, Claudio Fontana, 2021/01/28
- [PATCH v14 14/22] cpu: move debug_check_watchpoint to tcg_ops, Claudio Fontana, 2021/01/28