Skip to content

Commit

Permalink
target/hppa: Raise exception 26 on emulated hardware
Browse files Browse the repository at this point in the history
On PCXS chips (PA7000, pa 1.1a), trap qemu#18 is raised on memory faults,
while all later chips (>= PA7100) generate either trap qemu#26, qemu#27 or qemu#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 qemu#26 (EXCP_DMAR) instead
of qemu#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)
instead of:
 Kernel Fault: Code=18 (Data memory protection/unaligned access trap)

Signed-off-by: Helge Deller <deller@gmx.de>
Message-Id: <20181007205153.GA30270@ls3530.fritz.box>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
hdeller authored and rth7680 committed Oct 16, 2018
1 parent 0955837 commit 5f538f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion target/hppa/mem_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 5f538f7

Please sign in to comment.