* [Qemu-devel] [PATCH] qemu-system-hppa: Raise exception 26 on emulated hardware
@ 2018-10-07 20:51 Helge Deller
2018-10-08 21:50 ` Richard Henderson
0 siblings, 1 reply; 2+ messages in thread
From: Helge Deller @ 2018-10-07 20:51 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson
On PCXS chips (PA7000, pa 1.1a), trap #18 is raised on memory faults,
while all later chips (>= PA7100) generate either trap #26, #27 or #28
(depending on the fault type).
Since the current qemu emulation emulates a B160L machine (with a
PA7300LC PCX-L2 chip, we should raise trap #26 (EXCP_DMAR) instead of
#18 (EXCP_DMP) on access faults by the Linux kernel to page zero.
With the patch we now get the correct output (I tested against real
hardware):
Kernel Fault: Code=26 (Data memory access rights trap) (Addr=00000004)
instead of:
Kernel Fault: Code=18 (Data memory protection/unaligned access trap) (Addr=00000004)
Signed-off-by: Helge Deller <deller@gmx.de>
diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c
index ab160c2a74..aecf3075f6 100644
--- a/target/hppa/mem_helper.c
+++ b/target/hppa/mem_helper.c
@@ -137,7 +137,8 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx,
if (unlikely(!(prot & type))) {
/* The access isn't allowed -- Inst/Data Memory Protection Fault. */
- ret = (type & PAGE_EXEC ? EXCP_IMP : EXCP_DMP);
+ ret = (type & PAGE_EXEC ? EXCP_IMP :
+ prot & PAGE_READ ? EXCP_DMP : EXCP_DMAR);
goto egress;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu-system-hppa: Raise exception 26 on emulated hardware
2018-10-07 20:51 [Qemu-devel] [PATCH] qemu-system-hppa: Raise exception 26 on emulated hardware Helge Deller
@ 2018-10-08 21:50 ` Richard Henderson
0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2018-10-08 21:50 UTC (permalink / raw)
To: Helge Deller, qemu-devel; +Cc: Richard Henderson
On 10/7/18 1:51 PM, Helge Deller wrote:
> On PCXS chips (PA7000, pa 1.1a), trap #18 is raised on memory faults,
> while all later chips (>= PA7100) generate either trap #26, #27 or #28
> (depending on the fault type).
>
> Since the current qemu emulation emulates a B160L machine (with a
> PA7300LC PCX-L2 chip, we should raise trap #26 (EXCP_DMAR) instead of
> #18 (EXCP_DMP) on access faults by the Linux kernel to page zero.
>
> With the patch we now get the correct output (I tested against real
> hardware):
> Kernel Fault: Code=26 (Data memory access rights trap) (Addr=00000004)
> instead of:
> Kernel Fault: Code=18 (Data memory protection/unaligned access trap) (Addr=00000004)
>
> Signed-off-by: Helge Deller <deller@gmx.de>
Queued, thanks.
r~
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-08 21:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-07 20:51 [Qemu-devel] [PATCH] qemu-system-hppa: Raise exception 26 on emulated hardware Helge Deller
2018-10-08 21:50 ` Richard Henderson
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).