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

2012-03-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Mar 17 21:35:06 UTC 2012

Modified Files:
src/lib/libc/arch/sparc64/gen: flt_rounds.c fpgetmask.c fpgetround.c
fpgetsticky.c fpsetmask.c fpsetround.c fpsetsticky.c longjmp.c
makecontext.c

Log Message:
delint


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/sparc64/gen/flt_rounds.c \
src/lib/libc/arch/sparc64/gen/fpgetmask.c \
src/lib/libc/arch/sparc64/gen/fpgetround.c \
src/lib/libc/arch/sparc64/gen/fpsetround.c \
src/lib/libc/arch/sparc64/gen/makecontext.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/sparc64/gen/fpgetsticky.c \
src/lib/libc/arch/sparc64/gen/fpsetmask.c \
src/lib/libc/arch/sparc64/gen/fpsetsticky.c
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/sparc64/gen/longjmp.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/sparc64/gen/flt_rounds.c
diff -u src/lib/libc/arch/sparc64/gen/flt_rounds.c:1.4 src/lib/libc/arch/sparc64/gen/flt_rounds.c:1.5
--- src/lib/libc/arch/sparc64/gen/flt_rounds.c:1.4	Sat Dec 24 23:10:08 2005
+++ src/lib/libc/arch/sparc64/gen/flt_rounds.c	Sat Mar 17 21:35:06 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: flt_rounds.c,v 1.4 2005/12/24 23:10:08 perry Exp $	*/
+/*	$NetBSD: flt_rounds.c,v 1.5 2012/03/17 21:35:06 martin Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 10, 1995
@@ -7,7 +7,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: flt_rounds.c,v 1.4 2005/12/24 23:10:08 perry Exp $");
+__RCSID("$NetBSD: flt_rounds.c,v 1.5 2012/03/17 21:35:06 martin Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -23,7 +23,7 @@ static const int map[] = {
 int
 __flt_rounds()
 {
-	int x;
+	uint32_t x;
 
 	__asm("st %%fsr,%0" : "=m" (*&x));
 	return map[(x >> 30) & 0x03];
Index: src/lib/libc/arch/sparc64/gen/fpgetmask.c
diff -u src/lib/libc/arch/sparc64/gen/fpgetmask.c:1.4 src/lib/libc/arch/sparc64/gen/fpgetmask.c:1.5
--- src/lib/libc/arch/sparc64/gen/fpgetmask.c:1.4	Sat Dec 24 23:10:08 2005
+++ src/lib/libc/arch/sparc64/gen/fpgetmask.c	Sat Mar 17 21:35:06 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpgetmask.c,v 1.4 2005/12/24 23:10:08 perry Exp $	*/
+/*	$NetBSD: fpgetmask.c,v 1.5 2012/03/17 21:35:06 martin Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 10, 1995
@@ -7,11 +7,12 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpgetmask.c,v 1.4 2005/12/24 23:10:08 perry Exp $");
+__RCSID("$NetBSD: fpgetmask.c,v 1.5 2012/03/17 21:35:06 martin Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
 
+#include 
 #include 
 
 #ifdef __weak_alias
@@ -21,7 +22,7 @@ __weak_alias(fpgetmask,_fpgetmask)
 fp_except
 fpgetmask()
 {
-	int x;
+	uint32_t x;
 
 	__asm("st %%fsr,%0" : "=m" (*&x));
 	return (x >> 23) & 0x1f;
Index: src/lib/libc/arch/sparc64/gen/fpgetround.c
diff -u src/lib/libc/arch/sparc64/gen/fpgetround.c:1.4 src/lib/libc/arch/sparc64/gen/fpgetround.c:1.5
--- src/lib/libc/arch/sparc64/gen/fpgetround.c:1.4	Sat Dec 24 23:10:08 2005
+++ src/lib/libc/arch/sparc64/gen/fpgetround.c	Sat Mar 17 21:35:06 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpgetround.c,v 1.4 2005/12/24 23:10:08 perry Exp $	*/
+/*	$NetBSD: fpgetround.c,v 1.5 2012/03/17 21:35:06 martin Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 10, 1995
@@ -7,11 +7,12 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpgetround.c,v 1.4 2005/12/24 23:10:08 perry Exp $");
+__RCSID("$NetBSD: fpgetround.c,v 1.5 2012/03/17 21:35:06 martin Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
 
+#include 
 #include 
 
 #ifdef __weak_alias
@@ -21,7 +22,7 @@ __weak_alias(fpgetround,_fpgetround)
 fp_rnd
 fpgetround()
 {
-	int x;
+	uint32_t x;
 
 	__asm("st %%fsr,%0" : "=m" (*&x));
 	return (x >> 30) & 0x03;
Index: src/lib/libc/arch/sparc64/gen/fpsetround.c
diff -u src/lib/libc/arch/sparc64/gen/fpsetround.c:1.4 src/lib/libc/arch/sparc64/gen/fpsetround.c:1.5
--- src/lib/libc/arch/sparc64/gen/fpsetround.c:1.4	Sat Dec 24 23:10:08 2005
+++ src/lib/libc/arch/sparc64/gen/fpsetround.c	Sat Mar 17 21:35:06 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetround.c,v 1.4 2005/12/24 23:10:08 perry Exp $	*/
+/*	$NetBSD: fpsetround.c,v 1.5 2012/03/17 21:35:06 martin Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 10, 1995
@@ -7,11 +7,12 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetround.c,v 1.4 2005/12/24 23:10:08 perry Exp $");
+__RCSID("$NetBSD: fpsetround.c,v 1.5 2012/03/17 21:35:06 martin Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
 
+#include 
 #include 
 
 #ifdef __weak_alias
@@ -33,5 +34,5 @@ fpsetround(rnd_dir)
 
 	__asm("ld %0,%%fsr" : : "m" (*&new));
 
-	return (old >> 30) & 0x03;
+	return ((uint32_t)old >> 30) & 0x03;
 }
Index: src/lib/libc/arch/sparc64/gen/makecontext.c
diff -u src/lib/libc/arch/sparc64/gen/makecontext.c:1.4 src/lib/libc/arch/sparc64/

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

2011-04-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 27 21:08:48 UTC 2011

Modified Files:
src/lib/libc/arch/sparc64/gen: longjmp.c setjmp.S sigsetjmp.S

Log Message:
Fix offsets used in the assembly code to save global registers into a
jmp_buf, add a compile time assert to catch this kind of divergence
in the C code.
Move the fixed "%npc = %pc + 4" computation to longjmp, this frees
the sigcontext sc_npc value. Use this space to save the savemask
for siglongjmp (we have run out of space behind the globals).
Fixes the tests/lib/libc/setjmp/t_threadjmp tests, and also hopefully
fixes PR port-sparc64/44902.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/sparc64/gen/longjmp.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/arch/sparc64/gen/setjmp.S
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/arch/sparc64/gen/sigsetjmp.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/sparc64/gen/longjmp.c
diff -u src/lib/libc/arch/sparc64/gen/longjmp.c:1.2 src/lib/libc/arch/sparc64/gen/longjmp.c:1.3
--- src/lib/libc/arch/sparc64/gen/longjmp.c:1.2	Mon Apr 28 20:22:57 2008
+++ src/lib/libc/arch/sparc64/gen/longjmp.c	Wed Apr 27 21:08:48 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: longjmp.c,v 1.2 2008/04/28 20:22:57 martin Exp $	*/
+/*	$NetBSD: longjmp.c,v 1.3 2011/04/27 21:08:48 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define __LIBC12_SOURCE__
 #include 
@@ -45,6 +46,13 @@
 	__greg_t	__glob[5];
 } __jmp_buf_regs_t;
 
+/*
+ * setjmp.S uses hard coded offsets into the jump_buf,
+ * make sure any changes cause a compile failure here
+ */
+__CTASSERT(0x68 == offsetof(__jmp_buf_regs_t,__glob[4])+
+	sizeof(struct sigcontext));
+
 void
 __longjmp14(jmp_buf env, int val)
 {
@@ -72,7 +80,7 @@
 	/* Fill other registers */
 	uc.uc_mcontext.__gregs[_REG_CCR] = sc->sc_tstate;
 	uc.uc_mcontext.__gregs[_REG_PC] = sc->sc_pc;
-	uc.uc_mcontext.__gregs[_REG_nPC] = sc->sc_npc;
+	uc.uc_mcontext.__gregs[_REG_nPC] = sc->sc_pc+4;
 	uc.uc_mcontext.__gregs[_REG_G1] = sc->sc_g1;
 	uc.uc_mcontext.__gregs[_REG_G2] = sc->sc_o0;
 	uc.uc_mcontext.__gregs[_REG_G3] = r->__glob[0];
@@ -82,6 +90,7 @@
 	uc.uc_mcontext.__gregs[_REG_G7] = r->__glob[4];
 	uc.uc_mcontext.__gregs[_REG_O6] = sc->sc_sp;
 
+
 	/* Make return value non-zero */
 	if (val == 0)
 		val = 1;

Index: src/lib/libc/arch/sparc64/gen/setjmp.S
diff -u src/lib/libc/arch/sparc64/gen/setjmp.S:1.7 src/lib/libc/arch/sparc64/gen/setjmp.S:1.8
--- src/lib/libc/arch/sparc64/gen/setjmp.S:1.7	Sun Oct 16 17:15:38 2005
+++ src/lib/libc/arch/sparc64/gen/setjmp.S	Wed Apr 27 21:08:48 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: setjmp.S,v 1.7 2005/10/16 17:15:38 christos Exp $	*/
+/*	$NetBSD: setjmp.S,v 1.8 2011/04/27 21:08:48 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@
 #if 0
 	.asciz "@(#)setjmp.s	8.1 (Berkeley) 6/4/93"
 #else
-	RCSID("$NetBSD: setjmp.S,v 1.7 2005/10/16 17:15:38 christos Exp $")
+	RCSID("$NetBSD: setjmp.S,v 1.8 2011/04/27 21:08:48 martin Exp $")
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -118,19 +118,17 @@
 	stx	%fp, [%i0 + 0x08]	/* sc.sc_sp = sp */
 	add	%i7, 8, %o0
 	stx	%o0, [%i0 + 0x10]	/* sc.sc_pc = return_pc */
-	add	%i7, 12, %o0
-	stx	%o0, [%i0 + 0x18]	/* sc.sc_npc = return_pc + 4 */
 	stx	%g0, [%i0 + 0x20]	/* sc.sc_tstate = (clean ccr) */
 	stx	%l1, [%i0 + 0x28]	/* sc.sc_g1 */
 	stx	%l2, [%i0 + 0x30]	/* sc.sc_o0, set in longjmp, use as %g2 */
-	/* 0x38 */			/* sc.sc_mask was already saved above */
+	/* 0x38: 4x32bit */		/* sc.sc_mask was already saved above */
 
 	/* save additional registers needed to fill a complete mcontext */
-	stx	%l3, [%i0 + 0x40]
-	stx	%l4, [%i0 + 0x48]
-	stx	%l5, [%i0 + 0x50]
-	stx	%l6, [%i0 + 0x58]
-	stx	%l7, [%i0 + 0x60]
+	stx	%l3, [%i0 + 0x48]
+	stx	%l4, [%i0 + 0x50]	/* adjust asserts in longjmp.c */
+	stx	%l5, [%i0 + 0x58]	/* if you change any of these */
+	stx	%l6, [%i0 + 0x60]	/* offsets! */
+	stx	%l7, [%i0 + 0x68]
 
 	ret/* return 0 */
 	 restore %g0, 0, %o0

Index: src/lib/libc/arch/sparc64/gen/sigsetjmp.S
diff -u src/lib/libc/arch/sparc64/gen/sigsetjmp.S:1.8 src/lib/libc/arch/sparc64/gen/sigsetjmp.S:1.9
--- src/lib/libc/arch/sparc64/gen/sigsetjmp.S:1.8	Sun Oct 16 17:15:38 2005
+++ src/lib/libc/arch/sparc64/gen/sigsetjmp.S	Wed Apr 27 21:08:48 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sigsetjmp.S,v 1.8 2005/10/16 17:15:38 christos Exp $	*/
+/*	$NetBSD: sigsetjmp.S,v 1.9 2011/04/27 21:08:48 martin Exp $	*/
 /*
  * Copyright (c) 1995 Paul Kranenburg
  * All rights reserved.
@@ -32,12 +32,17 @@
 
 #include "SYS.h"
 
+/*
+ * We use the sc_npc field inside the sigcontext to store the save mask
+ */
+#define	MASK_OFFSET	0x18
+
 #ifdef PIC
 #ifdef BIGPIC
 	
 ENTRY(__sigsetjmp14)
 	PIC_PROLOGUE(%g1,%o2)		! %g1 = _GLOBAL_OFFSET_TABLE
-	st	%o1,[%o0+0x68]		! jmpbuf[JBLEN]
+	st	%o1,[%o0+MASK_OFFSET]	! jmp_buf.sc.sc_npc
 	s

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

2011-04-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 30 19:39:38 UTC 2011

Modified Files:
src/lib/libc/arch/sparc64/gen: longjmp.c setjmp.S sigsetjmp.S

Log Message:
Rearange jmp_buf content again: storing the sigsetjmp() save_mask midway
inside the environment is not a good idea, we may overwrite it when
fetching other details of the sigjmp environment.
Instead move it to the very end again.
Do not bother to save volatile (caller saved) global registers.
Fixes PR port-sparc64/44918.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/sparc64/gen/longjmp.c
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/arch/sparc64/gen/setjmp.S
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/arch/sparc64/gen/sigsetjmp.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/sparc64/gen/longjmp.c
diff -u src/lib/libc/arch/sparc64/gen/longjmp.c:1.3 src/lib/libc/arch/sparc64/gen/longjmp.c:1.4
--- src/lib/libc/arch/sparc64/gen/longjmp.c:1.3	Wed Apr 27 21:08:48 2011
+++ src/lib/libc/arch/sparc64/gen/longjmp.c	Sat Apr 30 19:39:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: longjmp.c,v 1.3 2011/04/27 21:08:48 martin Exp $	*/
+/*	$NetBSD: longjmp.c,v 1.4 2011/04/30 19:39:38 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -43,14 +43,18 @@
 #include 
 
 typedef struct {
-	__greg_t	__glob[5];
+	__greg_t	g3;
+	__greg_t	g6;
+	__greg_t	g7;
+	__greg_t	dummy;
+	__greg_t	save_mask;
 } __jmp_buf_regs_t;
 
 /*
  * setjmp.S uses hard coded offsets into the jump_buf,
  * make sure any changes cause a compile failure here
  */
-__CTASSERT(0x68 == offsetof(__jmp_buf_regs_t,__glob[4])+
+__CTASSERT(0x68 == offsetof(__jmp_buf_regs_t,save_mask)+
 	sizeof(struct sigcontext));
 
 void
@@ -83,11 +87,11 @@
 	uc.uc_mcontext.__gregs[_REG_nPC] = sc->sc_pc+4;
 	uc.uc_mcontext.__gregs[_REG_G1] = sc->sc_g1;
 	uc.uc_mcontext.__gregs[_REG_G2] = sc->sc_o0;
-	uc.uc_mcontext.__gregs[_REG_G3] = r->__glob[0];
-	uc.uc_mcontext.__gregs[_REG_G4] = r->__glob[1];
-	uc.uc_mcontext.__gregs[_REG_G5] = r->__glob[2];
-	uc.uc_mcontext.__gregs[_REG_G6] = r->__glob[3];
-	uc.uc_mcontext.__gregs[_REG_G7] = r->__glob[4];
+	uc.uc_mcontext.__gregs[_REG_G3] = r->g3;
+	uc.uc_mcontext.__gregs[_REG_G4] = 0;
+	uc.uc_mcontext.__gregs[_REG_G5] = 0;
+	uc.uc_mcontext.__gregs[_REG_G6] = r->g6;
+	uc.uc_mcontext.__gregs[_REG_G7] = r->g7;
 	uc.uc_mcontext.__gregs[_REG_O6] = sc->sc_sp;
 
 

Index: src/lib/libc/arch/sparc64/gen/setjmp.S
diff -u src/lib/libc/arch/sparc64/gen/setjmp.S:1.8 src/lib/libc/arch/sparc64/gen/setjmp.S:1.9
--- src/lib/libc/arch/sparc64/gen/setjmp.S:1.8	Wed Apr 27 21:08:48 2011
+++ src/lib/libc/arch/sparc64/gen/setjmp.S	Sat Apr 30 19:39:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: setjmp.S,v 1.8 2011/04/27 21:08:48 martin Exp $	*/
+/*	$NetBSD: setjmp.S,v 1.9 2011/04/30 19:39:38 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@
 #if 0
 	.asciz "@(#)setjmp.s	8.1 (Berkeley) 6/4/93"
 #else
-	RCSID("$NetBSD: setjmp.S,v 1.8 2011/04/27 21:08:48 martin Exp $")
+	RCSID("$NetBSD: setjmp.S,v 1.9 2011/04/30 19:39:38 martin Exp $")
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -124,11 +124,9 @@
 	/* 0x38: 4x32bit */		/* sc.sc_mask was already saved above */
 
 	/* save additional registers needed to fill a complete mcontext */
-	stx	%l3, [%i0 + 0x48]
-	stx	%l4, [%i0 + 0x50]	/* adjust asserts in longjmp.c */
-	stx	%l5, [%i0 + 0x58]	/* if you change any of these */
-	stx	%l6, [%i0 + 0x60]	/* offsets! */
-	stx	%l7, [%i0 + 0x68]
+	stx	%l3, [%i0 + 0x48]	/* adjust asserts in longjmp.c */
+	stx	%l6, [%i0 + 0x50]	/* if you change any of these */
+	stx	%l7, [%i0 + 0x58]	/* offsets! */
 
 	ret/* return 0 */
 	 restore %g0, 0, %o0

Index: src/lib/libc/arch/sparc64/gen/sigsetjmp.S
diff -u src/lib/libc/arch/sparc64/gen/sigsetjmp.S:1.9 src/lib/libc/arch/sparc64/gen/sigsetjmp.S:1.10
--- src/lib/libc/arch/sparc64/gen/sigsetjmp.S:1.9	Wed Apr 27 21:08:48 2011
+++ src/lib/libc/arch/sparc64/gen/sigsetjmp.S	Sat Apr 30 19:39:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sigsetjmp.S,v 1.9 2011/04/27 21:08:48 martin Exp $	*/
+/*	$NetBSD: sigsetjmp.S,v 1.10 2011/04/30 19:39:38 martin Exp $	*/
 /*
  * Copyright (c) 1995 Paul Kranenburg
  * All rights reserved.
@@ -35,14 +35,14 @@
 /*
  * We use the sc_npc field inside the sigcontext to store the save mask
  */
-#define	MASK_OFFSET	0x18
+#define	MASK_OFFSET	0x68
 
 #ifdef PIC
 #ifdef BIGPIC
 	
 ENTRY(__sigsetjmp14)
 	PIC_PROLOGUE(%g1,%o2)		! %g1 = _GLOBAL_OFFSET_TABLE
-	st	%o1,[%o0+MASK_OFFSET]	! jmp_buf.sc.sc_npc
+	st	%o1,[%o0+MASK_OFFSET]	! end of jmpbuf
 	sethi	%hi(_C_LABEL(__setjmp14)), %o2
 	sethi	%hi(_C_LABEL(_setjmp)), %o3
 	or	%o2, %lo(_C_LABEL(__setjmp14)), %o2
@@ -56,7 +56,7 @@
 	
 ENTRY(__siglongjmp14)
 	PIC_PROLOGUE(%g1,%o2)		! %g1 = _GLOBAL_OFFSET_TABLE
-	ld	[%o0+MASK_OFFSET], %o2	! jmp_buf.sc.sc_npc
+	ld	[%o0+MASK_OFFSET], %o2	! end of jmpbuf
 	sethi	%hi(_C_LABEL(__longjmp14)), %o3 
 	sethi	%h

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

2011-04-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 30 19:43:17 UTC 2011

Modified Files:
src/lib/libc/arch/sparc64/gen: _setjmp.S

Log Message:
Save/restore some global registers (sigsetjmp compatible). Does not realy
make a difference currently, but is a hard to spot blackhole if something
ever starts using the application registers.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/sparc64/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/sparc64/gen/_setjmp.S
diff -u src/lib/libc/arch/sparc64/gen/_setjmp.S:1.6 src/lib/libc/arch/sparc64/gen/_setjmp.S:1.7
--- src/lib/libc/arch/sparc64/gen/_setjmp.S:1.6	Tue Dec  7 08:20:07 2004
+++ src/lib/libc/arch/sparc64/gen/_setjmp.S	Sat Apr 30 19:43:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: _setjmp.S,v 1.6 2004/12/07 08:20:07 martin Exp $	*/
+/*	$NetBSD: _setjmp.S,v 1.7 2011/04/30 19:43:17 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -40,10 +40,13 @@
 #if 0
 	.asciz "@(#)_setjmp.s	8.1 (Berkeley) 6/4/93"
 #else
-	RCSID("$NetBSD: _setjmp.S,v 1.6 2004/12/07 08:20:07 martin Exp $")
+	RCSID("$NetBSD: _setjmp.S,v 1.7 2011/04/30 19:43:17 martin Exp $")
 #endif
 #endif /* LIBC_SCCS and not lint */
 
+	.register %g2,#ignore
+	.register %g3,#ignore
+
 /*
  * C library -- _setjmp, _longjmp
  *
@@ -57,6 +60,15 @@
 ENTRY(_setjmp)
 	stx	%sp, [%o0+0]	/* store caller's stack pointer */
 	stx	%o7, [%o0+8]	/* and return pc */
+	stx	%g0, [%o0+0x18]	/* mark as non-sigmask jmpbuf */
+
+	/* store globals, offsets compatible with siglongjmp */
+	stx	%g1, [%o0+0x28]
+	stx	%g2, [%o0+0x30]		/* adjust asserts in longjmp.c */
+	stx	%g3, [%o0+0x48]		/* if you change any of these */
+	stx	%g6, [%o0+0x50]		/* offsets! */
+	stx	%g7, [%o0+0x58]
+
 	retl
 	 clr	%o0		! return 0
 
@@ -68,6 +80,11 @@
 	 * a `restore' instruction which will reload the register
 	 * window from the stack.
 	 */
+	ldx	[%i0+0x28],%g1
+	ldx	[%i0+0x30],%g2
+	ldx	[%i0+0x48],%g3
+	ldx	[%i0+0x50],%g6
+	ldx	[%i0+0x58],%g7
 	ldx	[%i0+8], %i7
 	ldx	[%i0+0], %fp
 	mov	1, %i0



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

2011-04-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 30 23:30:27 UTC 2011

Modified Files:
src/lib/libc/arch/sparc64/gen: longjmp.c

Log Message:
Add another compile time assert: catch overflows of jmp_buf


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/sparc64/gen/longjmp.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/sparc64/gen/longjmp.c
diff -u src/lib/libc/arch/sparc64/gen/longjmp.c:1.4 src/lib/libc/arch/sparc64/gen/longjmp.c:1.5
--- src/lib/libc/arch/sparc64/gen/longjmp.c:1.4	Sat Apr 30 19:39:38 2011
+++ src/lib/libc/arch/sparc64/gen/longjmp.c	Sat Apr 30 23:30:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: longjmp.c,v 1.4 2011/04/30 19:39:38 martin Exp $	*/
+/*	$NetBSD: longjmp.c,v 1.5 2011/04/30 23:30:27 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -56,6 +56,8 @@
  */
 __CTASSERT(0x68 == offsetof(__jmp_buf_regs_t,save_mask)+
 	sizeof(struct sigcontext));
+__CTASSERT(sizeof(jmp_buf) >= sizeof(__jmp_buf_regs_t) +
+	sizeof(struct sigcontext));
 
 void
 __longjmp14(jmp_buf env, int val)



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

2011-04-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 30 23:39:08 UTC 2011

Modified Files:
src/lib/libc/arch/sparc64/gen: longjmp.c

Log Message:
Fix previous: the way we calculate, we need to test the size of sigjmp_buf


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/sparc64/gen/longjmp.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/sparc64/gen/longjmp.c
diff -u src/lib/libc/arch/sparc64/gen/longjmp.c:1.5 src/lib/libc/arch/sparc64/gen/longjmp.c:1.6
--- src/lib/libc/arch/sparc64/gen/longjmp.c:1.5	Sat Apr 30 23:30:27 2011
+++ src/lib/libc/arch/sparc64/gen/longjmp.c	Sat Apr 30 23:39:08 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: longjmp.c,v 1.5 2011/04/30 23:30:27 martin Exp $	*/
+/*	$NetBSD: longjmp.c,v 1.6 2011/04/30 23:39:08 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 __CTASSERT(0x68 == offsetof(__jmp_buf_regs_t,save_mask)+
 	sizeof(struct sigcontext));
-__CTASSERT(sizeof(jmp_buf) >= sizeof(__jmp_buf_regs_t) +
+__CTASSERT(sizeof(sigjmp_buf) >= sizeof(__jmp_buf_regs_t) +
 	sizeof(struct sigcontext));
 
 void



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

2012-09-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 13 11:47:46 UTC 2012

Modified Files:
src/lib/libc/arch/sparc64/gen: swapcontext.S

Log Message:
Fix register usage


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/sparc64/gen/swapcontext.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/sparc64/gen/swapcontext.S
diff -u src/lib/libc/arch/sparc64/gen/swapcontext.S:1.6 src/lib/libc/arch/sparc64/gen/swapcontext.S:1.7
--- src/lib/libc/arch/sparc64/gen/swapcontext.S:1.6	Wed Sep 12 02:00:53 2012
+++ src/lib/libc/arch/sparc64/gen/swapcontext.S	Thu Sep 13 11:47:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: swapcontext.S,v 1.6 2012/09/12 02:00:53 manu Exp $	*/
+/*	$NetBSD: swapcontext.S,v 1.7 2012/09/13 11:47:46 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "SYS.h"
 
 #if defined(LIBC_SCCS) && !defined(lint)
-	RCSID("$NetBSD: swapcontext.S,v 1.6 2012/09/12 02:00:53 manu Exp $")
+	RCSID("$NetBSD: swapcontext.S,v 1.7 2012/09/13 11:47:46 martin Exp $")
 #endif /* LIBC_SCCS && !lint */
 
 
@@ -53,12 +53,12 @@ ENTRY(swapcontext)
 #ifdef	PIC
 	PIC_PROLOGUE(%g5,%o4)			/* %g5 = _GLOBAL_OFFSET_TABLE */
 #ifdef	BIGPIC
-	set	_C_LABEL(setcontext), %o6
-	ldx	[%g5+%o6], %o5
+	set	_C_LABEL(setcontext), %o5
+	ldx	[%g5+%o5], %o4
 #else
-	ldx	[%g5+_C_LABEL(setcontext)], %o5
+	ldx	[%g5+_C_LABEL(setcontext)], %o4
 #endif
-	jmp	%o5
+	jmp	%o4
 	 mov	%o3, %o0
 #else
 	ba,a	_C_LABEL(setcontext)



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

2013-02-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 15 09:25:03 UTC 2013

Modified Files:
src/lib/libc/arch/sparc64/gen: fpsetround.c

Log Message:
While we are using softfloat for 128 bit long double values, make fpsetround
update the softfloat rounding mode as well.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/sparc64/gen/fpsetround.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/sparc64/gen/fpsetround.c
diff -u src/lib/libc/arch/sparc64/gen/fpsetround.c:1.5 src/lib/libc/arch/sparc64/gen/fpsetround.c:1.6
--- src/lib/libc/arch/sparc64/gen/fpsetround.c:1.5	Sat Mar 17 21:35:06 2012
+++ src/lib/libc/arch/sparc64/gen/fpsetround.c	Fri Feb 15 09:25:03 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetround.c,v 1.5 2012/03/17 21:35:06 martin Exp $	*/
+/*	$NetBSD: fpsetround.c,v 1.6 2013/02/15 09:25:03 martin Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 10, 1995
@@ -7,7 +7,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetround.c,v 1.5 2012/03/17 21:35:06 martin Exp $");
+__RCSID("$NetBSD: fpsetround.c,v 1.6 2013/02/15 09:25:03 martin Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -25,9 +25,16 @@ fpsetround(rnd_dir)
 {
 	fp_rnd old;
 	fp_rnd new;
+#ifdef SOFTFLOATSPARC64_FOR_GCC
+	extern fp_rnd _softfloat_float_rounding_mode;
+#endif
 
 	__asm("st %%fsr,%0" : "=m" (*&old));
 
+#ifdef SOFTFLOATSPARC64_FOR_GCC
+	_softfloat_float_rounding_mode = rnd_dir;
+#endif
+
 	new = old;
 	new &= ~(0x03 << 30); 
 	new |= ((rnd_dir & 0x03) << 30);



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

2013-10-27 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Oct 28 01:06:36 UTC 2013

Modified Files:
src/lib/libc/arch/sparc64/gen: fpsetmask.c fpsetround.c fpsetsticky.c

Log Message:
convert to ANSI C definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/sparc64/gen/fpsetmask.c \
src/lib/libc/arch/sparc64/gen/fpsetround.c \
src/lib/libc/arch/sparc64/gen/fpsetsticky.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/sparc64/gen/fpsetmask.c
diff -u src/lib/libc/arch/sparc64/gen/fpsetmask.c:1.6 src/lib/libc/arch/sparc64/gen/fpsetmask.c:1.7
--- src/lib/libc/arch/sparc64/gen/fpsetmask.c:1.6	Sat Mar 17 21:35:06 2012
+++ src/lib/libc/arch/sparc64/gen/fpsetmask.c	Mon Oct 28 01:06:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetmask.c,v 1.6 2012/03/17 21:35:06 martin Exp $	*/
+/*	$NetBSD: fpsetmask.c,v 1.7 2013/10/28 01:06:36 mrg Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 10, 1995
@@ -7,7 +7,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetmask.c,v 1.6 2012/03/17 21:35:06 martin Exp $");
+__RCSID("$NetBSD: fpsetmask.c,v 1.7 2013/10/28 01:06:36 mrg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -24,8 +24,7 @@ extern fp_except _softfloat_float_except
 #endif
 
 fp_except
-fpsetmask(mask)
-	fp_except mask;
+fpsetmask(fp_except mask)
 {
 	fp_except old;
 	fp_except new;
Index: src/lib/libc/arch/sparc64/gen/fpsetround.c
diff -u src/lib/libc/arch/sparc64/gen/fpsetround.c:1.6 src/lib/libc/arch/sparc64/gen/fpsetround.c:1.7
--- src/lib/libc/arch/sparc64/gen/fpsetround.c:1.6	Fri Feb 15 09:25:03 2013
+++ src/lib/libc/arch/sparc64/gen/fpsetround.c	Mon Oct 28 01:06:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetround.c,v 1.6 2013/02/15 09:25:03 martin Exp $	*/
+/*	$NetBSD: fpsetround.c,v 1.7 2013/10/28 01:06:36 mrg Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 10, 1995
@@ -7,7 +7,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetround.c,v 1.6 2013/02/15 09:25:03 martin Exp $");
+__RCSID("$NetBSD: fpsetround.c,v 1.7 2013/10/28 01:06:36 mrg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -20,8 +20,7 @@ __weak_alias(fpsetround,_fpsetround)
 #endif
 
 fp_rnd
-fpsetround(rnd_dir)
-	fp_rnd rnd_dir;
+fpsetround(fp_rnd rnd_dir)
 {
 	fp_rnd old;
 	fp_rnd new;
Index: src/lib/libc/arch/sparc64/gen/fpsetsticky.c
diff -u src/lib/libc/arch/sparc64/gen/fpsetsticky.c:1.6 src/lib/libc/arch/sparc64/gen/fpsetsticky.c:1.7
--- src/lib/libc/arch/sparc64/gen/fpsetsticky.c:1.6	Sat Mar 17 21:35:06 2012
+++ src/lib/libc/arch/sparc64/gen/fpsetsticky.c	Mon Oct 28 01:06:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetsticky.c,v 1.6 2012/03/17 21:35:06 martin Exp $	*/
+/*	$NetBSD: fpsetsticky.c,v 1.7 2013/10/28 01:06:36 mrg Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 10, 1995
@@ -7,7 +7,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetsticky.c,v 1.6 2012/03/17 21:35:06 martin Exp $");
+__RCSID("$NetBSD: fpsetsticky.c,v 1.7 2013/10/28 01:06:36 mrg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -24,8 +24,7 @@ extern fp_except _softfloat_float_except
 #endif
 
 fp_except
-fpsetsticky(sticky)
-	fp_except sticky;
+fpsetsticky(fp_except sticky)
 {
 	fp_except old;
 	fp_except new;