Skip to content

Commit

Permalink
target/riscv: Use cpu_loop_exit_restore directly from mmu faults
Browse files Browse the repository at this point in the history
The riscv_raise_exception function stores its argument into
exception_index and then exits to the main loop.  When we
have already set exception_index, we can just exit directly.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20220401125948.79292-2-richard.henderson@linaro.org>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
  • Loading branch information
rth7680 authored and alistair23 committed Apr 22, 2022
1 parent f06193c commit ac68471
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions target/riscv/cpu_helper.c
Expand Up @@ -1150,7 +1150,7 @@ void riscv_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
env->badaddr = addr;
env->two_stage_lookup = riscv_cpu_virt_enabled(env) ||
riscv_cpu_two_stage_lookup(mmu_idx);
riscv_raise_exception(&cpu->env, cs->exception_index, retaddr);
cpu_loop_exit_restore(cs, retaddr);
}

void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
Expand All @@ -1175,7 +1175,7 @@ void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
env->badaddr = addr;
env->two_stage_lookup = riscv_cpu_virt_enabled(env) ||
riscv_cpu_two_stage_lookup(mmu_idx);
riscv_raise_exception(env, cs->exception_index, retaddr);
cpu_loop_exit_restore(cs, retaddr);
}

bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
Expand Down Expand Up @@ -1311,7 +1311,7 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
first_stage_error,
riscv_cpu_virt_enabled(env) ||
riscv_cpu_two_stage_lookup(mmu_idx));
riscv_raise_exception(env, cs->exception_index, retaddr);
cpu_loop_exit_restore(cs, retaddr);
}

return true;
Expand Down

0 comments on commit ac68471

Please sign in to comment.