-/* $OpenBSD: SYS.h,v 1.11 2016/05/18 20:21:13 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.12 2022/09/02 06:19:04 miod Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
#define __END(x) \
__END_HIDDEN(x); SET_ENTRY_SIZE(x)
+#ifdef __ASSEMBLER__
+/*
+ * If the system call number fits in a 8-bit signed value (i.e. fits in 7 bits),
+ * then we can use the #imm8 addressing mode.
+ */
+
+.macro systrap num
+.iflt \num - 128
+ mov # \num, r0
+ trapa #0x80
+.else
+ mov.l 903f, r0
+ trapa #0x80
+ bra 904f
+ nop
+ .align 2
+ 903: .long \num
+ 904:
+.endif
+.endm
+#endif
+
#define SYSTRAP(x) \
- mov.l 903f, r0; \
- .word 0xc380; /* trapa #0x80; */ \
- bra 904f; \
- nop; \
- .align 2; \
- 903: .long (SYS_ ## x); \
- 904:
+ systrap SYS_ ## x
#define _SYSCALL_NOERROR(x,y) \
SYSENTRY(x); \
-/* $OpenBSD: brk.S,v 1.6 2016/05/30 05:18:52 guenther Exp $ */
+/* $OpenBSD: brk.S,v 1.7 2022/09/02 06:19:04 miod Exp $ */
/* $NetBSD: brk.S,v 1.10 2006/01/06 03:58:31 uwe Exp $ */
/*-
bf 1f
mov r0, r4
1:
+#if SYS_break >= 128
mov.l LSYS_break, r0
+#else
+ mov #SYS_break, r0
+#endif
trapa #0x80
bf 2f
#ifdef __PIC__
SET_ERRNO_AND_RETURN
.align 2
+#if SYS_break >= 128
LSYS_break: .long SYS_break
+#endif
#ifdef __PIC__
L_GOT: .long _GLOBAL_OFFSET_TABLE_
Lminbrk: .long __minbrk@GOT
-/* $OpenBSD: sbrk.S,v 1.6 2016/05/30 05:18:52 guenther Exp $ */
+/* $OpenBSD: sbrk.S,v 1.7 2022/09/02 06:19:04 miod Exp $ */
/* $NetBSD: sbrk.S,v 1.9 2006/01/06 03:58:31 uwe Exp $ */
/*-
#endif
mov.l @r0, r0
add r0, r4
+#if SYS_break >= 128
mov.l LSYS_break, r0
+#else
+ mov #SYS_break, r0
+#endif
trapa #0x80
bf 1f
#ifdef __PIC__
SET_ERRNO_AND_RETURN
.align 2
+#if SYS_break >= 128
LSYS_break: .long SYS_break
+#endif
#ifdef __PIC__
L_GOT: .long _GLOBAL_OFFSET_TABLE_
Lcurbrk: .long __curbrk@GOT
-/* $OpenBSD: sigprocmask.S,v 1.5 2016/05/18 20:21:13 guenther Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.6 2022/09/02 06:19:04 miod Exp $ */
/* $NetBSD: sigprocmask.S,v 1.6 2003/08/07 16:42:21 agc Exp $ */
/*-
nop
1: mov.l @r2, r2 /* fetch indirect ... */
mov r2, r5 /* to new mask arg */
-2: mov.l LSYS_sigprocmask, r0
+2:
+#if SYS_sigprocmask >= 128
+ mov.l LSYS_sigprocmask, r0
+#else
+ mov #SYS_sigprocmask, r0
+#endif
trapa #0x80
bf 4f
mov r6, r2 /* fetch old mask requested */
SET_ERRNO_AND_RETURN
.align 2
+#if SYS_sigprocmask >= 128
LSYS_sigprocmask:
.long SYS_sigprocmask
+#endif
SYSCALL_END_HIDDEN(sigprocmask)
-/* $OpenBSD: sigsuspend.S,v 1.4 2016/05/18 20:21:13 guenther Exp $ */
+/* $OpenBSD: sigsuspend.S,v 1.5 2022/09/02 06:19:04 miod Exp $ */
/* $NetBSD: sigsuspend.S,v 1.5 2003/08/07 16:42:21 agc Exp $ */
/*-
mov r4, r0 /* fetch mask arg */
mov.l @r0, r0 /* indirect to mask arg */
mov r0, r4
+#if SYS_sigsuspend >= 128
mov.l LSYS_sigsuspend, r0
+#else
+ mov #SYS_sigsuspend, r0
+#endif
trapa #0x80
SET_ERRNO_AND_RETURN
.align 2
+#if SYS_sigsuspend >= 128
LSYS_sigsuspend:
.long SYS_sigsuspend
+#endif
SYSCALL_END_HIDDEN(sigsuspend)
-/* $OpenBSD: tfork_thread.S,v 1.3 2016/05/18 20:21:13 guenther Exp $ */
+/* $OpenBSD: tfork_thread.S,v 1.4 2022/09/02 06:19:04 miod Exp $ */
/*
* Copyright (c) 2007 Miodrag Vallat.
* r4 r5 r6 r7
*/
ENTRY(__tfork_thread)
+#if SYS___tfork >= 128
mov.l .LSYS___tfork, r0
- .word 0xc380 /* trapa #0x80 */
+#else
+ mov #SYS___tfork, r0
+#endif
+ trapa #0x80
bf 9f
tst r0, r0
jsr @r6
mov r7, r4
+#if SYS___threxit >= 128
mov.l .LSYS___threxit, r0
- .word 0xc380 /* trapa #0x80 */
+#else
+ mov #SYS___threxit, r0
+#endif
+ trapa #0x80
9:
/*
SET_ERRNO_AND_RETURN
.align 2
+#if SYS___tfork >= 128
.LSYS___tfork: .long SYS___tfork
+#endif
+#if SYS___threxit >= 128
.LSYS___threxit: .long SYS___threxit
+#endif
SET_ENTRY_SIZE(__tfork_thread)
-/* $OpenBSD: SYS.h,v 1.1 2017/08/27 21:59:52 deraadt Exp $ */
+/* $OpenBSD: SYS.h,v 1.2 2022/09/02 06:19:05 miod Exp $ */
/*
* Copyright (c) 2006 Dale Rahn
#include <machine/asm.h>
#include <sys/syscall.h>
-#define SYSTRAP(x) \
- mov.l 903f, r0; \
- .word 0xc380; /* trapa #0x80; */ \
- bra 904f; \
- nop; \
- .align 2; \
- 903: .long (SYS_ ## x); \
+#ifdef __ASSEMBLER__
+/*
+ * If the system call number fits in a 8-bit signed value (i.e. fits in 7 bits),
+ * then we can use the #imm8 addressing mode.
+ */
+
+.macro systrap num
+.iflt \num - 128
+ mov # \num, r0
+ trapa #0x80
+.else
+ mov.l 903f, r0
+ trapa #0x80
+ bra 904f
+ nop
+ .align 2
+ 903: .long \num
904:
+.endif
+.endm
+#endif
+
+#define SYSTRAP(x) \
+ systrap SYS_ ## x
#define DL_SYSCALL(n) \
.global __CONCAT(_dl_,n) ;\