1- /* $NetBSD: locore.s,v 1.53 2026/03/14 21:03:39 thorpej Exp $ */
1+ /* $NetBSD: locore.s,v 1.54 2026/03/18 04:08:38 thorpej Exp $ */
22
33/*
44 * Copyright (c) 1980, 1990, 1993
@@ -371,7 +371,7 @@ Lmainreturned:
371371
372372/*
373373 * Trap/interrupt vector routines
374- */
374+ */
375375#include <m68k/m68k/trap_subr.s>
376376
377377/*
@@ -467,21 +467,15 @@ ENTRY_NOPROFILE(badtrap)
467467ENTRY_NOPROFILE(trap0)
468468 clrl %sp @- | stack adjust count
469469 moveml #0xFFFF,%sp@- | save user registers
470- movl %usp,%a0 | save the user SP
470+ movl %usp,%a0 | save the user SP
471471 movl %a0,%sp @(FR_SP) | in the savearea
472- movl %d0,%sp @- | push syscall number
472+ movl %d0,%sp @- | push syscall number
473473 jbsr _C_LABEL(syscall ) | handle it
474474 addql #4,%sp | pop syscall arg
475475 tstl _C_LABEL(astpending)
476476 jne Lrei2
477- tstb _C_LABEL(ssir)
478- jeq Ltrap1
479- movw #SPL1,%sr
480- tstb _C_LABEL(ssir)
481- jne Lsir1
482- Ltrap1:
483477 movl %sp @(FR_SP),%a0 | grab and restore
484- movl %a0,%usp | user SP
478+ movl %a0,%usp | user SP
485479 moveml %sp @+,#0x7FFF | restore most registers
486480 addql #8,%sp | pop SP and stack adjust
487481 rte
@@ -635,18 +629,16 @@ ENTRY_NOPROFILE(lev7intr) /* level 7: parity errors, reset key */
635629 * This code is complicated by the fact that sendsig may have been called
636630 * necessitating a stack cleanup.
637631 */
638- BSS(ssir,1 )
639-
640632ASENTRY_NOPROFILE(rei)
641633 tstl _C_LABEL(astpending) | AST pending?
642- jeq Lchksir | no, go check for SIR
634+ jeq Ldorte | Nope. Just return.
643635Lrei1:
644- btst #5,%sp@ | yes, are we returning to user mode?
645- jne Lchksir | no, go check for SIR
636+ btst #5,%sp@ | Are we returning to user mode?
637+ jne Ldorte | Nope. Just return.
646638 movw #PSL_LOWIPL,%sr | lower SPL
647639 clrl %sp @- | stack adjust
648640 moveml #0xFFFF,%sp@- | save all registers
649- movl %usp,%a1 | including
641+ movl %usp,%a1 | including
650642 movl %a1,%sp @(FR_SP) | the users SP
651643Lrei2:
652644 clrl %sp @- | VA == none
@@ -672,39 +664,8 @@ Laststkadj:
672664 movl %a0,%sp @(FR_SP) | new SSP
673665 moveml %sp @+,#0x7FFF | restore user registers
674666 movl %sp @,%sp | and our SP
675- rte | and do real RTE
676- Lchksir:
677- tstb _C_LABEL(ssir) | SIR pending?
678- jeq Ldorte | no, all done
679- movl %d0,%sp @- | need a scratch register
680- movw %sp @(4 ),%d0 | get SR
681- andw #PSL_IPL7,%d0 | mask all but IPL
682- jne Lnosir | came from interrupt, no can do
683- movl %sp @+,%d0 | restore scratch register
684- Lgotsir:
685- movw #SPL1,%sr | prevent others from servicing int
686- tstb _C_LABEL(ssir) | too late?
687- jeq Ldorte | yes, oh well...
688- clrl %sp @- | stack adjust
689- moveml #0xFFFF,%sp@- | save all registers
690- movl %usp,%a1 | including
691- movl %a1,%sp @(FR_SP) | the users SP
692- Lsir1:
693- clrl %sp @- | VA == none
694- clrl %sp @- | code == none
695- movl #T_SSIR,%sp@- | type == software interrupt
696- pea %sp @(12 ) | fp == address of trap frame
697- jbsr _C_LABEL(trap) | go handle it
698- lea %sp @(16 ),%sp | pop value args
699- movl %sp @(FR_SP),%a0 | restore
700- movl %a0,%usp | user SP
701- moveml %sp @+,#0x7FFF | and all remaining registers
702- addql #8,%sp | pop SP and stack adjust
703- rte
704- Lnosir:
705- movl %sp @+,%d0 | restore scratch register
706667Ldorte:
707- rte | real return
668+ rte | and do real RTE
708669
709670/*
710671 * Primitives
@@ -745,26 +706,6 @@ Lsldone:
745706 rts
746707#endif
747708
748- /*
749- * Set processor priority level calls. Most are implemented with
750- * inline asm expansions. However, spl0 requires special handling
751- * as we need to check for our emulated software interrupts.
752- */
753-
754- ENTRY(spl0)
755- moveq #0,%d0
756- movw %sr,%d0 | get old SR for return
757- movw #PSL_LOWIPL,%sr | restore new SR
758- tstb _C_LABEL(ssir) | software interrupt pending?
759- jeq Lspldone | no, all done
760- subql #4,%sp | make room for RTE frame
761- movl %sp @(4 ),%sp @(2 ) | position return address
762- clrw %sp @(6 ) | set frame type 0
763- movw #PSL_LOWIPL,%sp@ | and new SR
764- jra Lgotsir | go handle it
765- Lspldone:
766- rts
767-
768709/*
769710 * _delay(u_int N)
770711 *
0 commit comments