summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpefo <pefo@openbsd.org>2004-09-09 16:14:02 +0000
committerpefo <pefo@openbsd.org>2004-09-09 16:14:02 +0000
commit5738bc6274bbfbba95d07e5dc8d380a26b687449 (patch)
tree2fdb4b298d19aa3d12a13799abdc7cf8f6f9bb29
parentChanges for 64 bit kernel. Some functions needis to be rewritten or (diff)
downloadwireguard-openbsd-5738bc6274bbfbba95d07e5dc8d380a26b687449.tar.xz
wireguard-openbsd-5738bc6274bbfbba95d07e5dc8d380a26b687449.zip
mips64 is now going ABI64 and shared library support!
String functions need some optimization/rewrite to take full advantage.
-rw-r--r--lib/libc/arch/mips64/SYS.h50
-rw-r--r--lib/libc/arch/mips64/gen/_setjmp.S30
-rw-r--r--lib/libc/arch/mips64/gen/fabs.S4
-rw-r--r--lib/libc/arch/mips64/gen/isinf.S6
-rw-r--r--lib/libc/arch/mips64/gen/ldexp.S4
-rw-r--r--lib/libc/arch/mips64/gen/modf.S4
-rw-r--r--lib/libc/arch/mips64/gen/setjmp.S61
-rw-r--r--lib/libc/arch/mips64/gen/sigsetjmp.S24
-rw-r--r--lib/libc/arch/mips64/net/htonl.S4
-rw-r--r--lib/libc/arch/mips64/net/htons.S4
-rw-r--r--lib/libc/arch/mips64/string/bcmp.S4
-rw-r--r--lib/libc/arch/mips64/string/bcopy.S4
-rw-r--r--lib/libc/arch/mips64/string/bzero.S4
-rw-r--r--lib/libc/arch/mips64/string/ffs.S4
-rw-r--r--lib/libc/arch/mips64/string/index.S6
-rw-r--r--lib/libc/arch/mips64/string/rindex.S4
-rw-r--r--lib/libc/arch/mips64/string/strcmp.S4
-rw-r--r--lib/libc/arch/mips64/string/strlen.S4
-rw-r--r--lib/libc/arch/mips64/sys/Ovfork.S13
-rw-r--r--lib/libc/arch/mips64/sys/brk.S31
-rw-r--r--lib/libc/arch/mips64/sys/cerror.S11
-rw-r--r--lib/libc/arch/mips64/sys/exect.S13
-rw-r--r--lib/libc/arch/mips64/sys/fork.S13
-rw-r--r--lib/libc/arch/mips64/sys/rfork.S13
-rw-r--r--lib/libc/arch/mips64/sys/sbrk.S13
-rw-r--r--lib/libc/arch/mips64/sys/setlogin.S13
-rw-r--r--lib/libc/arch/mips64/sys/sigpending.S13
-rw-r--r--lib/libc/arch/mips64/sys/sigprocmask.S13
-rw-r--r--lib/libc/arch/mips64/sys/sigsuspend.S13
29 files changed, 270 insertions, 114 deletions
diff --git a/lib/libc/arch/mips64/SYS.h b/lib/libc/arch/mips64/SYS.h
index 084dff105cf..6893ce6bfd6 100644
--- a/lib/libc/arch/mips64/SYS.h
+++ b/lib/libc/arch/mips64/SYS.h
@@ -29,48 +29,58 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: SYS.h,v 1.2 2004/09/07 13:48:26 pefo Exp $
+ * $OpenBSD: SYS.h,v 1.3 2004/09/09 16:14:02 pefo Exp $
*/
#include <sys/syscall.h>
#include <machine/asm.h>
#ifdef __STDC__
-# define __ENTRY(p,x) ENTRY(p ## x)
+# define __ENTRY(p,x) ENTRY(p ## x)
-# define __DO_SYSCALL(x) \
- li v0,SYS_ ## x; \
- syscall
+# define __DO_SYSCALL(x) \
+ li v0,SYS_ ## x; \
+ syscall
-# define __LEAF2(p,x) LEAF(p ## x) \
- .weak x; x = p ## x;
-# define __END2(p,x) END(p ## x)
-# define __CLABEL2(p,x) _C_LABEL(p ## x)
+# define __LEAF2(p,x,sz) LEAF(p ## x, sz) \
+ .weak x; x = p ## x;
+
+# define __END2(p,x) END(p ## x)
+
+# define __CLABEL2(p,x) _C_LABEL(p ## x)
#else
-# define __ENTRY(p,x) ENTRY(p/**/x)
+# define __ENTRY(p,x) ENTRY(p/**/x)
+
+# define __DO_SYSCALL(x) \
+ li v0,SYS_/**/x; \
+ syscall
+
+# define __LEAF2(p,x,sz) LEAF(p/**/x, sz) \
+ .weak x; x = p/**/x;
-# define __DO_SYSCALL(x) \
- li v0,SYS_/**/x; \
- syscall
+# define __END2(p,x) END(p/**/x)
-# define __LEAF2(p,x) LEAF(p/**/x) \
- .weak x; x = p/**/x;
-# define __END2(p,x) END(p/**/x)
-# define __CLABEL2(p,x) _C_LABEL(p/**/x)
+# define __CLABEL2(p,x) _C_LABEL(p/**/x)
#endif
#define __PSEUDO_NOERROR(p,x,y) \
- __LEAF2(p,x); \
+ __LEAF2(p,x, 0); \
__DO_SYSCALL(y); \
j ra; \
__END2(p,x)
#define __PSEUDO(p,x,y) \
- __LEAF2(p,x); \
+ __LEAF2(p,x,32); \
+ PTR_SUBU sp,32; \
+ SETUP_GP64(16,__CLABEL2(p,x)); \
__DO_SYSCALL(y); \
bne a3,zero,err; \
+ RESTORE_GP64; \
+ PTR_ADDU sp,32; \
j ra; \
err: LA t9,_C_LABEL(cerror); \
+ RESTORE_GP64; \
+ PTR_ADDU sp,32; \
jr t9; \
__END2(p,x)
@@ -79,6 +89,6 @@
#define PSEUDO(x,y) __PSEUDO(_thread_sys_,x,y)
#define PSEUDO_NOERROR(x,y) __PSEUDO_NOERROR(_thread_sys_,x,y)
-#define SYSLEAF(x) __LEAF2(_thread_sys_,x)
+#define SYSLEAF(x, sz) __LEAF2(_thread_sys_,x, sz)
#define SYSEND(x) __END2(_thread_sys_,x)
diff --git a/lib/libc/arch/mips64/gen/_setjmp.S b/lib/libc/arch/mips64/gen/_setjmp.S
index 60a6977df9e..ff40eccc9a4 100644
--- a/lib/libc/arch/mips64/gen/_setjmp.S
+++ b/lib/libc/arch/mips64/gen/_setjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: _setjmp.S,v 1.1 2004/08/11 17:30:59 pefo Exp $ */
+/* $OpenBSD: _setjmp.S,v 1.2 2004/09/09 16:14:02 pefo Exp $ */
/*
* Copyright (c) 2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -35,16 +35,23 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: _setjmp.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: _setjmp.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
/*
* _setjmp, _longjmp (not restoring signal state)
*
* XXX FPSET should probably be taken from SR setting. hmmm...
+ * GPOFF and FRAMESIZE must be the same for both _setjmp and _longjmp!
*
*/
-LEAF(_setjmp)
+
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
+LEAF(_setjmp, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, _setjmp)
.set noreorder
#if defined(__mips64)
dli v0, 0xACEDBADE # sigcontext magic number
@@ -62,7 +69,8 @@ LEAF(_setjmp)
REG_S s7, SC_REGS+S7*REGSZ(a0)
REG_S s8, SC_REGS+S8*REGSZ(a0)
REG_S gp, SC_REGS+GP*REGSZ(a0)
- REG_S sp, SC_REGS+SP*REGSZ(a0)
+ PTR_ADDU v0, sp, FRAMESZ
+ REG_S v0, SC_REGS+SP*REGSZ(a0)
REG_S ra, SC_PC(a0)
cfc1 v0, $31
#if _MIPS_FPSET == 32
@@ -93,15 +101,15 @@ LEAF(_setjmp)
swc1 $f31, SC_FPREGS+((F31-F0)*REGSZ)(a0)
#endif
REG_S v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
j ra
move v0, zero
END(_setjmp)
-LEAF(_longjmp)
-#ifdef ABICALLS
- subu sp, sp, 32
- .cprestore 16
-#endif
+LEAF(_longjmp, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, _longjmp)
.set noreorder
REG_L v0, SC_REGS+ZERO*REGSZ(a0)
bne v0, 0xACEDBADE, botch # jump if error
@@ -146,6 +154,8 @@ LEAF(_longjmp)
lwc1 $f30, SC_FPREGS+((F30-F0)*REGSZ)(a0)
lwc1 $f31, SC_FPREGS+((F31-F0)*REGSZ)(a0)
#endif
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
j ra
move v0, a1
@@ -154,5 +164,7 @@ botch:
nop
jal abort
nop
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
END(_longjmp)
diff --git a/lib/libc/arch/mips64/gen/fabs.S b/lib/libc/arch/mips64/gen/fabs.S
index 31b440ec329..acc5e1d99d5 100644
--- a/lib/libc/arch/mips64/gen/fabs.S
+++ b/lib/libc/arch/mips64/gen/fabs.S
@@ -34,7 +34,7 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: fabs.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: fabs.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
/*
@@ -43,7 +43,7 @@
*
* Return absolute value of x.
*/
-LEAF(fabs)
+LEAF(fabs, 0)
.set noreorder
j ra
abs.d $f0, $f12 # compute absolute value of x
diff --git a/lib/libc/arch/mips64/gen/isinf.S b/lib/libc/arch/mips64/gen/isinf.S
index 439de1efcfc..a17838a017d 100644
--- a/lib/libc/arch/mips64/gen/isinf.S
+++ b/lib/libc/arch/mips64/gen/isinf.S
@@ -34,7 +34,7 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: isinf.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: isinf.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
#define DEXP_INF 0x7ff
@@ -45,7 +45,7 @@
*
* Return true if x is a NAN.
*/
-LEAF(isnan)
+LEAF(isnan, 0)
.set noreorder
mfc1 v1, $f13 # get MSW of x
mfc1 t3, $f12 # get LSW of x
@@ -71,7 +71,7 @@ END(isnan)
*
* Return true if x is infinity.
*/
-LEAF(isinf)
+LEAF(isinf, 0)
.set noreorder
mfc1 v1, $f13 # get MSW of x
mfc1 t3, $f12 # get LSW of x
diff --git a/lib/libc/arch/mips64/gen/ldexp.S b/lib/libc/arch/mips64/gen/ldexp.S
index cbee28cb0a8..49aa7a1768c 100644
--- a/lib/libc/arch/mips64/gen/ldexp.S
+++ b/lib/libc/arch/mips64/gen/ldexp.S
@@ -34,7 +34,7 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: ldexp.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: ldexp.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
#define DEXP_INF 0x7ff
@@ -56,7 +56,7 @@
*
* Return x * (2**N), for integer values N.
*/
-LEAF(ldexp)
+LEAF(ldexp, 0)
.set reorder
mfc1 v1, $f13 # get MSW of x
mfc1 t3, $f12 # get LSW of x
diff --git a/lib/libc/arch/mips64/gen/modf.S b/lib/libc/arch/mips64/gen/modf.S
index 677cdaf2967..d508e62a6c2 100644
--- a/lib/libc/arch/mips64/gen/modf.S
+++ b/lib/libc/arch/mips64/gen/modf.S
@@ -34,7 +34,7 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: modf.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: modf.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
/*
@@ -42,7 +42,7 @@
* double val, *iptr;
* returns: xxx and n (in *iptr) where val == n.xxx
*/
-LEAF(modf)
+LEAF(modf, 0)
.set reorder
cfc1 t0, $31 # get the control register
li.d $f2, 4503599627370496e0 # f2 <- 2^52
diff --git a/lib/libc/arch/mips64/gen/setjmp.S b/lib/libc/arch/mips64/gen/setjmp.S
index 613159bc58c..5b4bdc286dd 100644
--- a/lib/libc/arch/mips64/gen/setjmp.S
+++ b/lib/libc/arch/mips64/gen/setjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: setjmp.S,v 1.2 2004/09/07 13:48:26 pefo Exp $ */
+/* $OpenBSD: setjmp.S,v 1.3 2004/09/09 16:14:02 pefo Exp $ */
/*
* Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -36,7 +36,7 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: setjmp.S,v 1.2 2004/09/07 13:48:26 pefo Exp $"
+ .asciz "$OpenBSD: setjmp.S,v 1.3 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
/*
@@ -45,34 +45,34 @@
*
*/
-#define SETJMP_FRAMESZ (FRAMESZ(CF_SZ) + 6 * REGSZ)
+FRAMESZ= MKFSIZ(2,6)
+A0OFF= FRAMESZ-3*REGSZ
+GPOFF= FRAMESZ-2*REGSZ
+RAOFF= FRAMESZ-1*REGSZ
-NON_LEAF(setjmp, SETJMP_FRAMESZ, ra)
- .mask 0x80000000, (CF_RA_OFFS - FRAMESZ(CF_SZ))
- PTR_SUB sp, sp, SETJMP_FRAMESZ # allocate stack frame
-#ifdef ABICALLS
- .cprestore 16
-#endif
+NON_LEAF(setjmp, FRAMESZ, ra)
+ .mask 0x80000000, RAOFF
+ PTR_SUBU sp, FRAMESZ # allocate stack frame
+ SETUP_GP64(GPOFF, setjmp)
.set reorder
- REG_S ra, CF_RA_OFFS(sp) # save state
- REG_S a0, SETJMP_FRAMESZ-REGSZ(sp)
+ REG_S ra, RAOFF(sp) # save state
+ REG_S a0, A0OFF(sp)
move a0, zero # get current signal mask
jal sigblock
- REG_L v1, SETJMP_FRAMESZ-REGSZ(sp) # v1 = jmpbuf
+ REG_L v1, A0OFF(sp) # v1 = jmpbuf
REG_S v0, SC_MASK(v1) # save sc_mask = sigblock(0)
move a0, zero
- PTR_ADD a1, sp, FRAMESZ(CF_SZ) # pointer to struct sigaltstack
+ PTR_ADD a1, sp, 0 # pointer to struct sigaltstack
jal _thread_sys_sigaltstack
- REG_L a0, SETJMP_FRAMESZ-REGSZ(sp) # restore jmpbuf
- lw v1, FRAMESZ(CF_SZ)+REGSZ+4(sp) # get old ss_onstack
+ REG_L a0, A0OFF(sp) # restore jmpbuf
+ lw v1, REGSZ+4(sp) # get old ss_onstack
and v1, v1, 1 # extract onstack flag
REG_S v1, SC_ONSTACK(a0) # save it in sc_onstack
- REG_L ra, CF_RA_OFFS(sp)
- PTR_ADD sp, sp, SETJMP_FRAMESZ
+ REG_L ra, RAOFF(sp)
blt v0, zero, botch # check for sigstack() error
REG_S ra, SC_PC(a0) # sc_pc = return address
#if defined(__mips64)
@@ -91,7 +91,8 @@ NON_LEAF(setjmp, SETJMP_FRAMESZ, ra)
REG_S s7, SC_REGS+S7*REGSZ(a0)
REG_S s8, SC_REGS+S8*REGSZ(a0)
REG_S gp, SC_REGS+GP*REGSZ(a0)
- REG_S sp, SC_REGS+SP*REGSZ(a0)
+ PTR_ADDU v0, sp, FRAMESZ
+ REG_S v0, SC_REGS+SP*REGSZ(a0)
li v0, 1 # be nice if we could tell
REG_S v0, SC_FPUSED(a0) # sc_fpused = 1
cfc1 v0, $31
@@ -124,19 +125,31 @@ NON_LEAF(setjmp, SETJMP_FRAMESZ, ra)
#endif
REG_S v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)
move v0, zero
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
j ra
+
+botch:
+ jal longjmperror
+ jal abort
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
END(setjmp)
-LEAF(longjmp)
-#ifdef ABICALLS
- PTR_SUB sp, sp, CF_ARGSZ * 2
- .cprestore 16
-#endif
+
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
+LEAF(longjmp, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, longjmp)
.set reorder
REG_S a1, SC_REGS+V0*REGSZ(a0)
li v0, SYS_sigreturn
syscall
-botch:
+
jal longjmperror
jal abort
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
END(longjmp)
diff --git a/lib/libc/arch/mips64/gen/sigsetjmp.S b/lib/libc/arch/mips64/gen/sigsetjmp.S
index 06a842e89f8..c08612c57f6 100644
--- a/lib/libc/arch/mips64/gen/sigsetjmp.S
+++ b/lib/libc/arch/mips64/gen/sigsetjmp.S
@@ -36,30 +36,46 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: sigsetjmp.S,v 1.2 2004/09/07 13:48:26 pefo Exp $"
+ .asciz "$OpenBSD: sigsetjmp.S,v 1.3 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
/*
* trampolines for sigsetjmp and siglongjmp save and restore mask.
*
*/
-LEAF(sigsetjmp)
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
+LEAF(sigsetjmp, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, sigsetjmp)
.set reorder
REG_S a1, (_JBLEN*REGSZ)(a0) # save "savemask"
bne a1, 0x0, 1f # do saving of signal mask?
LA t9, _setjmp
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
jr t9
1: LA t9, setjmp
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
jr t9
END(sigsetjmp)
-LEAF(siglongjmp)
+LEAF(siglongjmp, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, siglongjmp)
.set reorder
REG_L t0, (_JBLEN*REGSZ)(a0) # get "savemask"
bne t0, 0x0, 1f # restore signal mask?
LA t9, _longjmp
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
jr t9
-1: LA t9, longjmp
+1:
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
+ LA t9, longjmp
jr t9
END(siglongjmp)
diff --git a/lib/libc/arch/mips64/net/htonl.S b/lib/libc/arch/mips64/net/htonl.S
index 4d245078cc3..c39f8e879fa 100644
--- a/lib/libc/arch/mips64/net/htonl.S
+++ b/lib/libc/arch/mips64/net/htonl.S
@@ -34,7 +34,7 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: htonl.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: htonl.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
/*
@@ -42,7 +42,7 @@
* hostorder = ntohl(netorder)
*/
ALEAF(ntohl)
-NLEAF(htonl) # a0 = 0x11223344, return 0x44332211
+NLEAF(htonl, 0) # a0 = 0x11223344, return 0x44332211
.set reorder
#ifdef __MIPSEL__
srl v1, a0, 24 # v1 = 0x00000011
diff --git a/lib/libc/arch/mips64/net/htons.S b/lib/libc/arch/mips64/net/htons.S
index ceb537040a0..d6fe102559f 100644
--- a/lib/libc/arch/mips64/net/htons.S
+++ b/lib/libc/arch/mips64/net/htons.S
@@ -34,7 +34,7 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: htons.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: htons.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
/*
@@ -42,7 +42,7 @@
* hostorder = ntohs(netorder)
*/
ALEAF(ntohs)
-NLEAF(htons)
+NLEAF(htons, 0)
.set reorder
#ifdef __MIPSEL__
srl v0, a0, 8
diff --git a/lib/libc/arch/mips64/string/bcmp.S b/lib/libc/arch/mips64/string/bcmp.S
index 77669da2454..fcf8c633ba9 100644
--- a/lib/libc/arch/mips64/string/bcmp.S
+++ b/lib/libc/arch/mips64/string/bcmp.S
@@ -34,12 +34,12 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: bcmp.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: bcmp.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
/* bcmp(s1, s2, n) */
-LEAF(bcmp)
+LEAF(bcmp, 0)
.set noreorder
blt a2, 16, small # is it worth any trouble?
xor v0, a0, a1 # compare low two bits of addresses
diff --git a/lib/libc/arch/mips64/string/bcopy.S b/lib/libc/arch/mips64/string/bcopy.S
index 8d763e5943a..dc24b050532 100644
--- a/lib/libc/arch/mips64/string/bcopy.S
+++ b/lib/libc/arch/mips64/string/bcopy.S
@@ -34,13 +34,13 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: bcopy.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: bcopy.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
/* bcopy(s1, s2, n) */
-LEAF(bcopy)
+LEAF(bcopy, 0)
.set noreorder
addu t0, a0, a2 # t0 = end of s1 region
sltu t1, a1, t0
diff --git a/lib/libc/arch/mips64/string/bzero.S b/lib/libc/arch/mips64/string/bzero.S
index af6ce87e6bb..9a2b37a67b9 100644
--- a/lib/libc/arch/mips64/string/bzero.S
+++ b/lib/libc/arch/mips64/string/bzero.S
@@ -34,12 +34,12 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: bzero.S,v 1.2 2004/08/15 13:53:43 pefo Exp $"
+ .asciz "$OpenBSD: bzero.S,v 1.3 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
/* bzero(s1, n) */
-LEAF(bzero)
+LEAF(bzero, 0)
.set noreorder
blt a1, 12, smallclr # small amount to clear?
subu a3, zero, a0 # compute # bytes to word align address
diff --git a/lib/libc/arch/mips64/string/ffs.S b/lib/libc/arch/mips64/string/ffs.S
index 0c637198b99..1c19e1150b1 100644
--- a/lib/libc/arch/mips64/string/ffs.S
+++ b/lib/libc/arch/mips64/string/ffs.S
@@ -34,12 +34,12 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: ffs.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: ffs.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
/* bit = ffs(value) */
-LEAF(ffs)
+LEAF(ffs, 0)
.set reorder
move v0, zero
beq a0, zero, done
diff --git a/lib/libc/arch/mips64/string/index.S b/lib/libc/arch/mips64/string/index.S
index a90daa35f7c..251bf5b611c 100644
--- a/lib/libc/arch/mips64/string/index.S
+++ b/lib/libc/arch/mips64/string/index.S
@@ -34,15 +34,15 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: index.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: index.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
-LEAF(index)
+LEAF(index, 0)
.set reorder
lbu a2, 0(a0) # get a byte
addu a0, a0, 1
beq a2, a1, fnd
- bne a2, zero, _C_LABEL(index)
+ bne a2, zero, index
notfnd:
move v0, zero
j ra
diff --git a/lib/libc/arch/mips64/string/rindex.S b/lib/libc/arch/mips64/string/rindex.S
index 7eb789a346f..385e290a260 100644
--- a/lib/libc/arch/mips64/string/rindex.S
+++ b/lib/libc/arch/mips64/string/rindex.S
@@ -34,10 +34,10 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: rindex.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: rindex.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
-LEAF(rindex)
+LEAF(rindex, 0)
.set reorder
move v0, zero # default if not found
1:
diff --git a/lib/libc/arch/mips64/string/strcmp.S b/lib/libc/arch/mips64/string/strcmp.S
index a44d496023b..7a14638f663 100644
--- a/lib/libc/arch/mips64/string/strcmp.S
+++ b/lib/libc/arch/mips64/string/strcmp.S
@@ -34,13 +34,13 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: strcmp.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: strcmp.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
/*
* NOTE: this version assumes unsigned chars in order to be "8 bit clean".
*/
-LEAF(strcmp)
+LEAF(strcmp, 0)
.set reorder
1:
lbu t0, 0(a0) # get two bytes and compare them
diff --git a/lib/libc/arch/mips64/string/strlen.S b/lib/libc/arch/mips64/string/strlen.S
index 4ced4768f80..b19171d10d2 100644
--- a/lib/libc/arch/mips64/string/strlen.S
+++ b/lib/libc/arch/mips64/string/strlen.S
@@ -34,10 +34,10 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: strlen.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: strlen.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* LIBC_SCCS */
-LEAF(strlen)
+LEAF(strlen, 0)
.set reorder
addu v1, a0, 1
1:
diff --git a/lib/libc/arch/mips64/sys/Ovfork.S b/lib/libc/arch/mips64/sys/Ovfork.S
index 8688afd9794..22ab7428f09 100644
--- a/lib/libc/arch/mips64/sys/Ovfork.S
+++ b/lib/libc/arch/mips64/sys/Ovfork.S
@@ -34,7 +34,7 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: Ovfork.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: Ovfork.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* SYSLIBC_SCCS */
/*
@@ -44,16 +44,25 @@
* v0 == pid of child in parent, v0 == pid of parent in child.
*/
-SYSLEAF(vfork)
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
+SYSLEAF(vfork, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, vfork)
.set reorder
li v0, SYS_vfork # system call number for vfork
syscall
beq a3, zero, 1f # jump if no errors
la t9, cerror
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
jr t9
1:
beq v1, zero, 2f # parent process ?
move v0, zero # return zero in child
2:
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
j ra
SYSEND(vfork)
diff --git a/lib/libc/arch/mips64/sys/brk.S b/lib/libc/arch/mips64/sys/brk.S
index 6449e49aa72..03796d85851 100644
--- a/lib/libc/arch/mips64/sys/brk.S
+++ b/lib/libc/arch/mips64/sys/brk.S
@@ -34,7 +34,7 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: brk.S,v 1.2 2004/09/07 13:48:27 pefo Exp $"
+ .asciz "$OpenBSD: brk.S,v 1.3 2004/09/09 16:14:02 pefo Exp $"
#endif /* SYSLIBC_SCCS */
.globl minbrk
@@ -44,34 +44,51 @@
minbrk: PTR_VAL _C_LABEL(end)
.text
-LEAF(brk)
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
+LEAF(brk, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, brk)
.set reorder
PTR_L v0, minbrk
- bltu a0, v0, 1f
- LA t9, _brk
- jr t9
-1:
+ bgtu a0, v0, 1f
+
move a0, v0 # dont allow break < minbrk
+1:
li v0, SYS_break
syscall
bne a3, zero, 2f
PTR_S a0, curbrk
move v0, zero
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
j ra
2:
LA t9, _C_LABEL(cerror)
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
jr t9
END(brk)
-LEAF(_brk)
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
+LEAF(_brk, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, brk)
.set reorder
li v0, SYS_break
syscall
bne a3, zero, 1f
PTR_S a0, curbrk
move v0, zero
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
j ra
1:
LA t9, _C_LABEL(cerror)
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
jr t9
END(_brk)
diff --git a/lib/libc/arch/mips64/sys/cerror.S b/lib/libc/arch/mips64/sys/cerror.S
index 394d7e2dada..730e2ec5012 100644
--- a/lib/libc/arch/mips64/sys/cerror.S
+++ b/lib/libc/arch/mips64/sys/cerror.S
@@ -34,14 +34,21 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: cerror.S,v 1.1 2004/08/11 17:30:59 pefo Exp $"
+ .asciz "$OpenBSD: cerror.S,v 1.2 2004/09/09 16:14:02 pefo Exp $"
#endif /* SYSLIBC_SCCS */
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
.globl _C_LABEL(errno)
-LEAF(cerror)
+LEAF(cerror, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, cerror)
.set noreorder
sw v0, _C_LABEL(errno)
li v0, -1
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
j ra
li v1, -1
END(cerror)
diff --git a/lib/libc/arch/mips64/sys/exect.S b/lib/libc/arch/mips64/sys/exect.S
index d5ebb39e073..d7618192950 100644
--- a/lib/libc/arch/mips64/sys/exect.S
+++ b/lib/libc/arch/mips64/sys/exect.S
@@ -34,16 +34,25 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: exect.S,v 1.2 2004/09/07 13:48:27 pefo Exp $"
+ .asciz "$OpenBSD: exect.S,v 1.3 2004/09/09 16:14:02 pefo Exp $"
#endif /* SYSLIBC_SCCS */
-SYSLEAF(exect)
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
+SYSLEAF(exect, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, exect)
.set reorder
li v0, SYS_execve
syscall
bne a3, zero, 1f
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
j ra
1:
LA t9, _C_LABEL(cerror)
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
jr t9
SYSEND(exect)
diff --git a/lib/libc/arch/mips64/sys/fork.S b/lib/libc/arch/mips64/sys/fork.S
index ba682e49bf5..540534c9397 100644
--- a/lib/libc/arch/mips64/sys/fork.S
+++ b/lib/libc/arch/mips64/sys/fork.S
@@ -34,10 +34,15 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: fork.S,v 1.2 2004/09/07 13:48:27 pefo Exp $"
+ .asciz "$OpenBSD: fork.S,v 1.3 2004/09/09 16:14:02 pefo Exp $"
#endif /* SYSLIBC_SCCS */
-SYSLEAF(fork)
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
+SYSLEAF(fork, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, fork)
.set reorder
li v0, SYS_fork # pid = fork()
syscall
@@ -45,8 +50,12 @@ SYSLEAF(fork)
beq v1, zero, 1f # v1 == 0 in parent, 1 in child
move v0, zero
1:
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
j ra
2:
LA t9, _C_LABEL(cerror)
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
jr t9
SYSEND(fork)
diff --git a/lib/libc/arch/mips64/sys/rfork.S b/lib/libc/arch/mips64/sys/rfork.S
index 490f88e3a76..fef95d0d6cb 100644
--- a/lib/libc/arch/mips64/sys/rfork.S
+++ b/lib/libc/arch/mips64/sys/rfork.S
@@ -34,10 +34,15 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: rfork.S,v 1.2 2004/09/07 13:48:27 pefo Exp $"
+ .asciz "$OpenBSD: rfork.S,v 1.3 2004/09/09 16:14:02 pefo Exp $"
#endif /* SYSLIBC_SCCS */
-SYSLEAF(rfork)
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
+SYSLEAF(rfork, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, rfork)
.set reorder
li v0, SYS_rfork # pid = fork()
syscall
@@ -45,8 +50,12 @@ SYSLEAF(rfork)
beq v1, zero, 1f # v1 == 0 in parent, 1 in child
move v0, zero
1:
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
j ra
2:
LA t9, _C_LABEL(cerror)
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
jr t9
SYSEND(rfork)
diff --git a/lib/libc/arch/mips64/sys/sbrk.S b/lib/libc/arch/mips64/sys/sbrk.S
index c5c279eedb9..93660142398 100644
--- a/lib/libc/arch/mips64/sys/sbrk.S
+++ b/lib/libc/arch/mips64/sys/sbrk.S
@@ -34,7 +34,7 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: sbrk.S,v 1.2 2004/09/07 13:48:27 pefo Exp $"
+ .asciz "$OpenBSD: sbrk.S,v 1.3 2004/09/09 16:14:02 pefo Exp $"
#endif /* SYSLIBC_SCCS */
.globl curbrk
@@ -43,7 +43,12 @@
curbrk: PTR_VAL _C_LABEL(end)
.text
-LEAF(sbrk)
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
+LEAF(sbrk, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, sbrk)
.set reorder
PTR_L v1, curbrk
li v0, SYS_break
@@ -53,8 +58,12 @@ LEAF(sbrk)
bne a3, zero, 1f
move v0, v1 # return old val of curbrk from above
PTR_S a0, curbrk # save current val of curbrk from above
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
j ra
1:
LA t9, _C_LABEL(cerror)
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
jr t9
END(sbrk)
diff --git a/lib/libc/arch/mips64/sys/setlogin.S b/lib/libc/arch/mips64/sys/setlogin.S
index 0318a9052b2..c133e7bdf7b 100644
--- a/lib/libc/arch/mips64/sys/setlogin.S
+++ b/lib/libc/arch/mips64/sys/setlogin.S
@@ -35,18 +35,27 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: setlogin.S,v 1.2 2004/09/07 13:48:27 pefo Exp $"
+ .asciz "$OpenBSD: setlogin.S,v 1.3 2004/09/09 16:14:02 pefo Exp $"
#endif /* SYSLIBC_SCCS */
-LEAF(setlogin)
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
+LEAF(setlogin, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, setlogin)
.set reorder
li v0, SYS_setlogin # setlogin(name)
syscall
bne a3, zero, 1f
sw zero, _C_LABEL(__logname_valid) # in getlogin()
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
j ra
1:
LA t9, _C_LABEL(cerror)
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
jr t9
END(setlogin)
diff --git a/lib/libc/arch/mips64/sys/sigpending.S b/lib/libc/arch/mips64/sys/sigpending.S
index 8c9a9897b95..bb25c902f54 100644
--- a/lib/libc/arch/mips64/sys/sigpending.S
+++ b/lib/libc/arch/mips64/sys/sigpending.S
@@ -34,18 +34,27 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: sigpending.S,v 1.2 2004/09/07 13:48:27 pefo Exp $"
+ .asciz "$OpenBSD: sigpending.S,v 1.3 2004/09/09 16:14:02 pefo Exp $"
#endif /* SYSLIBC_SCCS */
-SYSLEAF(sigpending)
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
+SYSLEAF(sigpending, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, sigpending)
.set reorder
li v0, SYS_sigpending # setlogin(name)
syscall
bne a3, zero, 1f
sw v0, 0(a0)
move v0, zero
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
j ra
1:
LA t9, _C_LABEL(cerror)
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
jr t9
SYSEND(sigpending)
diff --git a/lib/libc/arch/mips64/sys/sigprocmask.S b/lib/libc/arch/mips64/sys/sigprocmask.S
index 6e2998b1486..03882329469 100644
--- a/lib/libc/arch/mips64/sys/sigprocmask.S
+++ b/lib/libc/arch/mips64/sys/sigprocmask.S
@@ -34,10 +34,15 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: sigprocmask.S,v 1.2 2004/09/07 13:48:27 pefo Exp $"
+ .asciz "$OpenBSD: sigprocmask.S,v 1.3 2004/09/09 16:14:02 pefo Exp $"
#endif /* SYSLIBC_SCCS */
-SYSLEAF(sigprocmask) # sigprocmask(how, new, old) sigset_t *new, *old;
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
+SYSLEAF(sigprocmask, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, sigprocmask)
.set reorder
bne a1, zero, gotptr # if new sigset pointer not null
li a0, 1 # how = SIG_BLOCK
@@ -52,8 +57,12 @@ doit:
sw v0, 0(a2) # store old mask
out:
move v0, zero
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
j ra
err:
LA t9, _C_LABEL(cerror)
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
jr t9
SYSEND(sigprocmask)
diff --git a/lib/libc/arch/mips64/sys/sigsuspend.S b/lib/libc/arch/mips64/sys/sigsuspend.S
index 5643ce2b073..c714d6086d0 100644
--- a/lib/libc/arch/mips64/sys/sigsuspend.S
+++ b/lib/libc/arch/mips64/sys/sigsuspend.S
@@ -34,18 +34,27 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: sigsuspend.S,v 1.2 2004/09/07 13:48:27 pefo Exp $"
+ .asciz "$OpenBSD: sigsuspend.S,v 1.3 2004/09/09 16:14:02 pefo Exp $"
#endif /* SYSLIBC_SCCS */
-SYSLEAF(sigsuspend)
+FRAMESZ= MKFSIZ(1,1)
+GPOFF= FRAMESZ-2*REGSZ
+
+SYSLEAF(sigsuspend, FRAMESZ)
+ PTR_SUBU sp, FRAMESZ
+ SETUP_GP64(GPOFF, sigsuspend)
.set reorder
lw a0, 0(a0) # indirect to mask arg
li v0, SYS_sigsuspend
syscall
bne a3, zero, 1f
move v0, zero # should not happen
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
j ra
1:
LA t9, _C_LABEL(cerror)
+ RESTORE_GP64
+ PTR_ADDU sp, FRAMESZ
jr t9
SYSEND(sigsuspend)