Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/lib/libc/arch/sparc64 Approved by thorpej:
details: https://anonhg.NetBSD.org/src/rev/8c5c6b40d780
branches: netbsd-1-5
changeset: 488753:8c5c6b40d780
user: mycroft <mycroft%NetBSD.org@localhost>
date: Wed Jul 26 23:54:59 2000 +0000
description:
Approved by thorpej:
Add/fix PIC support, stack biasing, and many other random bugs.
basesrc/lib/libc/arch/sparc64/SYS.h 1.3 -> 1.4
basesrc/lib/libc/arch/sparc64/gen/__sigsetjmp14.S 1.1 -> 1.3
basesrc/lib/libc/arch/sparc64/gen/fabs.S 1.1 -> 1.2
basesrc/lib/libc/arch/sparc64/gen/fixunsdfsi.S 1.2 -> 1.3
basesrc/lib/libc/arch/sparc64/gen/modf.S 1.1 -> 1.2
basesrc/lib/libc/arch/sparc64/gen/saveregs.S 1.1 -> 1.2
basesrc/lib/libc/arch/sparc64/gen/sigsetjmp.S 1.2 -> 1.4
basesrc/lib/libc/arch/sparc64/string/bzero.S 1.3 -> 1.7
basesrc/lib/libc/arch/sparc64/string/ffs.S 1.3 -> 1.4
basesrc/lib/libc/arch/sparc64/sys/brk.S 1.5 -> 1.7
basesrc/lib/libc/arch/sparc64/sys/brk.S 1.8 -> 1.9
basesrc/lib/libc/arch/sparc64/sys/cerror.S 1.2 -> 1.4
basesrc/lib/libc/arch/sparc64/sys/ptrace.S 1.1 -> 1.4
basesrc/lib/libc/arch/sparc64/sys/sbrk.S 1.5 -> 1.6
basesrc/lib/libc/arch/sparc64/sys/setlogin.S 1.1 -> 1.3
basesrc/lib/libc/arch/sparc64/sys/sigprocmask.S 1.5 -> 1.6
diffstat:
lib/libc/arch/sparc64/SYS.h | 4 +-
lib/libc/arch/sparc64/gen/__sigsetjmp14.S | 18 +++---
lib/libc/arch/sparc64/gen/fabs.S | 8 +-
lib/libc/arch/sparc64/gen/fixunsdfsi.S | 73 ++++++++----------------------
lib/libc/arch/sparc64/gen/modf.S | 46 +++++++++---------
lib/libc/arch/sparc64/gen/saveregs.S | 19 ++++---
lib/libc/arch/sparc64/gen/sigsetjmp.S | 45 ++++++++----------
lib/libc/arch/sparc64/string/bzero.S | 45 +++---------------
lib/libc/arch/sparc64/string/ffs.S | 12 ++--
lib/libc/arch/sparc64/sys/brk.S | 6 +-
lib/libc/arch/sparc64/sys/cerror.S | 9 ++-
lib/libc/arch/sparc64/sys/ptrace.S | 17 ++----
lib/libc/arch/sparc64/sys/sbrk.S | 18 ++++---
lib/libc/arch/sparc64/sys/setlogin.S | 20 +++++--
lib/libc/arch/sparc64/sys/sigprocmask.S | 7 +-
15 files changed, 145 insertions(+), 202 deletions(-)
diffs (truncated from 810 to 300 lines):
diff -r efd91933cbbb -r 8c5c6b40d780 lib/libc/arch/sparc64/SYS.h
--- a/lib/libc/arch/sparc64/SYS.h Wed Jul 26 23:45:22 2000 +0000
+++ b/lib/libc/arch/sparc64/SYS.h Wed Jul 26 23:54:59 2000 +0000
@@ -37,7 +37,7 @@
* @(#)SYS.h 8.1 (Berkeley) 6/4/93
*
* from: Header: SYS.h,v 1.2 92/07/03 18:57:00 torek Exp
- * $NetBSD: SYS.h,v 1.2.10.1 2000/07/25 08:54:41 kleink Exp $
+ * $NetBSD: SYS.h,v 1.2.10.2 2000/07/26 23:54:59 mycroft Exp $
*/
#include <machine/asm.h>
@@ -57,7 +57,7 @@
#ifdef PIC
#define ERROR() \
PIC_PROLOGUE(%g1,%g2); \
- ld [%g1+_C_LABEL(__cerror)],%g2; jmp %g2; nop
+ ldx [%g1+_C_LABEL(__cerror)],%g2; jmp %g2; nop
#else
#define ERROR() \
sethi %hi(_C_LABEL(__cerror)),%g1; or %lo(_C_LABEL(__cerror)),%g1,%g1; \
diff -r efd91933cbbb -r 8c5c6b40d780 lib/libc/arch/sparc64/gen/__sigsetjmp14.S
--- a/lib/libc/arch/sparc64/gen/__sigsetjmp14.S Wed Jul 26 23:45:22 2000 +0000
+++ b/lib/libc/arch/sparc64/gen/__sigsetjmp14.S Wed Jul 26 23:54:59 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: __sigsetjmp14.S,v 1.1 1998/10/08 02:27:59 eeh Exp $ */
+/* $NetBSD: __sigsetjmp14.S,v 1.1.10.1 2000/07/26 23:55:00 mycroft Exp $ */
/*
* Copyright (c) 1995 Paul Kranenburg
* All rights reserved.
@@ -35,23 +35,23 @@
#ifdef PIC
ENTRY(__sigsetjmp14)
- PIC_PROLOGUE(%g1,%g2) ! %g1 = _GLOBAL_OFFSET_TABLE
+ PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE
cmp %o1,0
st %o1,[%o0+0x38] ! jmpbuf[JBLEN]
bne,a 1f
- ld [%g1+_C_LABEL(__setjmp14)], %g1 ! if (%o1 != 0) goto _setjmp;
- ld [%g1+_C_LABEL(_setjmp)], %g1 ! else goto __setjmp;
+ ldx [%g1+_C_LABEL(__setjmp14)], %g1 ! if (%o1 != 0) goto _setjmp;
+ ldx [%g1+_C_LABEL(_setjmp)], %g1 ! else goto __setjmp;
1:
jmp %g1
nop
ENTRY(__siglongjmp14)
- PIC_PROLOGUE(%g1,%g2) ! %g1 = _GLOBAL_OFFSET_TABLE
- ld [%o0+0x38],%g2 ! jmpbuf[JBLEN]
- cmp %g2,0
+ PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE
+ ld [%o0+0x38],%o2 ! jmpbuf[JBLEN]
+ cmp %o2,0
bne,a 1f
- ld [%g1+_C_LABEL(__longjmp14)], %g1 ! if (%g2 != 0) goto _longjmp;
- ld [%g1+_C_LABEL(_longjmp)], %g1 ! else goto __longjmp;
+ ldx [%g1+_C_LABEL(__longjmp14)], %g1 ! if (%g2 != 0) goto _longjmp;
+ ldx [%g1+_C_LABEL(_longjmp)], %g1 ! else goto __longjmp;
1:
jmp %g1
nop
diff -r efd91933cbbb -r 8c5c6b40d780 lib/libc/arch/sparc64/gen/fabs.S
--- a/lib/libc/arch/sparc64/gen/fabs.S Wed Jul 26 23:45:22 2000 +0000
+++ b/lib/libc/arch/sparc64/gen/fabs.S Wed Jul 26 23:54:59 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fabs.S,v 1.1 1998/09/11 04:56:22 eeh Exp $ */
+/* $NetBSD: fabs.S,v 1.1.10.1 2000/07/26 23:55:00 mycroft Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -44,7 +44,7 @@
#if 0
.asciz "@(#)fabs.s 8.1 (Berkeley) 6/4/93"
#else
- RCSID("$NetBSD: fabs.S,v 1.1 1998/09/11 04:56:22 eeh Exp $")
+ RCSID("$NetBSD: fabs.S,v 1.1.10.1 2000/07/26 23:55:00 mycroft Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
@@ -52,7 +52,7 @@
ENTRY(fabs)
- stx %o0, [%sp + 32] ! return value => %f0:f1
- ldd [%sp + 32], %f0 ! (via kernel %o0/%o1 slot)
+ stx %o0, [%sp + BIAS + 32] ! return value => %f0:f1
+ ldd [%sp + BIAS + 32], %f0 ! (via kernel %o0/%o1 slot)
retl
fabss %f0, %f0 ! return absolute value
diff -r efd91933cbbb -r 8c5c6b40d780 lib/libc/arch/sparc64/gen/fixunsdfsi.S
--- a/lib/libc/arch/sparc64/gen/fixunsdfsi.S Wed Jul 26 23:45:22 2000 +0000
+++ b/lib/libc/arch/sparc64/gen/fixunsdfsi.S Wed Jul 26 23:54:59 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fixunsdfsi.S,v 1.2 1999/04/04 21:01:39 eeh Exp $ */
+/* $NetBSD: fixunsdfsi.S,v 1.2.8.1 2000/07/26 23:55:00 mycroft Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -46,7 +46,7 @@
#if 0
.asciz "@(#)fixunsdfsi.s 8.1 (Berkeley) 6/4/93"
#else
- RCSID("$NetBSD: fixunsdfsi.S,v 1.2 1999/04/04 21:01:39 eeh Exp $")
+ RCSID("$NetBSD: fixunsdfsi.S,v 1.2.8.1 2000/07/26 23:55:00 mycroft Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
@@ -60,13 +60,15 @@
.align 8
Lbig:
- .word 0x41e00000 ! .double 0r2147483648.0e+00
+ .word 0x43e00000 ! .double 2^63
.word 0 ! (who me, not trust the assembler?)
-ENTRY(__fixunsdfsi)
- sub %sp, 8, %sp
- stx %o0, [%sp + 64 + BIAS] ! get argument into fpu reg
- ldd [%sp + 64 + BIAS], %f0
+/*
+ * Same as above but to unsigned long
+ */
+ENTRY(__dtoul)
+ sub %sp, 16, %sp
+ std %f2, [%sp + 64 + BIAS + 8]
#ifdef PIC
PICCY_SET(Lbig, %g1, %o0)
ldd [%g1], %f2
@@ -74,64 +76,29 @@
sethi %hi(Lbig), %g1
ldd [%g1 + %lo(Lbig)], %f2
#endif
- fcmped %f0, %f2 ! d < 2^31, or NaN, or -Inf?
+ fcmped %f0, %f2 ! d < 2^63, or NaN, or -Inf?
nop ! (fpop2 delay)
fbul,a 1f ! if so, use fdtoi to convert to int
- fdtoi %f0, %f0 ! (this includes negatives!)
+ fdtox %f0, %f0 ! (this includes negatives!)
- ! d does not fit in an int, so subtract 2^31, convert,
- ! and add 2^31 again (sigh). Just hope the intermediate
+ ! d does not fit in an int, so subtract 2^63, convert,
+ ! and add 2^63 again (sigh). Just hope the intermediate
! fits (if not, the result is undefined anyway).
- fsubd %f0, %f2, %f0 ! d -= 2^31
- fdtoi %f0, %f0 ! convert to int
- st %f0, [%sp + 64 + BIAS] ! move into return reg
- ld [%sp + 64 + BIAS], %o0
- sethi %hi(0x80000000), %o1
- add %o0, %o1, %o0 ! add 2^31
- retl
- add %sp, 8, %sp
-
-1:
- st %f0, [%sp + 64 + BIAS] ! return result
- ld [%sp + 64 + BIAS], %o0
- retl
- add %sp, 8, %sp
-
-/*
- * Same as above but to unsigned long
- */
-ENTRY(__dtoul)
- sub %sp, 8, %sp
- stx %o0, [%sp + 64 + BIAS] ! get argument into fpu reg
- ldd [%sp + 64 + BIAS], %f0
-#ifdef PIC
- PICCY_SET(Lbig, %g1, %o0)
- ldd [%g1], %f2
-#else
- sethi %hi(Lbig), %g1
- ldd [%g1 + %lo(Lbig)], %f2
-#endif
- fcmped %f0, %f2 ! d < 2^31, or NaN, or -Inf?
- nop ! (fpop2 delay)
- fbul,a 1f ! if so, use fdtoi to convert to int
- fdtox %f0, %f0 ! (this includes negatives!)
-
- ! d does not fit in an int, so subtract 2^31, convert,
- ! and add 2^31 again (sigh). Just hope the intermediate
- ! fits (if not, the result is undefined anyway).
-
- fsubd %f0, %f2, %f0 ! d -= 2^31
+ fsubd %f0, %f2, %f0 ! d -= 2^63
fdtox %f0, %f0 ! convert to int
std %f0, [%sp + 64 + BIAS] ! move into return reg
ldx [%sp + 64 + BIAS], %o0
sethi %hi(0x80000000), %o1
- add %o0, %o1, %o0 ! add 2^31
+ sllx %o1, 32, %o1
+ add %o0, %o1, %o0 ! add 2^63
+ ldd [%sp + 64 + BIAS + 8], %f2
retl
- add %sp, 8, %sp
+ add %sp, 16, %sp
1:
std %f0, [%sp + 64 + BIAS] ! return result
ldx [%sp + 64 + BIAS], %o0
+ ldd [%sp + 64 + BIAS + 8], %f2
retl
- add %sp, 8, %sp
+ add %sp, 16, %sp
diff -r efd91933cbbb -r 8c5c6b40d780 lib/libc/arch/sparc64/gen/modf.S
--- a/lib/libc/arch/sparc64/gen/modf.S Wed Jul 26 23:45:22 2000 +0000
+++ b/lib/libc/arch/sparc64/gen/modf.S Wed Jul 26 23:54:59 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: modf.S,v 1.1 1998/09/11 04:56:28 eeh Exp $ */
+/* $NetBSD: modf.S,v 1.1.10.1 2000/07/26 23:55:00 mycroft Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -44,7 +44,7 @@
#if 0
.asciz "@(#)modf.s 8.1 (Berkeley) 6/4/93"
#else
- RCSID("$NetBSD: modf.S,v 1.1 1998/09/11 04:56:28 eeh Exp $")
+ RCSID("$NetBSD: modf.S,v 1.1.10.1 2000/07/26 23:55:00 mycroft Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
@@ -75,9 +75,9 @@
* various aspects.
*
* Stack usage:
- * 4@[%fp - 4] saved %fsr
- * 4@[%fp - 8] new %fsr with rounding set to `towards 0'
- * 8@[%fp - 16] space for moving between %i and %f registers
+ * 4@[%fp + BIAS - 4] saved %fsr
+ * 4@[%fp + BIAS - 8] new %fsr with rounding set to `towards 0'
+ * 8@[%fp + BIAS - 16] space for moving between %i and %f registers
* Register usage:
* %i0%i1 double val;
* %l0 scratch
@@ -97,7 +97,7 @@
.word 0
ENTRY(modf)
- save %sp, -64-16, %sp
+ save %sp, -CC64FSZ-16, %sp
/*
* First, compute v = abs(val) by clearing sign bit,
@@ -106,7 +106,7 @@
*/
sethi %hi(0x80000000), %l1 ! sign bit
andn %i0, %l1, %l0
- st %l0, [%fp - 16]
+ st %l0, [%fp + BIAS - 16]
#ifdef PIC
PICCY_SET(Lmagic, %l0, %o7)
ldd [%l0], %f2
@@ -114,8 +114,8 @@
sethi %hi(Lmagic), %l0
ldd [%l0 + %lo(Lmagic)], %f2
#endif
- st %i1, [%fp - 12]
- ldd [%fp - 16], %f4 ! %f4:f5 = v
+ st %i1, [%fp + BIAS - 12]
+ ldd [%fp + BIAS - 16], %f4 ! %f4:f5 = v
/*
* Is %f4:f5 >= %f2:f3 ? If so, it is all integer bits.
@@ -132,15 +132,15 @@
* traps enabled, but change the rounding mode. This might
* not be so good. Oh well....
*/
- st %fsr, [%fp - 4] ! %l5 = current FSR mode
+ st %fsr, [%fp + BIAS - 4] ! %l5 = current FSR mode
set FSR_RD, %l3 ! %l3 = rounding direction mask
- ld [%fp - 4], %l5
+ ld [%fp + BIAS - 4], %l5
set FSR_RD_RZ << FSR_RD_SHIFT, %l4
andn %l5, %l3, %l6
or %l6, %l4, %l6 ! round towards zero, please
and %l5, %l3, %l5 ! save original rounding mode
- st %l6, [%fp - 8]
- ld [%fp - 8], %fsr
+ st %l6, [%fp + BIAS - 8]
+ ld [%fp + BIAS - 8], %fsr
faddd %f4, %f2, %f4 ! %f4:f5 += 2^52
fsubd %f4, %f2, %f4 ! %f4:f5 -= 2^52
@@ -148,12 +148,12 @@
/*
* Restore %fsr, but leave exceptions accrued.
*/
- st %fsr, [%fp - 4]
- ld [%fp - 4], %l6
+ st %fsr, [%fp + BIAS - 4]
+ ld [%fp + BIAS - 4], %l6
andn %l6, %l3, %l6 ! %l6 = %fsr & ~FSR_RD;
or %l5, %l6, %l5 ! %l5 |= %l6;
- st %l5, [%fp - 4]
- ld [%fp - 4], %fsr ! restore %fsr, leaving accrued stuff
+ st %l5, [%fp + BIAS - 4]
+ ld [%fp + BIAS - 4], %fsr ! restore %fsr, leaving accrued stuff
Home |
Main Index |
Thread Index |
Old Index