• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révision2c023d3675a3ffb54fc30504dcd715bc6f6e234f (tree)
l'heure2022-01-28 23:30:36
AuteurPeter Maydell <peter.maydell@lina...>
CommiterPeter Maydell

Message de Log

target/arm: Use correct entrypoint for SVC taken from Hyp to Hyp

The exception caused by an SVC instruction may be taken to AArch32
Hyp mode for two reasons:

  • HCR.TGE indicates that exceptions from EL0 should trap to EL2
  • we were already in Hyp mode

The entrypoint in the vector table to be used differs in these two
cases: for an exception routed to Hyp mode from EL0, we enter at the
common 0x14 "hyp trap" entrypoint. For SVC from Hyp mode to Hyp
mode, we enter at the 0x08 (svc/hvc trap) entrypoint.
In the v8A Arm ARM pseudocode this is done in AArch32.TakeSVCException.

QEMU incorrectly routed both of these exceptions to the 0x14
entrypoint. Correct the entrypoint for SVC from Hyp to Hyp by making
use of the existing logic which handles "normal entrypoint for
Hyp-to-Hyp, otherwise 0x14" for traps like UNDEF and data/prefetch
aborts (reproduced here since it's outside the visible context
in the diff for this commit):

if (arm_current_el(env) != 2 && addr < 0x14) {
addr = 0x14;
}

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220117131953.3936137-1-peter.maydell@linaro.org

Change Summary

Modification

--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -9658,7 +9658,7 @@ static void arm_cpu_do_interrupt_aarch32_hyp(CPUState *cs)
96589658 * separately here.
96599659 *
96609660 * The vector table entry used is always the 0x14 Hyp mode entry point,
9661- * unless this is an UNDEF/HVC/abort taken from Hyp to Hyp.
9661+ * unless this is an UNDEF/SVC/HVC/abort taken from Hyp to Hyp.
96629662 * The offset applied to the preferred return address is always zero
96639663 * (see DDI0487C.a section G1.12.3).
96649664 * PSTATE A/I/F masks are set based only on the SCR.EA/IRQ/FIQ values.
@@ -9672,7 +9672,7 @@ static void arm_cpu_do_interrupt_aarch32_hyp(CPUState *cs)
96729672 addr = 0x04;
96739673 break;
96749674 case EXCP_SWI:
9675- addr = 0x14;
9675+ addr = 0x08;
96769676 break;
96779677 case EXCP_BKPT:
96789678 /* Fall through to prefetch abort. */