target/arm: Take an exception if PC is misaligned
commitee03027a2cef00f977a3d28242c0a250b8552495
authorRichard Henderson <richard.henderson@linaro.org>
Wed, 3 Nov 2021 04:03:49 +0000 (3 00:03 -0400)
committerPeter Maydell <peter.maydell@linaro.org>
Wed, 15 Dec 2021 10:35:26 +0000 (15 10:35 +0000)
tree42e74225bdb97be6a66025ec7a5b6eb519ef34ba
parent936a6b86030a0db172b09a1ea953091a1555611e
target/arm: Take an exception if PC is misaligned

For A64, any input to an indirect branch can cause this.

For A32, many indirect branch paths force the branch to be aligned,
but BXWritePC does not.  This includes the BX instruction but also
other interworking changes to PC.  Prior to v8, this case is UNDEFINED.
With v8, this is CONSTRAINED UNPREDICTABLE and may either raise an
exception or force align the PC.

We choose to raise an exception because we have the infrastructure,
it makes the generated code for gen_bx simpler, and it has the
possibility of catching more guest bugs.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
linux-user/aarch64/cpu_loop.c
target/arm/helper.h
target/arm/syndrome.h
target/arm/tlb_helper.c
target/arm/translate-a64.c
target/arm/translate.c