diff options
| author | Nicholas Piggin <npiggin@gmail.com> | 2024-12-19 13:40:34 +1000 |
|---|---|---|
| committer | Nicholas Piggin <npiggin@gmail.com> | 2025-03-11 22:43:32 +1000 |
| commit | b4aa82dc3a698abdcdef342fc1f4620f888c3cf7 (patch) | |
| tree | 0568d7ba1db1379a9cf366c4cfa2adb6deade887 | |
| parent | d8a624515a9773cb9d7afd47926bd64ae8fa0fc6 (diff) | |
| download | focaccia-qemu-b4aa82dc3a698abdcdef342fc1f4620f888c3cf7.tar.gz focaccia-qemu-b4aa82dc3a698abdcdef342fc1f4620f888c3cf7.zip | |
target/ppc: Avoid warning message for zero process table entries
A translation that encounters a process table entry that is zero is something that Linux does to cause certain kernel NULL pointer dereferences to fault. It is not itself a programming error, so avoid the guest error log. Message-ID: <20241219034035.1826173-5-npiggin@gmail.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Diffstat (limited to '')
| -rw-r--r-- | target/ppc/mmu-radix64.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c index 1d3d9e1be7..461eda4a3d 100644 --- a/target/ppc/mmu-radix64.c +++ b/target/ppc/mmu-radix64.c @@ -571,6 +571,20 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, prtbe0 = ldq_phys(cs->as, h_raddr); } + /* + * Some Linux uses a zero process table entry in PID!=0 for kernel context + * without userspace in order to fault on NULL dereference, because using + * PIDR=0 for the kernel causes the Q0 page table to be used to translate + * Q3 as well. Check for that case here to avoid the invalid configuration + * message. + */ + if (unlikely(!prtbe0)) { + if (guest_visible) { + ppc_radix64_raise_si(cpu, access_type, eaddr, DSISR_R_BADCONFIG); + } + return 1; + } + /* Walk Radix Tree from Process Table Entry to Convert EA to RA */ *g_page_size = PRTBE_R_GET_RTS(prtbe0); base_addr = prtbe0 & PRTBE_R_RPDB; |