[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.1.3 58/59] target/arm: HVC at EL3 should go to EL3, not EL2
From: |
Michael Tokarev |
Subject: |
[Stable-8.1.3 58/59] target/arm: HVC at EL3 should go to EL3, not EL2 |
Date: |
Sun, 19 Nov 2023 21:19:54 +0300 |
From: Peter Maydell <peter.maydell@linaro.org>
AArch64 permits code at EL3 to use the HVC instruction; however the
exception we take should go to EL3, not down to EL2 (see the pseudocode
AArch64.CallHypervisor()). Fix the target EL.
Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar@zeroasic.com>
Message-id: 20231109151917.1925107-1-peter.maydell@linaro.org
(cherry picked from commit fc58891d0422607d172a3d6b3158798f2556aef1)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
index 58787ee8a7..7267f172d7 100644
--- a/target/arm/tcg/translate-a64.c
+++ b/target/arm/tcg/translate-a64.c
@@ -2355,6 +2355,8 @@ static bool trans_SVC(DisasContext *s, arg_i *a)
static bool trans_HVC(DisasContext *s, arg_i *a)
{
+ int target_el = s->current_el == 3 ? 3 : 2;
+
if (s->current_el == 0) {
unallocated_encoding(s);
return true;
@@ -2367,7 +2369,7 @@ static bool trans_HVC(DisasContext *s, arg_i *a)
gen_helper_pre_hvc(cpu_env);
/* Architecture requires ss advance before we do the actual work */
gen_ss_advance(s);
- gen_exception_insn_el(s, 4, EXCP_HVC, syn_aa64_hvc(a->imm), 2);
+ gen_exception_insn_el(s, 4, EXCP_HVC, syn_aa64_hvc(a->imm), target_el);
return true;
}
--
2.39.2
- [Stable-8.1.3 v2 00/59] Patch Round-up for stable 8.1.3, frozen on 2023-11-19, Michael Tokarev, 2023/11/19
- [Stable-8.1.3 54/59] tracetool: avoid invalid escape in Python string, Michael Tokarev, 2023/11/19
- [Stable-8.1.3 55/59] target/riscv/kvm: improve 'init_multiext_cfg' error msg, Michael Tokarev, 2023/11/19
- [Stable-8.1.3 56/59] target/riscv/kvm: support KVM_GET_REG_LIST, Michael Tokarev, 2023/11/19
- [Stable-8.1.3 58/59] target/arm: HVC at EL3 should go to EL3, not EL2,
Michael Tokarev <=
- [Stable-8.1.3 57/59] s390x/pci: only limit DMA aperture if vfio DMA limit reported, Michael Tokarev, 2023/11/19
- [Stable-8.1.3 59/59] hw/mips: LOONGSON3V depends on UNIMP device, Michael Tokarev, 2023/11/19
- Re: [Stable-8.1.3 v2 00/59] Patch Round-up for stable 8.1.3, frozen on 2023-11-19, Thomas Huth, 2023/11/20