summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-05-25 16:22:13 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-05-25 16:22:13 +0000
commit9ec8e68a21275ba6a68cdfb5968c4ece4c9138d8 (patch)
tree47eb3bc93cb1832d17f61c2a2a2d05c794eec6f2 /sys
parent8615544024b177501b6152d5bd0c8c246b348303 (diff)
Allow badaddr() to be used with a size of 8. Needed by the MVME181 memory
detection code, and forgotten in previous commit.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/m88k/m88k/eh_common.S107
1 files changed, 59 insertions, 48 deletions
diff --git a/sys/arch/m88k/m88k/eh_common.S b/sys/arch/m88k/m88k/eh_common.S
index 1e3c347ee14..ab5332eec0f 100644
--- a/sys/arch/m88k/m88k/eh_common.S
+++ b/sys/arch/m88k/m88k/eh_common.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: eh_common.S,v 1.57 2013/01/05 11:20:56 miod Exp $ */
+/* $OpenBSD: eh_common.S,v 1.58 2013/05/25 16:22:12 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -734,7 +734,7 @@ ASLOCAL(m88110_ignore_data_exception)
*
* If all LEN bytes starting at ADDR are accessible, zero is returned.
*
- * Len may be be 1, 2, or 4.
+ * Len may be be 1, 2, 4 or 8.
*
* This is implemented by setting a special flag in SR1 before trying to access
* the given address. If a data access exception is raised, the address
@@ -761,70 +761,81 @@ GLOBAL(badaddr)
set %r5, %r5, 1<FLAG_IGNORE_DATA_EXCEPTION>
/* resetting r5 to SR1 done in the delay slot below. */
- /*
- * If it's a word we're doing, do that here. Otherwise,
- * see if it's a halfword.....
- */
- sub %r6, %r3, 4
- bcnd.n ne0, %r6, _ASM_LABEL(badaddr__maybe_halfword)
+ /* make sure the upper 28 bits of the size are zero... */
+ ext %r6, %r3, 0<4>
+ bcnd.n ne0, %r6, _ASM_LABEL(badaddr__return_nonzero)
stcr %r5, SR1
+ or.u %r6, %r0, %hi16(_ASM_LABEL(badaddr_switch))
+ or %r6, %r6, %lo16(_ASM_LABEL(badaddr_switch))
+ lda %r3, %r6[%r3]
+ jmp %r3
+
+ASLOCAL(badaddr_switch)
+ br _ASM_LABEL(badaddr__return_nonzero)
+ br _ASM_LABEL(badaddr__b)
+ br _ASM_LABEL(badaddr__h)
+ br _ASM_LABEL(badaddr__return_nonzero)
+ br _ASM_LABEL(badaddr__w)
+ br _ASM_LABEL(badaddr__return_nonzero)
+ br _ASM_LABEL(badaddr__return_nonzero)
+ br _ASM_LABEL(badaddr__return_nonzero)
+ br _ASM_LABEL(badaddr__d)
+ br _ASM_LABEL(badaddr__return_nonzero)
+ br _ASM_LABEL(badaddr__return_nonzero)
+ br _ASM_LABEL(badaddr__return_nonzero)
+ br _ASM_LABEL(badaddr__return_nonzero)
+ br _ASM_LABEL(badaddr__return_nonzero)
+ br _ASM_LABEL(badaddr__return_nonzero)
+ br _ASM_LABEL(badaddr__return_nonzero)
+
/*
- * It's a bad address if it's misaligned.
- */
- bb1 0, %r2, _ASM_LABEL(badaddr__return_nonzero)
- bb1 1, %r2, _ASM_LABEL(badaddr__return_nonzero)
- /*
- * The next line will either fault or not. If it faults, execution
- * will go to: data_access_handler (see above)
- * and then to: ignore_data_exception (see above)
- * and then to: badaddr__return_nonzero (see below)
- * which will return to the calling function.
- *
- * If there is no fault, execution just continues as normal.
+ * The load attemps below will either fault or not. If they fault,
+ * execution will go to data_access_handler, then to
+ * ignore_data_exception, then to badaddr__return_nonzero, which
+ * will return to the calling function.
+ * If there is no fault, execution will just continue as normal.
*/
+
+ASLOCAL(badaddr__b)
FLUSH_PIPELINE
- ld %r5, %r2, 0
+ ld.b %r6, %r2, 0
FLUSH_PIPELINE
br.n _ASM_LABEL(badaddr__return)
- or %r2, %r0, %r0 /* indicate a zero (address not bad) return.*/
-
-ASLOCAL(badaddr__maybe_halfword)
- /* More or less like the code for checking a word above */
- sub %r6, %r3, 2
- bcnd ne0, %r6, _ASM_LABEL(badaddr__maybe_byte)
+ or %r2, %r0, %r0
- /* it's bad if it's misaligned */
+ASLOCAL(badaddr__h)
+ /* It's a bad address if it's misaligned. */
bb1 0, %r2, _ASM_LABEL(badaddr__return_nonzero)
FLUSH_PIPELINE
- ld.h %r5, %r2, 0
+ ld.h %r6, %r2, 0
FLUSH_PIPELINE
br.n _ASM_LABEL(badaddr__return)
or %r2, %r0, %r0
-ASLOCAL(badaddr__maybe_byte)
-#ifdef DEBUG
- /* More or less like the code for checking a word above */
- sub %r6, %r3, 1
- bcnd ne0, %r6, _ASM_LABEL(badaddr__unknown_size)
-#endif
+ASLOCAL(badaddr__w)
+ /* It's a bad address if it's misaligned. */
+ bb1 0, %r2, _ASM_LABEL(badaddr__return_nonzero)
+ bb1 1, %r2, _ASM_LABEL(badaddr__return_nonzero)
+
FLUSH_PIPELINE
- ld.b %r5, %r2, 0
+ ld %r6, %r2, 0
FLUSH_PIPELINE
br.n _ASM_LABEL(badaddr__return)
- or %r2, %r0, %r0
-ASLOCAL(badaddr__unknown_size)
-#ifdef DEBUG
- data
-1: string "bad length (%d) to badaddr() from 0x%x\000"
- text
- or.u %r2, %r0, %hi16(1b)
- or %r2, %r2, %lo16(1b)
- bsr.n _C_LABEL(panic)
- or %r4, %r0, %r1
- /*NOTREACHED*/
-#endif
+ or %r2, %r0, %r0 /* indicate a zero (address not bad) return.*/
+
+ASLOCAL(badaddr__d)
+ /* It's a bad address if it's misaligned. */
+ bb1 0, %r2, _ASM_LABEL(badaddr__return_nonzero)
+ bb1 1, %r2, _ASM_LABEL(badaddr__return_nonzero)
+ bb1 2, %r2, _ASM_LABEL(badaddr__return_nonzero)
+
+ FLUSH_PIPELINE
+ ld.d %r6, %r2, 0
+ FLUSH_PIPELINE
+ br.n _ASM_LABEL(badaddr__return)
+ or %r2, %r0, %r0 /* indicate a zero (address not bad) return.*/
ASLOCAL(badaddr__return_nonzero)
or %r2, %r0, 1