qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* ARM: ptw.c:S1_ptw_translate
@ 2023-01-04 16:55 Sid Manning
  2023-01-04 18:35 ` Philippe Mathieu-Daudé
  2023-01-05  5:41 ` Richard Henderson
  0 siblings, 2 replies; 8+ messages in thread
From: Sid Manning @ 2023-01-04 16:55 UTC (permalink / raw)
  To: qemu-devel@nongnu.org; +Cc: philmd@linaro.org, Mark Burton

[-- Attachment #1: Type: text/plain, Size: 1453 bytes --]

ptw.c:S1_ptw_translate

After migrating to v7.2.0, an issue was found where we were not getting the correct virtual address from a load insn.  Reading the address used in the load insn from the debugger resulted in the execution of the insn getting the correct value but simply stepping over the insn did not.

This is the instruction:
ldr           x0, [x1, #24]

The debug path varies based on the regime and if regime is NOT stage two out_phys is set to addr if the regime is stage 2 then out_phys is set to s2.f.phys_addr.  In the non-debug path out_phys is always set to full->phys_addr.

I got around this by only using full->phys_addr if regime_is_stage2 was true:

diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index 3745ac9723..87bc6754a6 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -266,7 +266,12 @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
         if (unlikely(flags & TLB_INVALID_MASK)) {
             goto fail;
         }
-        ptw->out_phys = full->phys_addr;
+
+        if (regime_is_stage2(s2_mmu_idx)) {
+            ptw->out_phys = full->phys_addr;
+        } else {
+            ptw->out_phys = addr;
+        }
         ptw->out_rw = full->prot & PAGE_WRITE;
         pte_attrs = full->pte_attrs;
         pte_secure = full->attrs.secure;

This change got me the answer I wanted but I'm not familiar enough with the code to know if this is correct or not.


[-- Attachment #2: Type: text/html, Size: 5930 bytes --]

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

end of thread, other threads:[~2023-01-26 22:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-04 16:55 ARM: ptw.c:S1_ptw_translate Sid Manning
2023-01-04 18:35 ` Philippe Mathieu-Daudé
2023-01-05  5:41 ` Richard Henderson
2023-01-06  1:08   ` Sid Manning
2023-01-25 23:27     ` Sid Manning
2023-01-26  3:09       ` Richard Henderson
2023-01-26 21:47       ` Richard Henderson
2023-01-26 22:27         ` Sid Manning

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).