qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH-for-9.1] target/mips: Fix execution mode in page_table_walk_r


From: Richard Henderson
Subject: Re: [PATCH-for-9.1] target/mips: Fix execution mode in page_table_walk_refill()
Date: Mon, 12 Aug 2024 10:48:03 +1000
User-agent: Mozilla Thunderbird

On 8/12/24 02:54, Philippe Mathieu-Daudé wrote:
When refactoring page_table_walk_refill() in commit 4e999bf419
we replaced the execution mode and forced it to kernel mode.
Restore the previous behavior to also get supervisor / user modes.

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Reported-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2470
Fixes: 4e999bf419 ("target/mips: Pass ptw_mmu_idx down from mips_cpu_tlb_fill")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
  target/mips/tcg/sysemu/tlb_helper.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/target/mips/tcg/sysemu/tlb_helper.c 
b/target/mips/tcg/sysemu/tlb_helper.c
index 3ba6d369a6..e7ae4f0bef 100644
--- a/target/mips/tcg/sysemu/tlb_helper.c
+++ b/target/mips/tcg/sysemu/tlb_helper.c
@@ -940,8 +940,9 @@ bool mips_cpu_tlb_fill(CPUState *cs, vaddr address, int 
size,
           * Memory reads during hardware page table walking are performed
           * as if they were kernel-mode load instructions.
           */
-        int ptw_mmu_idx = (env->hflags & MIPS_HFLAG_ERL ?
-                           MMU_ERL_IDX : MMU_KERNEL_IDX);
+        int ptw_mmu_idx = (env->hflags & MIPS_HFLAG_ERL)
+                          ? MMU_ERL_IDX
+                          : (env->hflags & MIPS_HFLAG_KSU);

This contradicts the comment above.
If this code change is correct, then the comment isn't.

But the comment certainly makes sense -- page tables are never accessible to 
user mode.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]