Skip to content

Commit e4d072b

Browse files
committed
Re-factor trap12 ("cachectl") into trap_subr.s. Already identical everywhere
except for 68010, where it's a no-op.
1 parent d7b3090 commit e4d072b

14 files changed

Lines changed: 34 additions & 202 deletions

File tree

sys/arch/amiga/amiga/locore.s

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: locore.s,v 1.179 2026/03/18 15:50:08 thorpej Exp $ */
1+
/* $NetBSD: locore.s,v 1.180 2026/03/18 16:28:43 thorpej Exp $ */
22

33
/*
44
* Copyright (c) 1988 University of Utah.
@@ -178,21 +178,6 @@ Lfptnull:
178178
* no post-trap stack adjustment.
179179
*/
180180

181-
/*
182-
* Trap 12 is the entry point for the cachectl "syscall"
183-
* cachectl(command, addr, length)
184-
* command in d0, addr in a1, length in d1
185-
*/
186-
ENTRY_NOPROFILE(trap12)
187-
movl _C_LABEL(curlwp),%a0
188-
movl %a0@(L_PROC),%sp@- | push current proc pointer
189-
movl %d1,%sp@- | push length
190-
movl %a1,%sp@- | push addr
191-
movl %d0,%sp@- | push command
192-
jbsr _C_LABEL(cachectl1) | do it
193-
lea %sp@(16),%sp | pop args
194-
jra _ASM_LABEL(rei) | all done
195-
196181
/*
197182
* Trap 15 is used for:
198183
* - KGDB traps

sys/arch/atari/atari/locore.s

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: locore.s,v 1.134 2026/03/18 15:50:08 thorpej Exp $ */
1+
/* $NetBSD: locore.s,v 1.135 2026/03/18 16:28:43 thorpej Exp $ */
22

33
/*
44
* Copyright (c) 1988 University of Utah.
@@ -317,21 +317,6 @@ ENTRY_NOPROFILE(badmfpint)
317317
subql #1,_C_LABEL(intr_depth)
318318
jra _ASM_LABEL(rei) | all done
319319

320-
/*
321-
* Trap 12 is the entry point for the cachectl "syscall"
322-
* cachectl(command, addr, length)
323-
* command in d0, addr in a1, length in d1
324-
*/
325-
ENTRY_NOPROFILE(trap12)
326-
movl _C_LABEL(curlwp),%a0
327-
movl %a0@(L_PROC),%sp@- | push curproc pointer
328-
movl %d1,%sp@- | push length
329-
movl %a1,%sp@- | push addr
330-
movl %d0,%sp@- | push command
331-
jbsr _C_LABEL(cachectl1) | do it
332-
lea %sp@(16),%sp | pop args
333-
jra _ASM_LABEL(rei) | all done
334-
335320
/*
336321
* Trace (single-step) trap. Kernel-mode is special.
337322
* User mode traps are simply passed on to trap().

sys/arch/cesfic/cesfic/locore.s

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: locore.s,v 1.58 2026/03/18 15:50:08 thorpej Exp $ */
1+
/* $NetBSD: locore.s,v 1.59 2026/03/18 16:28:43 thorpej Exp $ */
22

33
/*
44
* Copyright (c) 1980, 1990, 1993
@@ -449,21 +449,6 @@ Lfptnull:
449449
jra _ASM_LABEL(faultstkadj) | call trap and deal with stack cleanup
450450

451451

452-
/*
453-
* Trap 12 is the entry point for the cachectl "syscall" (both HPUX & BSD)
454-
* cachectl(command, addr, length)
455-
* command in d0, addr in a1, length in d1
456-
*/
457-
ENTRY_NOPROFILE(trap12)
458-
movl _C_LABEL(curlwp),%a0
459-
movl %a0@(L_PROC),%sp@- | push current proc pointer
460-
movl %d1,%sp@- | push length
461-
movl %a1,%sp@- | push addr
462-
movl %d0,%sp@- | push command
463-
jbsr _C_LABEL(cachectl1) | do it
464-
lea %sp@(16),%sp | pop args
465-
jra _ASM_LABEL(rei) | all done
466-
467452
/*
468453
* Trace (single-step) trap. Kernel-mode is special.
469454
* User mode traps are simply passed on to trap().

sys/arch/hp300/hp300/locore.s

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: locore.s,v 1.205 2026/03/18 15:50:08 thorpej Exp $ */
1+
/* $NetBSD: locore.s,v 1.206 2026/03/18 16:28:43 thorpej Exp $ */
22

33
/*
44
* Copyright (c) 1980, 1990, 1993
@@ -621,21 +621,6 @@ Lfptnull:
621621
* no post-trap stack adjustment.
622622
*/
623623

624-
/*
625-
* Trap 12 is the entry point for the cachectl "syscall" (both HPUX & BSD)
626-
* cachectl(command, addr, length)
627-
* command in %d0, addr in %a1, length in %d1
628-
*/
629-
ENTRY_NOPROFILE(trap12)
630-
movl _C_LABEL(curlwp),%a0
631-
movl %a0@(L_PROC),%sp@- | push current proc pointer
632-
movl %d1,%sp@- | push length
633-
movl %a1,%sp@- | push addr
634-
movl %d0,%sp@- | push command
635-
jbsr _C_LABEL(cachectl1) | do it
636-
lea %sp@(16),%sp | pop args
637-
jra _ASM_LABEL(rei) | all done
638-
639624
/*
640625
* Trace (single-step) trap. Kernel-mode is special.
641626
* User mode traps are simply passed on to trap().

sys/arch/luna68k/luna68k/locore.s

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: locore.s,v 1.101 2026/03/18 15:50:08 thorpej Exp $ */
1+
/* $NetBSD: locore.s,v 1.102 2026/03/18 16:28:44 thorpej Exp $ */
22

33
/*
44
* Copyright (c) 1988 University of Utah.
@@ -366,21 +366,6 @@ Lfptnull:
366366
* no post-trap stack adjustment.
367367
*/
368368

369-
/*
370-
* Trap 12 is the entry point for the cachectl "syscall" (both HPUX & BSD)
371-
* cachectl(command, addr, length)
372-
* command in %d0, addr in %a1, length in %d1
373-
*/
374-
ENTRY_NOPROFILE(trap12)
375-
movl _C_LABEL(curlwp),%a0
376-
movl %a0@(L_PROC),%sp@- | push current proc pointer
377-
movl %d1,%sp@- | push length
378-
movl %a1,%sp@- | push addr
379-
movl %d0,%sp@- | push command
380-
jbsr _C_LABEL(cachectl1) | do it
381-
lea %sp@(16),%sp | pop args
382-
jra _ASM_LABEL(rei) | all done
383-
384369
/*
385370
* Trace (single-step) trap. Kernel-mode is special.
386371
* User mode traps are simply passed on to trap().

sys/arch/m68k/m68k/trap_subr.s

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: trap_subr.s,v 1.23 2026/03/18 15:50:08 thorpej Exp $ */
1+
/* $NetBSD: trap_subr.s,v 1.24 2026/03/18 16:28:44 thorpej Exp $ */
22

33
/*
44
* Copyright (c) 1988 University of Utah.
@@ -231,6 +231,26 @@ ENTRY_NOPROFILE(trap0)
231231
addql #8,%sp | pop SP and stack adjust
232232
rte | all done
233233

234+
/*
235+
* trap #12 -- "cachectl" pseudo-syscall (originally from HP-UX, but also
236+
* used natively in BSD).
237+
*
238+
* cachectl(command, addr, length)
239+
*
240+
* command in d0, addr in a1, length in d1
241+
*/
242+
ENTRY_NOPROFILE(trap12)
243+
#ifndef __mc68010__
244+
movl _C_LABEL(curlwp),%a0
245+
movl %a0@(L_PROC),-(%sp) | push current proc pointer
246+
movl %d1,-(%sp) | push length
247+
movl %a1,-(%sp) | push addr
248+
movl %d0,-(%sp) | push command
249+
jbsr _C_LABEL(cachectl1) | do it
250+
lea %sp@(16),%sp | pop args
251+
#endif /* ! __mc68010__ */
252+
jra _ASM_LABEL(rei) | all done
253+
234254
/*
235255
* Emulation of VAX REI instruction.
236256
*

sys/arch/mac68k/mac68k/locore.s

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: locore.s,v 1.196 2026/03/18 15:50:09 thorpej Exp $ */
1+
/* $NetBSD: locore.s,v 1.197 2026/03/18 16:28:44 thorpej Exp $ */
22

33
/*
44
* Copyright (c) 1988 University of Utah.
@@ -545,21 +545,6 @@ Lfptnull:
545545
* no post-trap stack adjustment.
546546
*/
547547

548-
/*
549-
* Trap 12 is the entry point for the cachectl "syscall" (both HP-UX & BSD)
550-
* cachectl(command, addr, length)
551-
* command in %d0, addr in %a1, length in %d1
552-
*/
553-
ENTRY_NOPROFILE(trap12)
554-
movl _C_LABEL(curlwp),%a0
555-
movl %a0@(L_PROC),%sp@- | push proc pointer
556-
movl %d1,%sp@- | push length
557-
movl %a1,%sp@- | push addr
558-
movl %d0,%sp@- | push command
559-
jbsr _C_LABEL(cachectl1) | do it
560-
lea %sp@(16),%sp | pop args
561-
jra _ASM_LABEL(rei) | all done
562-
563548
/*
564549
* Trace (single-step) trap. Kernel-mode is special.
565550
* User mode traps are simply passed on to trap().

sys/arch/mvme68k/mvme68k/locore.s

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: locore.s,v 1.154 2026/03/18 15:50:09 thorpej Exp $ */
1+
/* $NetBSD: locore.s,v 1.155 2026/03/18 16:28:44 thorpej Exp $ */
22

33
/*
44
* Copyright (c) 1988 University of Utah.
@@ -722,21 +722,6 @@ Lfptnull:
722722
* no post-trap stack adjustment.
723723
*/
724724

725-
/*
726-
* Trap 12 is the entry point for the cachectl "syscall" (both HPUX & BSD)
727-
* cachectl(command, addr, length)
728-
* command in d0, addr in a1, length in d1
729-
*/
730-
ENTRY_NOPROFILE(trap12)
731-
movl _C_LABEL(curlwp),%a0
732-
movl %a0@(L_PROC),%sp@- | push current proc pointer
733-
movl %d1,%sp@- | push length
734-
movl %a1,%sp@- | push addr
735-
movl %d0,%sp@- | push command
736-
jbsr _C_LABEL(cachectl1) | do it
737-
lea %sp@(16),%sp | pop args
738-
jra _ASM_LABEL(rei) | all done
739-
740725
/*
741726
* Trace (single-step) trap. Kernel-mode is special.
742727
* User mode traps are simply passed on to trap().

sys/arch/news68k/news68k/locore.s

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: locore.s,v 1.103 2026/03/18 15:50:09 thorpej Exp $ */
1+
/* $NetBSD: locore.s,v 1.104 2026/03/18 16:28:44 thorpej Exp $ */
22

33
/*
44
* Copyright (c) 1988 University of Utah.
@@ -448,21 +448,6 @@ Lfptnull:
448448
* no post-trap stack adjustment.
449449
*/
450450

451-
/*
452-
* Trap 12 is the entry point for the cachectl "syscall" (both HPUX & BSD)
453-
* cachectl(command, addr, length)
454-
* command in %d0, addr in %a1, length in %d1
455-
*/
456-
ENTRY_NOPROFILE(trap12)
457-
movl _C_LABEL(curlwp),%a0
458-
movl %a0@(L_PROC),%sp@- | push curproc pointer
459-
movl %d1,%sp@- | push length
460-
movl %a1,%sp@- | push addr
461-
movl %d0,%sp@- | push command
462-
jbsr _C_LABEL(cachectl1) | do it
463-
lea %sp@(16),%sp | pop args
464-
jra _ASM_LABEL(rei) | all done
465-
466451
/*
467452
* Trace (single-step) trap. Kernel-mode is special.
468453
* User mode traps are simply passed on to trap().

sys/arch/next68k/next68k/locore.s

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: locore.s,v 1.101 2026/03/18 15:50:09 thorpej Exp $ */
1+
/* $NetBSD: locore.s,v 1.102 2026/03/18 16:28:44 thorpej Exp $ */
22

33
/*
44
* Copyright (c) 1998 Darrin B. Jewell
@@ -459,21 +459,6 @@ Lfptnull:
459459
* no post-trap stack adjustment.
460460
*/
461461

462-
/*
463-
* Trap 12 is the entry point for the cachectl "syscall" (both HPUX & BSD)
464-
* cachectl(command, addr, length)
465-
* command in %d0, addr in %a1, length in %d1
466-
*/
467-
ENTRY_NOPROFILE(trap12)
468-
movl _C_LABEL(curlwp),%a0
469-
movl %a0@(L_PROC),%sp@- | push curproc pointer
470-
movl %d1,%sp@- | push length
471-
movl %a1,%sp@- | push addr
472-
movl %d0,%sp@- | push command
473-
jbsr _C_LABEL(cachectl1) | do it
474-
lea %sp@(16),%sp | pop args
475-
jra _ASM_LABEL(rei) | all done
476-
477462
/*
478463
* Trace (single-step) trap. Kernel-mode is special.
479464
* User mode traps are simply passed on to trap().

0 commit comments

Comments
 (0)