[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.2.2 07/60] target/arm: fix exception syndrome for AArch32 bkpt
From: |
Michael Tokarev |
Subject: |
[Stable-8.2.2 07/60] target/arm: fix exception syndrome for AArch32 bkpt insn |
Date: |
Wed, 21 Feb 2024 11:19:55 +0300 |
From: Jan Klötzke <jan.kloetzke@kernkonzept.com>
Debug exceptions that target AArch32 Hyp mode are reported differently
than on AAarch64. Internally, Qemu uses the AArch64 syndromes. Therefore
such exceptions need to be either converted to a prefetch abort
(breakpoints, vector catch) or a data abort (watchpoints).
Cc: qemu-stable@nongnu.org
Signed-off-by: Jan Klötzke <jan.kloetzke@kernkonzept.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20240127202758.3326381-1-jan.kloetzke@kernkonzept.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit f670be1aad33e801779af580398895b9455747ee)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 2746d3fdac..6515c5e89c 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -10823,6 +10823,24 @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs)
}
if (env->exception.target_el == 2) {
+ /* Debug exceptions are reported differently on AArch32 */
+ switch (syn_get_ec(env->exception.syndrome)) {
+ case EC_BREAKPOINT:
+ case EC_BREAKPOINT_SAME_EL:
+ case EC_AA32_BKPT:
+ case EC_VECTORCATCH:
+ env->exception.syndrome = syn_insn_abort(arm_current_el(env) == 2,
+ 0, 0, 0x22);
+ break;
+ case EC_WATCHPOINT:
+ env->exception.syndrome = syn_set_ec(env->exception.syndrome,
+ EC_DATAABORT);
+ break;
+ case EC_WATCHPOINT_SAME_EL:
+ env->exception.syndrome = syn_set_ec(env->exception.syndrome,
+ EC_DATAABORT_SAME_EL);
+ break;
+ }
arm_cpu_do_interrupt_aarch32_hyp(cs);
return;
}
diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h
index 95454b5b3b..eccb759da6 100644
--- a/target/arm/syndrome.h
+++ b/target/arm/syndrome.h
@@ -25,6 +25,8 @@
#ifndef TARGET_ARM_SYNDROME_H
#define TARGET_ARM_SYNDROME_H
+#include "qemu/bitops.h"
+
/* Valid Syndrome Register EC field values */
enum arm_exception_class {
EC_UNCATEGORIZED = 0x00,
@@ -80,6 +82,7 @@ typedef enum {
SME_ET_InactiveZA,
} SMEExceptionType;
+#define ARM_EL_EC_LENGTH 6
#define ARM_EL_EC_SHIFT 26
#define ARM_EL_IL_SHIFT 25
#define ARM_EL_ISV_SHIFT 24
@@ -91,6 +94,11 @@ static inline uint32_t syn_get_ec(uint32_t syn)
return syn >> ARM_EL_EC_SHIFT;
}
+static inline uint32_t syn_set_ec(uint32_t syn, uint32_t ec)
+{
+ return deposit32(syn, ARM_EL_EC_SHIFT, ARM_EL_EC_LENGTH, ec);
+}
+
/*
* Utility functions for constructing various kinds of syndrome value.
* Note that in general we follow the AArch64 syndrome values; in a
--
2.39.2
- [Stable-8.2.2 v0 00/60] Patch Round-up for stable 8.2.2, freeze on 2024-03-02, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 01/60] migration: Plug memory leak on HMP migrate error path, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 02/60] migration: Fix use-after-free of migration state object, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 04/60] Make 'uri' optional for migrate QAPI, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 05/60] qemu-docs: Update options for graphical frontends, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 07/60] target/arm: fix exception syndrome for AArch32 bkpt insn,
Michael Tokarev <=
- [Stable-8.2.2 03/60] vfio/pci: Clear MSI-X IRQ index always, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 06/60] block/blkio: Make s->mem_region_alignment be 64 bits, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 09/60] qemu-options.hx: Improve -serial option documentation, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 08/60] system/vl.c: Fix handling of '-serial none -serial something', Michael Tokarev, 2024/02/21
- [Stable-8.2.2 11/60] pci-host: designware: Limit value range of iATU viewport register, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 12/60] tcg/loongarch64: Set vector registers call clobbered, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 13/60] linux-user/aarch64: Add padding before __kernel_rt_sigreturn, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 14/60] hw/scsi/lsi53c895a: add missing decrement of reentrancy counter, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 10/60] target/arm: Reinstate "vfp" property on AArch32 CPUs, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 16/60] iotests: give tempdir an identifying name, Michael Tokarev, 2024/02/21