CVS commit: src/lib/libc/arch/i386/gen

2014-05-22 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Fri May 23 03:05:56 UTC 2014

Modified Files:
src/lib/libc/arch/i386/gen: setjmp.S

Log Message:
Fix previous.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/arch/i386/gen/setjmp.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/i386/gen/setjmp.S
diff -u src/lib/libc/arch/i386/gen/setjmp.S:1.16 src/lib/libc/arch/i386/gen/setjmp.S:1.17
--- src/lib/libc/arch/i386/gen/setjmp.S:1.16	Fri May 23 02:34:19 2014
+++ src/lib/libc/arch/i386/gen/setjmp.S	Fri May 23 03:05:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: setjmp.S,v 1.16 2014/05/23 02:34:19 uebayasi Exp $	*/
+/*	$NetBSD: setjmp.S,v 1.17 2014/05/23 03:05:56 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -36,7 +36,7 @@
 
 #include 
 #if defined(LIBC_SCCS)
-	RCSID("$NetBSD: setjmp.S,v 1.16 2014/05/23 02:34:19 uebayasi Exp $")
+	RCSID("$NetBSD: setjmp.S,v 1.17 2014/05/23 03:05:56 uebayasi Exp $")
 #endif
 
 /*
@@ -76,6 +76,7 @@ ENTRY(__setjmp14)
 
 	xorl	%eax,%eax
 	ret
+END(__setjmp14)
 
 ENTRY(__longjmp14)
 	/* Restore the signal mask. */
@@ -107,4 +108,4 @@ ENTRY(__longjmp14)
 	incl	%eax
 1:	movl	%ecx,0(%esp)
 	ret
-END(__setjmp14)
+END(__longjmp14)



CVS commit: src/lib/libc/arch/i386/gen

2012-08-31 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Fri Aug 31 20:57:24 UTC 2012

Modified Files:
src/lib/libc/arch/i386/gen: _lwp.c

Log Message:
Align the stack to a 16-byte boundary on LWP creation.
This is more than required by the ABI, but it makes programs using SSE
in a thread work without extra compiler flags or performance hit.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/arch/i386/gen/_lwp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/i386/gen/_lwp.c
diff -u src/lib/libc/arch/i386/gen/_lwp.c:1.7 src/lib/libc/arch/i386/gen/_lwp.c:1.8
--- src/lib/libc/arch/i386/gen/_lwp.c:1.7	Thu Feb 24 04:28:42 2011
+++ src/lib/libc/arch/i386/gen/_lwp.c	Fri Aug 31 20:57:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: _lwp.c,v 1.7 2011/02/24 04:28:42 joerg Exp $	*/
+/*	$NetBSD: _lwp.c,v 1.8 2012/08/31 20:57:24 drochner Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _lwp.c,v 1.7 2011/02/24 04:28:42 joerg Exp $");
+__RCSID("$NetBSD: _lwp.c,v 1.8 2012/08/31 20:57:24 drochner Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -56,9 +56,9 @@ _lwp_makecontext(ucontext_t *u, void (*s
 	/* LINTED uintptr_t is safe */
 	u->uc_mcontext.__gregs[_REG_EIP] = (uintptr_t)start;
 	
-	/* Align to a word */
+	/* Align to a 16-byte boundary for SSE */
 	/* LINTED uintptr_t is safe */
-	sp = (void **) ((uintptr_t)(stack_base + stack_size) & ~0x3);
+	sp = (void **) (((uintptr_t)(stack_base + stack_size - 4) & ~0xf) + 4);
 	
 	*--sp = arg;
 	*--sp = (void *) _lwp_exit;



CVS commit: src/lib/libc/arch/i386/gen

2011-09-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 30 23:45:41 UTC 2011

Modified Files:
src/lib/libc/arch/i386/gen: fpsetround.S

Log Message:
don't use %edi!


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/i386/gen/fpsetround.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/i386/gen/fpsetround.S
diff -u src/lib/libc/arch/i386/gen/fpsetround.S:1.4 src/lib/libc/arch/i386/gen/fpsetround.S:1.5
--- src/lib/libc/arch/i386/gen/fpsetround.S:1.4	Fri Sep 30 19:42:00 2011
+++ src/lib/libc/arch/i386/gen/fpsetround.S	Fri Sep 30 19:45:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetround.S,v 1.4 2011/09/30 23:42:00 christos Exp $	*/
+/*	$NetBSD: fpsetround.S,v 1.5 2011/09/30 23:45:41 christos Exp $	*/
 
 /*
  * Written by Frank van der Linden at Wasabi Systems for NetBSD.
@@ -25,8 +25,8 @@ ENTRY(fpsetround)
 	movl	%edx, %eax
 	andl	$0x0c00, %eax	
 	andl	$0xf3ff, %edx
-	movl	4(%esp), %edi
-	orl	%edi, %edx
+	movl	4(%esp), %ecx
+	orl	%ecx, %edx
 	movl	%edx, -4(%esp)
 	fldcw	-4(%esp)
 



CVS commit: src/lib/libc/arch/i386/gen

2011-09-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 30 23:42:01 UTC 2011

Modified Files:
src/lib/libc/arch/i386/gen: flt_rounds.S fpgetround.S fpsetround.S

Log Message:
make rounding work


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/arch/i386/gen/flt_rounds.S
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/i386/gen/fpgetround.S
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/i386/gen/fpsetround.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/i386/gen/flt_rounds.S
diff -u src/lib/libc/arch/i386/gen/flt_rounds.S:1.8 src/lib/libc/arch/i386/gen/flt_rounds.S:1.9
--- src/lib/libc/arch/i386/gen/flt_rounds.S:1.8	Thu Sep 29 18:53:13 2011
+++ src/lib/libc/arch/i386/gen/flt_rounds.S	Fri Sep 30 19:42:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: flt_rounds.S,v 1.8 2011/09/29 22:53:13 christos Exp $	*/
+/*	$NetBSD: flt_rounds.S,v 1.9 2011/09/30 23:42:00 christos Exp $	*/
 
 #include 
 
@@ -12,8 +12,10 @@
 	_ALIGN_TEXT
 ENTRY(__flt_rounds)
 	fnstcw	-4(%esp)
-	movl	-4(%esp), %eax
-	shrl	$10, %eax
+	movl	-4(%esp), %ecx
+	shrl	$9, %ecx
+	andl	$6, %ecx
+	movl	$0x2d, %eax	/* 0x2d = 00.10.11.01 */
+	sarl	%cl, %eax	/* 0,1,2,3 -> 1,3,2,0 */
 	andl	$3, %eax
-	xorl	$1, %eax	/* map 0,1,2,3 -> 1,0,3,2 */
 	ret

Index: src/lib/libc/arch/i386/gen/fpgetround.S
diff -u src/lib/libc/arch/i386/gen/fpgetround.S:1.5 src/lib/libc/arch/i386/gen/fpgetround.S:1.6
--- src/lib/libc/arch/i386/gen/fpgetround.S:1.5	Sun Jan 13 16:45:43 2002
+++ src/lib/libc/arch/i386/gen/fpgetround.S	Fri Sep 30 19:42:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpgetround.S,v 1.5 2002/01/13 21:45:43 thorpej Exp $	*/
+/*	$NetBSD: fpgetround.S,v 1.6 2011/09/30 23:42:00 christos Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 4, 1995
@@ -7,16 +7,17 @@
 
 #include 
 
+/*
+ * XXX load only x87 state.
+ */
+
 #ifdef WEAK_ALIAS
 WEAK_ALIAS(fpgetround, _fpgetround)
 ENTRY(_fpgetround)
 #else
 ENTRY(fpgetround)
 #endif
-	subl $4,%esp
-	fnstcw (%esp)
-	movl (%esp),%eax
-	rorl $10,%eax
-	andl $3,%eax
-	addl $4,%esp
+	fnstcw -4(%esp)
+	movl -4(%esp), %eax
+	andl $0x0c00, %eax
 	ret

Index: src/lib/libc/arch/i386/gen/fpsetround.S
diff -u src/lib/libc/arch/i386/gen/fpsetround.S:1.3 src/lib/libc/arch/i386/gen/fpsetround.S:1.4
--- src/lib/libc/arch/i386/gen/fpsetround.S:1.3	Sun Jan 13 16:45:43 2002
+++ src/lib/libc/arch/i386/gen/fpsetround.S	Fri Sep 30 19:42:00 2011
@@ -1,34 +1,33 @@
-/*	$NetBSD: fpsetround.S,v 1.3 2002/01/13 21:45:43 thorpej Exp $	*/
+/*	$NetBSD: fpsetround.S,v 1.4 2011/09/30 23:42:00 christos Exp $	*/
 
 /*
- * Written by Charles M. Hannum, Apr 9, 1995
+ * Written by Frank van der Linden at Wasabi Systems for NetBSD.
  * Public domain.
  */
 
 #include 
 
+/*
+ * XXX set both the x87 control word
+ * Applications should only set exception and round flags
+ */ 
+
+
 #ifdef WEAK_ALIAS
 WEAK_ALIAS(fpsetround, _fpsetround)
 ENTRY(_fpsetround)
 #else
 ENTRY(fpsetround)
 #endif
-	subl $4,%esp
-
-	fnstcw (%esp)
-	movl (%esp),%eax
 
-	rorl $10,%eax
-	movl %eax,%edx
-	andl $3,%eax
-
-	subl %eax,%edx
-	movl 8(%esp),%ecx
-	andl $3,%ecx
-	orl %ecx,%edx
-	roll $10,%edx
-	movl %edx,(%esp)
-	fldcw (%esp)
+	fnstcw	-4(%esp)
+	movl	-4(%esp), %edx
+	movl	%edx, %eax
+	andl	$0x0c00, %eax	
+	andl	$0xf3ff, %edx
+	movl	4(%esp), %edi
+	orl	%edi, %edx
+	movl	%edx, -4(%esp)
+	fldcw	-4(%esp)
 
-	addl $4,%esp
 	ret



CVS commit: src/lib/libc/arch/i386/gen

2011-09-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 29 22:53:13 UTC 2011

Modified Files:
src/lib/libc/arch/i386/gen: flt_rounds.S

Log Message:
even shorter


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/arch/i386/gen/flt_rounds.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/i386/gen/flt_rounds.S
diff -u src/lib/libc/arch/i386/gen/flt_rounds.S:1.7 src/lib/libc/arch/i386/gen/flt_rounds.S:1.8
--- src/lib/libc/arch/i386/gen/flt_rounds.S:1.7	Thu Sep 29 18:46:00 2011
+++ src/lib/libc/arch/i386/gen/flt_rounds.S	Thu Sep 29 18:53:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: flt_rounds.S,v 1.7 2011/09/29 22:46:00 christos Exp $	*/
+/*	$NetBSD: flt_rounds.S,v 1.8 2011/09/29 22:53:13 christos Exp $	*/
 
 #include 
 
@@ -12,9 +12,8 @@
 	_ALIGN_TEXT
 ENTRY(__flt_rounds)
 	fnstcw	-4(%esp)
-	movl	-4(%esp), %ecx
-	shrl	$9, %ecx
-	andl	$6, %ecx
-	xorl	$1, %eax	/* map 0,1,2,3 -> 1,0,3,2 */
+	movl	-4(%esp), %eax
+	shrl	$10, %eax
 	andl	$3, %eax
+	xorl	$1, %eax	/* map 0,1,2,3 -> 1,0,3,2 */
 	ret



CVS commit: src/lib/libc/arch/i386/gen

2011-09-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 29 22:46:00 UTC 2011

Modified Files:
src/lib/libc/arch/i386/gen: flt_rounds.S

Log Message:
add a simpler version


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/i386/gen/flt_rounds.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/i386/gen/flt_rounds.S
diff -u src/lib/libc/arch/i386/gen/flt_rounds.S:1.6 src/lib/libc/arch/i386/gen/flt_rounds.S:1.7
--- src/lib/libc/arch/i386/gen/flt_rounds.S:1.6	Mon Aug 23 04:45:09 1999
+++ src/lib/libc/arch/i386/gen/flt_rounds.S	Thu Sep 29 18:46:00 2011
@@ -1,33 +1,20 @@
-/*	$NetBSD: flt_rounds.S,v 1.6 1999/08/23 08:45:09 kleink Exp $	*/
-
-/*
- * Written by J.T. Conklin, Apr 4, 1995
- * Public domain.
- */
+/*	$NetBSD: flt_rounds.S,v 1.7 2011/09/29 22:46:00 christos Exp $	*/
 
 #include 
 
+/*
+ * 00 0 round to zero 
+ * 01 1 round to nearest
+ * 10 2 round to positive infinity
+ * 11 3 round to negative infinity
+ */
 	.text
 	_ALIGN_TEXT
-_map:
-	.byte 1		/* round to nearest */
-	.byte 3		/* round to negative infinity */
-	.byte 2		/* round to positive infinity */
-	.byte 0		/* round to zero */
-
 ENTRY(__flt_rounds)
-	subl $4,%esp
-	fnstcw (%esp)
-	movl (%esp),%eax
-	shrl $10,%eax
-	andl $3,%eax
-#ifdef PIC
-	PIC_PROLOGUE
-	leal PIC_GOTOFF(_map),%ecx
-	PIC_EPILOGUE
-	movb (%ecx,%eax,1),%al
-#else
-	movb _map(,%eax,1),%al
-#endif
-	addl $4,%esp
+	fnstcw	-4(%esp)
+	movl	-4(%esp), %ecx
+	shrl	$9, %ecx
+	andl	$6, %ecx
+	xorl	$1, %eax	/* map 0,1,2,3 -> 1,0,3,2 */
+	andl	$3, %eax
 	ret



CVS commit: src/lib/libc/arch/i386/gen

2011-05-22 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun May 22 20:11:47 UTC 2011

Modified Files:
src/lib/libc/arch/i386/gen: fixunsdfsi.S

Log Message:
Use a plain float constant, no need to deal with messy 0r prefix


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/arch/i386/gen/fixunsdfsi.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/i386/gen/fixunsdfsi.S
diff -u src/lib/libc/arch/i386/gen/fixunsdfsi.S:1.11 src/lib/libc/arch/i386/gen/fixunsdfsi.S:1.12
--- src/lib/libc/arch/i386/gen/fixunsdfsi.S:1.11	Thu Aug  7 16:42:07 2003
+++ src/lib/libc/arch/i386/gen/fixunsdfsi.S	Sun May 22 20:11:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fixunsdfsi.S,v 1.11 2003/08/07 16:42:07 agc Exp $	*/
+/*	$NetBSD: fixunsdfsi.S,v 1.12 2011/05/22 20:11:47 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -36,7 +36,7 @@
 
 #include 
 #if defined(LIBC_SCCS)
-	RCSID("$NetBSD: fixunsdfsi.S,v 1.11 2003/08/07 16:42:07 agc Exp $")
+	RCSID("$NetBSD: fixunsdfsi.S,v 1.12 2011/05/22 20:11:47 joerg Exp $")
 #endif
 
 ENTRY(__fixunsdfsi)
@@ -72,4 +72,4 @@
 	orl	$0x8000,%eax	/* restore bias */
 	ret
 
-fbiggestsigned:	.double	0r2147483648.0
+fbiggestsigned:	.double	2147483648.0



CVS commit: src/lib/libc/arch/i386/gen

2011-04-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr  6 21:55:36 UTC 2011

Modified Files:
src/lib/libc/arch/i386/gen: infinityl.c

Log Message:
fix long double infinity.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/i386/gen/infinityl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/i386/gen/infinityl.c
diff -u src/lib/libc/arch/i386/gen/infinityl.c:1.2 src/lib/libc/arch/i386/gen/infinityl.c:1.3
--- src/lib/libc/arch/i386/gen/infinityl.c:1.2	Sun Jun 12 01:21:26 2005
+++ src/lib/libc/arch/i386/gen/infinityl.c	Wed Apr  6 17:55:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: infinityl.c,v 1.2 2005/06/12 05:21:26 lukem Exp $	*/
+/*	$NetBSD: infinityl.c,v 1.3 2011/04/06 21:55:36 christos Exp $	*/
 
 /*
  * IEEE-compatible infinityl.c for little-endian 80-bit format -- public domain.
@@ -7,10 +7,10 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: infinityl.c,v 1.2 2005/06/12 05:21:26 lukem Exp $");
+__RCSID("$NetBSD: infinityl.c,v 1.3 2011/04/06 21:55:36 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
 
 const union __long_double_u __infinityl =
-	{ { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0 } };
+	{ { 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0x7f, 0, 0 } };