diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2014-10-23 16:57:46 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2014-10-23 16:57:46 +0000 |
commit | 28327d75989c7583121f2d1b47e17ced5a87c098 (patch) | |
tree | 1d51455aa965b471393699f54a4809a2473bf004 /sys | |
parent | e9653587b65b3c607929a556189a337f220ff84a (diff) |
Correctly set up the HPMC trap entry: according to the PA-RISC Firmware
Architecture Reference Specification, the sum of the 8 trap entry words
*and* of the payload which address and length are to be set at well-known
positions in the aforementioned trap entry, needs to be zero; the existing
code was only enforcing that the sum of the trap entry words is zero.
This matches what Linux and NetBSD do.
ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/hppa/hppa/locore.S | 4 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/machdep.c | 19 |
2 files changed, 16 insertions, 7 deletions
diff --git a/sys/arch/hppa/hppa/locore.S b/sys/arch/hppa/hppa/locore.S index 19e01820bed..3a47c461961 100644 --- a/sys/arch/hppa/hppa/locore.S +++ b/sys/arch/hppa/hppa/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.192 2014/10/23 16:51:30 miod Exp $ */ +/* $OpenBSD: locore.S,v 1.193 2014/10/23 16:57:45 miod Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -2007,6 +2007,7 @@ EXIT(pbtlb_u) */ .export TLABEL(hpmc), entry ENTRY(TLABEL(hpmc),0) +ALTENTRY(hpmc_tramp) mtsp r0, sr0 ldil L%hppa_vtop, t1 @@ -2031,6 +2032,7 @@ ENTRY(TLABEL(hpmc),0) hpmc_never_dies b hpmc_never_dies nop +ALTENTRY(hpmc_tramp_end) EXIT(TLABEL(hpmc)) /* diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index 1e90613a0bb..8d906c5918b 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.237 2014/10/23 16:49:58 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.238 2014/10/23 16:57:45 miod Exp $ */ /* * Copyright (c) 1999-2003 Michael Shalayeff @@ -308,15 +308,22 @@ hppa_init(paddr_t start) /* setup hpmc handler */ { - extern u_int hpmc_v[]; /* from locore.s */ - u_int *p = hpmc_v; + /* from locore.s */ + extern uint32_t hpmc_v[], hpmc_tramp[], hpmc_tramp_end[]; + uint32_t *p; + uint32_t cksum = 0; + for (p = hpmc_tramp; p < hpmc_tramp_end; p++) + cksum += *p; + + p = hpmc_v; if (pdc_call((iodcio_t)pdc, 0, PDC_INSTR, PDC_INSTR_DFLT, p)) *p = 0x08000240; - p[6] = (u_int)&hpmc_dump; - p[7] = 32; - p[5] = -(p[0] + p[1] + p[2] + p[3] + p[4] + p[6] + p[7]); + p[6] = (uint32_t)&hpmc_tramp; + p[7] = (hpmc_tramp_end - hpmc_tramp) * sizeof(uint32_t); + p[5] = + -(p[0] + p[1] + p[2] + p[3] + p[4] + p[6] + p[7] + cksum); } { |