[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 6/8] target/arm: Assert thumb pc is aligned
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v2 6/8] target/arm: Assert thumb pc is aligned |
Date: |
Sat, 21 Aug 2021 22:46:29 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
On 8/21/21 9:59 PM, Richard Henderson wrote:
> Misaligned thumb PC is architecturally impossible.
> Assert is better than proceeding, in case we've missed
> something somewhere.
>
> Expand a comment about aligning the pc in gdbstub.
> Fail an incoming migrate if a thumb pc is misaligned.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> target/arm/gdbstub.c | 9 +++++++--
> target/arm/machine.c | 9 +++++++++
> target/arm/translate.c | 3 +++
> 3 files changed, 19 insertions(+), 2 deletions(-)
> diff --git a/target/arm/translate.c b/target/arm/translate.c
> index dfeaa2321d..a93ea3c47c 100644
> --- a/target/arm/translate.c
> +++ b/target/arm/translate.c
> @@ -9595,6 +9595,9 @@ static void thumb_tr_translate_insn(DisasContextBase
> *dcbase, CPUState *cpu)
> uint32_t insn;
> bool is_16bit;
>
> + /* Misaligned thumb PC is architecturally impossible. */
> + assert((dc->base.pc_next & 1) == 0);
What about using tcg_debug_assert() instead?
> if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) {
> dc->base.pc_next += 2;
> return;
>
- [PATCH v2 1/8] target/arm: Take an exception if PSTATE.IL is set, (continued)
- [PATCH v2 1/8] target/arm: Take an exception if PSTATE.IL is set, Richard Henderson, 2021/08/21
- [PATCH v2 2/8] target/arm: Merge disas_a64_insn into aarch64_tr_translate_insn, Richard Henderson, 2021/08/21
- [PATCH v2 4/8] linux-user/arm: Report SIGBUS and SIGSEGV correctly, Richard Henderson, 2021/08/21
- [PATCH v2 3/8] linux-user/aarch64: Handle EC_PCALIGNMENT, Richard Henderson, 2021/08/21
- [PATCH v2 5/8] target/arm: Take an exception if PC is misaligned, Richard Henderson, 2021/08/21
- [PATCH v2 7/8] target/arm: Suppress bp for exceptions with more priority, Richard Henderson, 2021/08/21
- [PATCH v2 6/8] target/arm: Assert thumb pc is aligned, Richard Henderson, 2021/08/21
- [PATCH v2 8/8] tests/tcg: Add arm and aarch64 pc alignment tests, Richard Henderson, 2021/08/21