Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Use common m68k/busaddrerr.s for bus error and addr...
details: https://anonhg.NetBSD.org/src/rev/b3b5a3eb2268
branches: trunk
changeset: 327723:b3b5a3eb2268
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat Mar 15 12:04:22 2014 +0000
description:
Use common m68k/busaddrerr.s for bus error and address error handlers.
No binary changes on GENERIC.
diffstat:
sys/arch/mac68k/mac68k/locore.s | 181 +----------------------------------
sys/arch/mvme68k/mvme68k/locore.s | 174 +---------------------------------
sys/arch/next68k/next68k/locore.s | 192 +-------------------------------------
3 files changed, 15 insertions(+), 532 deletions(-)
diffs (truncated from 595 to 300 lines):
diff -r be3238720b52 -r b3b5a3eb2268 sys/arch/mac68k/mac68k/locore.s
--- a/sys/arch/mac68k/mac68k/locore.s Sat Mar 15 12:02:28 2014 +0000
+++ b/sys/arch/mac68k/mac68k/locore.s Sat Mar 15 12:04:22 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.169 2014/03/09 16:28:43 tsutsui Exp $ */
+/* $NetBSD: locore.s,v 1.170 2014/03/15 12:11:23 tsutsui Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -474,187 +474,16 @@
*/
#include <m68k/m68k/trap_subr.s>
+/*
+ * Use common m68k bus error and address error handlers.
+ */
.data
GLOBAL(mac68k_a2_fromfault)
.long 0
GLOBAL(m68k_fault_addr)
.long 0
-#if defined(M68040) || defined(M68060)
-ENTRY_NOPROFILE(addrerr4060)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save %USP
- movl %a0,%sp@(FR_SP) | in the savearea
- movl %sp@(FR_HW+8),%sp@-
- clrl %sp@- | dummy code
- movl #T_ADDRERR,%sp@- | mark address error
- jra _ASM_LABEL(faultstkadj) | and deal with it
-#endif
-
-#if defined(M68060)
-ENTRY_NOPROFILE(buserr60)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save %USP
- movl %a0,%sp@(FR_SP) | in the savearea
- movel %sp@(FR_HW+12),%d0 | FSLW
- btst #2,%d0 | branch prediction error?
- jeq Lnobpe
- movc %cacr,%d2
- orl #IC60_CABC,%d2 | clear all branch cache entries
- movc %d2,%cacr
- movl %d0,%d1
- andl #0x7ffd,%d1
- jeq _ASM_LABEL(faultstkadjnotrap2)
-Lnobpe:
-| we need to adjust for misaligned addresses
- movl %sp@(FR_HW+8),%d1 | grab VA
- btst #27,%d0 | check for mis-aligned access
- jeq Lberr3 | no, skip
- addl #28,%d1 | yes, get into next page
- | operand case: 3,
- | instruction case: 4+12+12
- andl #PG_FRAME,%d1 | and truncate
-Lberr3:
- movl %d1,%sp@-
- movl %d0,%sp@- | code is FSLW now.
- andw #0x1f80,%d0
- jeq Lberr60 | it is a bus error
- movl #T_MMUFLT,%sp@- | show that we are an MMU fault
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lberr60:
- tstl _C_LABEL(nofault) | catch bus error?
- jeq Lisberr | no, handle as usual
- movl %a2,_C_LABEL(mac68k_a2_fromfault) | save %a2
- movl %sp@(FR_HW+8+8),_C_LABEL(m68k_fault_addr) | save fault addr
- movl _C_LABEL(nofault),%sp@- | yes,
- jbsr _C_LABEL(longjmp) | longjmp(nofault)
- /* NOTREACHED */
-#endif
-#if defined(M68040)
-ENTRY_NOPROFILE(buserr40)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save %USP
- movl %a0,%sp@(FR_SP) | in the savearea
- movl %sp@(FR_HW+20),%d1 | get fault address
- moveq #0,%d0
- movw %sp@(FR_HW+12),%d0 | get SSW
- btst #11,%d0 | check for mis-aligned
- jeq Lbe1stpg | no skip
- addl #3,%d1 | get into next page
- andl #PG_FRAME,%d1 | and truncate
-Lbe1stpg:
- movl %d1,%sp@- | pass fault address.
- movl %d0,%sp@- | pass SSW as code
- btst #10,%d0 | test ATC
- jeq Lberr40 | it is a bus error
- movl #T_MMUFLT,%sp@- | show that we are an MMU fault
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lberr40:
- tstl _C_LABEL(nofault) | catch bus error?
- jeq Lisberr | no, handle as usual
- movl %a2,_C_LABEL(mac68k_a2_fromfault) | save %a2
- movl %sp@(FR_HW+8+20),_C_LABEL(m68k_fault_addr) | save fault addr
- movl _C_LABEL(nofault),%sp@- | yes,
- jbsr _C_LABEL(longjmp) | longjmp(nofault)
- /* NOTREACHED */
-#endif
-
-ENTRY_NOPROFILE(busaddrerr2030)
-#if !(defined(M68020) || defined(M68030))
- jra _C_LABEL(badtrap)
-#else
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save %USP
- movl %a0,%sp@(FR_SP) | in the savearea
- moveq #0,%d0
- movw %sp@(FR_HW+10),%d0 | grab SSW for fault processing
- btst #12,%d0 | RB set?
- jeq LbeX0 | no, test RC
- bset #14,%d0 | yes, must set FB
- movw %d0,%sp@(FR_HW+10) | for hardware too
-LbeX0:
- btst #13,%d0 | RC set?
- jeq LbeX1 | no, skip
- bset #15,%d0 | yes, must set FC
- movw %d0,%sp@(FR_HW+10) | for hardware too
-LbeX1:
- btst #8,%d0 | data fault?
- jeq Lbe0 | no, check for hard cases
- movl %sp@(FR_HW+16),%d1 | fault address is as given in frame
- jra Lbe10 | thats it
-Lbe0:
- btst #4,%sp@(FR_HW+6) | long (type B) stack frame?
- jne Lbe4 | yes, go handle
- movl %sp@(FR_HW+2),%d1 | no, can use save PC
- btst #14,%d0 | FB set?
- jeq Lbe3 | no, try FC
- addql #4,%d1 | yes, adjust address
- jra Lbe10 | done
-Lbe3:
- btst #15,%d0 | FC set?
- jeq Lbe10 | no, done
- addql #2,%d1 | yes, adjust address
- jra Lbe10 | done
-Lbe4:
- movl %sp@(FR_HW+36),%d1 | long format, use stage B address
- btst #15,%d0 | FC set?
- jeq Lbe10 | no, all done
- subql #2,%d1 | yes, adjust address
-Lbe10:
- movl %d1,%sp@- | push fault VA
- movl %d0,%sp@- | and padded SSW
- movw %sp@(FR_HW+8+6),%d0 | get frame format/vector offset
- andw #0x0FFF,%d0 | clear out frame format
- cmpw #12,%d0 | address error vector?
- jeq Lisaerr | yes, go to it
- movl %d1,%a0 | fault address
- movl %sp@,%d0 | function code from ssw
- btst #8,%d0 | data fault?
- jne Lbe10a
- movql #1,%d0 | user program access FC
- | (we do not separate data/program)
- btst #5,%sp@(FR_HW+8) | supervisor mode?
- jeq Lbe10a | if no, done
- movql #5,%d0 | else supervisor program access
-Lbe10a:
- ptestr %d0,%a0@,#7 | do a table search
- pmove %psr,%sp@ | save result
- movb %sp@,%d1
- btst #2,%d1 | invalid (incl. limit viol. and berr)?
- jeq Lmightnotbemerr | no -> wp check
- btst #7,%d1 | is it MMU table berr?
- jne Lisberr1 | yes, needs not be fast.
-Lismerr:
- movl #T_MMUFLT,%sp@- | show that we are an MMU fault
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lmightnotbemerr:
- btst #3,%d1 | write protect bit set?
- jeq Lisberr1 | no: must be bus error
- movl %sp@,%d0 | ssw into low word of %d0
- andw #0xc0,%d0 | Write protect is set on page:
- cmpw #0x40,%d0 | was it read cycle?
- jne Lismerr | no, was not WPE, must be MMU fault
- jra Lisberr1 | real bus err needs not be fast.
-Lisaerr:
- movl #T_ADDRERR,%sp@- | mark address error
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lisberr1:
- clrw %sp@ | re-clear pad word
- tstl _C_LABEL(nofault) | catch bus error?
- jeq Lisberr | no, handle as usual
- movl %a2,_C_LABEL(mac68k_a2_fromfault) | save %a2
- movl %sp@(FR_HW+8+16),_C_LABEL(m68k_fault_addr) | save fault addr
- movl _C_LABEL(nofault),%sp@- | yes,
- jbsr _C_LABEL(longjmp) | longjmp(nofault)
- /* NOTREACHED */
-#endif
-Lisberr: | also used by M68040/60
- movl #T_BUSERR,%sp@- | mark bus error
- jra _ASM_LABEL(faultstkadj) | and deal with it
+#include <m68k/m68k/busaddrerr.s>
/*
* FP exceptions.
diff -r be3238720b52 -r b3b5a3eb2268 sys/arch/mvme68k/mvme68k/locore.s
--- a/sys/arch/mvme68k/mvme68k/locore.s Sat Mar 15 12:02:28 2014 +0000
+++ b/sys/arch/mvme68k/mvme68k/locore.s Sat Mar 15 12:04:22 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.113 2014/03/15 12:02:28 tsutsui Exp $ */
+/* $NetBSD: locore.s,v 1.114 2014/03/15 12:04:22 tsutsui Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -709,174 +709,10 @@
*/
#include <m68k/m68k/trap_subr.s>
-#if defined(M68040) || defined(M68060)
-ENTRY_NOPROFILE(addrerr4060)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- movl %sp@(FR_HW+8),%sp@-
- clrl %sp@- | dummy code
- movl #T_ADDRERR,%sp@- | mark address error
- jra _ASM_LABEL(faultstkadj) | and deal with it
-#endif
-
-#if defined(M68060)
-ENTRY_NOPROFILE(buserr60)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- movel %sp@(FR_HW+12),%d0 | FSLW
- btst #2,%d0 | branch prediction error?
- jeq Lnobpe
- movc %cacr,%d2
- orl #IC60_CABC,%d2 | clear all branch cache entries
- movc %d2,%cacr
- movl %d0,%d1
- andl #0x7ffd,%d1
- jeq _ASM_LABEL(faultstkadjnotrap2)
-Lnobpe:
-| we need to adjust for misaligned addresses
- movl %sp@(FR_HW+8),%d1 | grab VA
- btst #27,%d0 | check for mis-aligned access
- jeq Lberr3 | no, skip
- addl #28,%d1 | yes, get into next page
- | operand case: 3,
- | instruction case: 4+12+12
- andl #PG_FRAME,%d1 | and truncate
-Lberr3:
- movl %d1,%sp@-
- movl %d0,%sp@- | code is FSLW now.
- andw #0x1f80,%d0
- jeq Lberr60 | it is a bus error
- movl #T_MMUFLT,%sp@- | show that we are an MMU fault
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lberr60:
- tstl _C_LABEL(nofault) | catch bus error?
- jeq Lisberr | no, handle as usual
- movl _C_LABEL(nofault),%sp@- | yes,
- jbsr _C_LABEL(longjmp) | longjmp(nofault)
- /* NOTREACHED */
-#endif
-#if defined(M68040)
-ENTRY_NOPROFILE(buserr40)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- movl %sp@(FR_HW+20),%d1 | get fault address
- moveq #0,%d0
- movw %sp@(FR_HW+12),%d0 | get SSW
- btst #11,%d0 | check for mis-aligned
- jeq Lbe1stpg | no skip
- addl #3,%d1 | get into next page
- andl #PG_FRAME,%d1 | and truncate
-Lbe1stpg:
- movl %d1,%sp@- | pass fault address.
- movl %d0,%sp@- | pass SSW as code
- btst #10,%d0 | test ATC
- jeq Lberr40 | it is a bus error
- movl #T_MMUFLT,%sp@- | show that we are an MMU fault
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lberr40:
- tstl _C_LABEL(nofault) | catch bus error?
- jeq Lisberr | no, handle as usual
- movl _C_LABEL(nofault),%sp@- | yes,
- jbsr _C_LABEL(longjmp) | longjmp(nofault)
- /* NOTREACHED */
-#endif
-
-#if defined(M68020) || defined(M68030)
-ENTRY_NOPROFILE(busaddrerr2030)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- moveq #0,%d0
- movw %sp@(FR_HW+10),%d0 | grab SSW for fault processing
Home |
Main Index |
Thread Index |
Old Index