qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] target/arm: Load correct half of 64-bit fields
@ 2023-04-24 15:39 Peter Maydell
  2023-04-24 15:39 ` [PATCH 1/2] target/arm: Define and use new load_cpu_field_low32() Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Peter Maydell @ 2023-04-24 15:39 UTC (permalink / raw)
  To: qemu-arm, qemu-devel; +Cc: qemu-stable

This patchset fixes a bug where on a big-endian 64-bit host the
guest would crash immediately when it did an ERET. This happens
because when we load the new PC value from CPUARMState::esr_el[2]
we do a 32-bit load even though the struct field is 64 bits.
So on 64-bit BE we use the wrong half of the register.

Patch 1 defines a new macro to load the low 32 bits from a
64-bit field, and uses it in the two places where we got this
wrong. Patch 2 adds some compile-time assertions to the
existing load_cpu_field() and store_cpu_field() macros that
catch inadvertent uses on struct fields of the wrong size.

This fix is necessary to be able to run the avocado tests for
the orangepi on a 64-bit BE system.

thanks
-- PMM

Peter Maydell (2):
  target/arm: Define and use new load_cpu_field_low32()
  target/arm: Add compile time asserts to load/store_cpu_field macros

 target/arm/translate-a32.h | 24 ++++++++++++++++++++----
 target/arm/tcg/translate.c |  4 ++--
 2 files changed, 22 insertions(+), 6 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-05-02 10:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-24 15:39 [PATCH 0/2] target/arm: Load correct half of 64-bit fields Peter Maydell
2023-04-24 15:39 ` [PATCH 1/2] target/arm: Define and use new load_cpu_field_low32() Peter Maydell
2023-04-24 16:14   ` Richard Henderson
2023-04-24 15:39 ` [PATCH 2/2] target/arm: Add compile time asserts to load/store_cpu_field macros Peter Maydell
2023-04-24 16:14   ` Richard Henderson
2023-05-02 10:33 ` [PATCH 0/2] target/arm: Load correct half of 64-bit fields Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).