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

2018-11-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Nov 23 12:39:19 UTC 2018

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

Log Message:
Update comments to help explain what's going on


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/aarch64/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/aarch64/gen/swapcontext.S
diff -u src/lib/libc/arch/aarch64/gen/swapcontext.S:1.3 src/lib/libc/arch/aarch64/gen/swapcontext.S:1.4
--- src/lib/libc/arch/aarch64/gen/swapcontext.S:1.3	Fri Nov 23 11:38:07 2018
+++ src/lib/libc/arch/aarch64/gen/swapcontext.S	Fri Nov 23 12:39:18 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: swapcontext.S,v 1.3 2018/11/23 11:38:07 skrll Exp $ */
+/* $NetBSD: swapcontext.S,v 1.4 2018/11/23 12:39:18 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "assym.h"
 
 #if defined(LIBC_SCCS) && !defined(lint)
-RCSID("$NetBSD: swapcontext.S,v 1.3 2018/11/23 11:38:07 skrll Exp $")
+RCSID("$NetBSD: swapcontext.S,v 1.4 2018/11/23 12:39:18 skrll Exp $")
 #endif /* LIBC_SCCS && !lint */
 
 /* LINTSTUB: int swapcontext(ucontext_t * restrict, ucontext_t * restrict); */
@@ -42,12 +42,12 @@ ENTRY(swapcontext)
 	sub	sp, sp, #32		/* allocate stack frame */
 	stp	x29, x30, [sp, #16]	/* save FP & LR */
 	add	x29, sp, #16		/* new FP */
-	stp	x0, x1, [sp, #0]	/* save oucp & ucp */
+	stp	x0, x1, [sp, #0]	/* save oucp (x0) & ucp (x1) */
 
 	bl	_C_LABEL(_getcontext)	/* getcontext(oucp) */
 	mov	x3, x0			/* save return value */
 
-	ldp	x2, x0, [sp, #0]	/* restore oucp & ucp */
+	ldp	x2, x0, [sp, #0]	/* load oucp (x2) & ucp (x0) */
 	ldp	x29, x30, [sp, #16]	/* restore FP & LR */
 	add	sp, sp, #32		/* free stack frame */
 



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

2018-11-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Nov 23 11:38:07 UTC 2018

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

Log Message:
Fix so the setcontext call is via the PLT and libpthread can override


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/aarch64/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/aarch64/gen/swapcontext.S
diff -u src/lib/libc/arch/aarch64/gen/swapcontext.S:1.2 src/lib/libc/arch/aarch64/gen/swapcontext.S:1.3
--- src/lib/libc/arch/aarch64/gen/swapcontext.S:1.2	Wed Nov 21 21:04:15 2018
+++ src/lib/libc/arch/aarch64/gen/swapcontext.S	Fri Nov 23 11:38:07 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: swapcontext.S,v 1.2 2018/11/21 21:04:15 skrll Exp $ */
+/* $NetBSD: swapcontext.S,v 1.3 2018/11/23 11:38:07 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "assym.h"
 
 #if defined(LIBC_SCCS) && !defined(lint)
-RCSID("$NetBSD: swapcontext.S,v 1.2 2018/11/21 21:04:15 skrll Exp $")
+RCSID("$NetBSD: swapcontext.S,v 1.3 2018/11/23 11:38:07 skrll Exp $")
 #endif /* LIBC_SCCS && !lint */
 
 /* LINTSTUB: int swapcontext(ucontext_t * restrict, ucontext_t * restrict); */
@@ -58,7 +58,9 @@ ENTRY(swapcontext)
 	str	x4, [x2, #_UC_REGS_SP]	/* Adjust saved SP. */
 	str	x30, [x2, #_UC_REGS_PC]	/* Adjust saved PC. */
 
-	cbz	x3, _C_LABEL(setcontext)/* setcontext if getcontext succeeded */
+	cbnz	x3, 1f
+	b	_C_LABEL(setcontext)	/* setcontext if getcontext succeeded */
+1:
 	mov	x0, x3			/* restore getcontext return value */
 	ret/* return on error from getcontext */
 END(swapcontext)



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

2018-11-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Nov 21 21:24:42 UTC 2018

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

Log Message:
_REG_LR should be _lwp_exit


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/aarch64/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/aarch64/gen/_lwp.c
diff -u src/lib/libc/arch/aarch64/gen/_lwp.c:1.2 src/lib/libc/arch/aarch64/gen/_lwp.c:1.3
--- src/lib/libc/arch/aarch64/gen/_lwp.c:1.2	Sat Aug  4 10:22:09 2018
+++ src/lib/libc/arch/aarch64/gen/_lwp.c	Wed Nov 21 21:24:42 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: _lwp.c,v 1.2 2018/08/04 10:22:09 ryo Exp $ */
+/* $NetBSD: _lwp.c,v 1.3 2018/11/21 21:24:42 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _lwp.c,v 1.2 2018/08/04 10:22:09 ryo Exp $");
+__RCSID("$NetBSD: _lwp.c,v 1.3 2018/11/21 21:24:42 skrll Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -58,7 +58,7 @@ _lwp_makecontext(ucontext_t *u, void (*s
 
 	u->uc_mcontext.__gregs[_REG_X0] = (__greg_t)(uintptr_t)arg;
 	u->uc_mcontext.__gregs[_REG_SP] = ((__greg_t)sp) & -16;
-	u->uc_mcontext.__gregs[_REG_X29] = (__greg_t)(uintptr_t)_lwp_exit;
+	u->uc_mcontext.__gregs[_REG_LR] = (__greg_t)(uintptr_t)_lwp_exit;
 	u->uc_mcontext.__gregs[_REG_PC] = (__greg_t)(uintptr_t)start;
 	u->uc_mcontext.__gregs[_REG_TPIDR] = (__greg_t)(uintptr_t)private;
 	u->uc_flags |= _UC_TLSBASE;



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

2018-11-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Nov 21 21:04:15 UTC 2018

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

Log Message:
Fix some register names in comments


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/aarch64/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/aarch64/gen/swapcontext.S
diff -u src/lib/libc/arch/aarch64/gen/swapcontext.S:1.1 src/lib/libc/arch/aarch64/gen/swapcontext.S:1.2
--- src/lib/libc/arch/aarch64/gen/swapcontext.S:1.1	Sun Aug 10 05:47:36 2014
+++ src/lib/libc/arch/aarch64/gen/swapcontext.S	Wed Nov 21 21:04:15 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: swapcontext.S,v 1.1 2014/08/10 05:47:36 matt Exp $ */
+/* $NetBSD: swapcontext.S,v 1.2 2018/11/21 21:04:15 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -33,14 +33,14 @@
 #include "assym.h"
 
 #if defined(LIBC_SCCS) && !defined(lint)
-RCSID("$NetBSD: swapcontext.S,v 1.1 2014/08/10 05:47:36 matt Exp $")
+RCSID("$NetBSD: swapcontext.S,v 1.2 2018/11/21 21:04:15 skrll Exp $")
 #endif /* LIBC_SCCS && !lint */
 
 /* LINTSTUB: int swapcontext(ucontext_t * restrict, ucontext_t * restrict); */
 
 ENTRY(swapcontext)
 	sub	sp, sp, #32		/* allocate stack frame */
-	stp	x29, x30, [sp, #16]	/* save FP & RA */
+	stp	x29, x30, [sp, #16]	/* save FP & LR */
 	add	x29, sp, #16		/* new FP */
 	stp	x0, x1, [sp, #0]	/* save oucp & ucp */
 
@@ -48,7 +48,7 @@ ENTRY(swapcontext)
 	mov	x3, x0			/* save return value */
 
 	ldp	x2, x0, [sp, #0]	/* restore oucp & ucp */
-	ldp	x29, x30, [sp, #16]	/* restore FP & RA */
+	ldp	x29, x30, [sp, #16]	/* restore FP & LR */
 	add	sp, sp, #32		/* free stack frame */
 
 	/*
@@ -56,7 +56,7 @@ ENTRY(swapcontext)
 	 */
 	mov	x4, sp			/* Get SP */
 	str	x4, [x2, #_UC_REGS_SP]	/* Adjust saved SP. */
-	str	x30, [x2, #_UC_REGS_PC]	/* Adjust saved LR. */
+	str	x30, [x2, #_UC_REGS_PC]	/* Adjust saved PC. */
 
 	cbz	x3, _C_LABEL(setcontext)/* setcontext if getcontext succeeded */
 	mov	x0, x3			/* restore getcontext return value */



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

2018-11-16 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Nov 16 10:51:08 UTC 2018

Modified Files:
src/lib/libc/arch/aarch64/gen: makecontext.c

Log Message:
fix type of argument for va_arg; don't round to 32bit.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/aarch64/gen/makecontext.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/aarch64/gen/makecontext.c
diff -u src/lib/libc/arch/aarch64/gen/makecontext.c:1.1 src/lib/libc/arch/aarch64/gen/makecontext.c:1.2
--- src/lib/libc/arch/aarch64/gen/makecontext.c:1.1	Sun Aug 10 05:47:36 2014
+++ src/lib/libc/arch/aarch64/gen/makecontext.c	Fri Nov 16 10:51:08 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: makecontext.c,v 1.1 2014/08/10 05:47:36 matt Exp $ */
+/* $NetBSD: makecontext.c,v 1.2 2018/11/16 10:51:08 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: makecontext.c,v 1.1 2014/08/10 05:47:36 matt Exp $");
+__RCSID("$NetBSD: makecontext.c,v 1.2 2018/11/16 10:51:08 ryo Exp $");
 #endif
 
 #include 
@@ -63,9 +63,9 @@ makecontext(ucontext_t *ucp, void (*func
 	va_list ap;
 	va_start(ap, argc);
 
-	/* Pass up to four arguments in r0-3. */
+	/* Pass up to eight arguments in x0-x7. */
 	for (int i = 0; i < argc && i < 8; i++) {
-		gr[_REG_X0 + i] = va_arg(ap, int);
+		gr[_REG_X0 + i] = va_arg(ap, __greg_t);
 	}
 
 	/* Pass any additional arguments on the stack. */



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

2018-08-04 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sat Aug  4 10:22:09 UTC 2018

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

Log Message:
need to set _UC_TLSBASE of uc_flags for _lwp_makecontext().
pointed out from skrll@. thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/aarch64/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/aarch64/gen/_lwp.c
diff -u src/lib/libc/arch/aarch64/gen/_lwp.c:1.1 src/lib/libc/arch/aarch64/gen/_lwp.c:1.2
--- src/lib/libc/arch/aarch64/gen/_lwp.c:1.1	Sun Aug 10 05:47:36 2014
+++ src/lib/libc/arch/aarch64/gen/_lwp.c	Sat Aug  4 10:22:09 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: _lwp.c,v 1.1 2014/08/10 05:47:36 matt Exp $ */
+/* $NetBSD: _lwp.c,v 1.2 2018/08/04 10:22:09 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _lwp.c,v 1.1 2014/08/10 05:47:36 matt Exp $");
+__RCSID("$NetBSD: _lwp.c,v 1.2 2018/08/04 10:22:09 ryo Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -61,4 +61,5 @@ _lwp_makecontext(ucontext_t *u, void (*s
 	u->uc_mcontext.__gregs[_REG_X29] = (__greg_t)(uintptr_t)_lwp_exit;
 	u->uc_mcontext.__gregs[_REG_PC] = (__greg_t)(uintptr_t)start;
 	u->uc_mcontext.__gregs[_REG_TPIDR] = (__greg_t)(uintptr_t)private;
+	u->uc_flags |= _UC_TLSBASE;
 }



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

2018-02-12 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Feb 12 22:31:04 UTC 2018

Modified Files:
src/lib/libc/arch/aarch64/gen: sigsetjmp.S

Log Message:
Fix __siglongjmp14().

Fixes SIGINT causing ksh to "longjmp botch", presumably due to incorrect
magic number.
cvs: --


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/aarch64/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/aarch64/gen/sigsetjmp.S
diff -u src/lib/libc/arch/aarch64/gen/sigsetjmp.S:1.1 src/lib/libc/arch/aarch64/gen/sigsetjmp.S:1.2
--- src/lib/libc/arch/aarch64/gen/sigsetjmp.S:1.1	Sun Aug 10 05:47:36 2014
+++ src/lib/libc/arch/aarch64/gen/sigsetjmp.S	Mon Feb 12 22:31:04 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sigsetjmp.S,v 1.1 2014/08/10 05:47:36 matt Exp $ */
+/* $NetBSD: sigsetjmp.S,v 1.2 2018/02/12 22:31:04 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -47,6 +47,6 @@ END(__sigsetjmp14)
 
 ENTRY(__siglongjmp14)
 	ldr	x3, [x0, #_JB_MAGIC]
-	tbz	x3, #0, _C_LABEL(__longjmp14)
+	tbnz	x3, #0, _C_LABEL(__longjmp14)
 	b	_C_LABEL(_longjmp)
 END(__siglongjmp14)



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

2017-11-28 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue Nov 28 13:09:05 UTC 2017

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

Log Message:
fix to work
* no need to check x29 != NULL. fp may be NULL.
* don't break in-use register x5.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/aarch64/gen/_setjmp.S
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/aarch64/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/aarch64/gen/_setjmp.S
diff -u src/lib/libc/arch/aarch64/gen/_setjmp.S:1.2 src/lib/libc/arch/aarch64/gen/_setjmp.S:1.3
--- src/lib/libc/arch/aarch64/gen/_setjmp.S:1.2	Tue Nov 28 09:06:25 2017
+++ src/lib/libc/arch/aarch64/gen/_setjmp.S	Tue Nov 28 13:09:05 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: _setjmp.S,v 1.2 2017/11/28 09:06:25 ryo Exp $ */
+/* $NetBSD: _setjmp.S,v 1.3 2017/11/28 13:09:05 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -83,7 +83,6 @@ ENTRY(_longjmp)
 	ldp	x4, x5, [x0, #_JB_X29]
 
 	cbz	x3, .Lbotch
-	cbz	x4, .Lbotch
 	cbz	x5, .Lbotch
 	cmp	x2, x7
 	b.ne	.Lbotch
@@ -94,8 +93,8 @@ ENTRY(_longjmp)
 	ldp	x25, x26, [x0, #_JB_X25]
 	ldp	x27, x28, [x0, #_JB_X27]
 
-	ldr	x5, [x0, #_JB_TPIDR]
-	msr	tpidr_el0, x5
+	ldr	x2, [x0, #_JB_TPIDR]
+	msr	tpidr_el0, x2
 
 	ldp	d8,  d9,  [x0, #_JB_D8]
 	ldp	d10, d11, [x0, #_JB_D10]

Index: src/lib/libc/arch/aarch64/gen/setjmp.S
diff -u src/lib/libc/arch/aarch64/gen/setjmp.S:1.1 src/lib/libc/arch/aarch64/gen/setjmp.S:1.2
--- src/lib/libc/arch/aarch64/gen/setjmp.S:1.1	Sun Aug 10 05:47:36 2014
+++ src/lib/libc/arch/aarch64/gen/setjmp.S	Tue Nov 28 13:09:05 2017
@@ -1,4 +1,4 @@
-/*.$NetBSD: setjmp.S,v 1.1 2014/08/10 05:47:36 matt Exp $.*/
+/*.$NetBSD: setjmp.S,v 1.2 2017/11/28 13:09:05 ryo Exp $.*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -92,7 +92,6 @@ ENTRY(__longjmp14)
 
 	ldp	x4,  x5,  [x0, #_JB_X29]
 	cbz	x3, .Lbotch
-	cbz	x4, .Lbotch
 	cbz	x5, .Lbotch
 
 	ldp	x19, x20, [x0, #_JB_X19]
@@ -101,8 +100,8 @@ ENTRY(__longjmp14)
 	ldp	x25, x26, [x0, #_JB_X25]
 	ldp	x27, x28, [x0, #_JB_X27]
 
-	ldr	x5, [x0, #_JB_TPIDR]
-	msr	tpidr_el0, x5 
+	ldr	x2, [x0, #_JB_TPIDR]
+	msr	tpidr_el0, x2
 
 	ldp	d8,  d9,  [x0, #_JB_D8]
 	ldp	d10, d11, [x0, #_JB_D10]



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

2017-11-28 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue Nov 28 09:06:25 UTC 2017

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

Log Message:
KNF. use tab


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/aarch64/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/aarch64/gen/_setjmp.S
diff -u src/lib/libc/arch/aarch64/gen/_setjmp.S:1.1 src/lib/libc/arch/aarch64/gen/_setjmp.S:1.2
--- src/lib/libc/arch/aarch64/gen/_setjmp.S:1.1	Sun Aug 10 05:47:36 2014
+++ src/lib/libc/arch/aarch64/gen/_setjmp.S	Tue Nov 28 09:06:25 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: _setjmp.S,v 1.1 2014/08/10 05:47:36 matt Exp $ */
+/* $NetBSD: _setjmp.S,v 1.2 2017/11/28 09:06:25 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -71,8 +71,8 @@ ENTRY(_setjmp)
 	stp	d12, d13, [x0, #_JB_D12]
 	stp	d14, d15, [x0, #_JB_D14]
 
-mov	x0, xzr
-ret
+	mov	x0, xzr
+	ret
 END(_setjmp)
 
 ENTRY(_longjmp)
@@ -106,8 +106,8 @@ ENTRY(_longjmp)
 	mov	x29, x4
 	mov	x30, x5
 
-mov	x0, x1
-ret
+	mov	x0, x1
+	ret
 
 	/* validation failed, die die die. */
 .Lbotch:



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

2015-07-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul  7 21:40:19 UTC 2015

Modified Files:
src/lib/libc/arch/aarch64/gen: Makefile.inc
Added Files:
src/lib/libc/arch/aarch64/gen: fpsetmask.c fpsetround.c fpsetsticky.c

Log Message:
Add the fpset* routines for tests


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/aarch64/gen/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/arch/aarch64/gen/fpsetmask.c \
src/lib/libc/arch/aarch64/gen/fpsetround.c \
src/lib/libc/arch/aarch64/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/aarch64/gen/Makefile.inc
diff -u src/lib/libc/arch/aarch64/gen/Makefile.inc:1.1 src/lib/libc/arch/aarch64/gen/Makefile.inc:1.2
--- src/lib/libc/arch/aarch64/gen/Makefile.inc:1.1	Sun Aug 10 05:47:36 2014
+++ src/lib/libc/arch/aarch64/gen/Makefile.inc	Tue Jul  7 21:40:19 2015
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.1 2014/08/10 05:47:36 matt Exp $
+# $NetBSD: Makefile.inc,v 1.2 2015/07/07 21:40:19 matt Exp $
 
 SRCS+=	byte_swap_2.S byte_swap_4.S byte_swap_8.S
 SRCS+=	flt_rounds.c
@@ -6,6 +6,8 @@ SRCS+=	flt_rounds.c
 # Common ieee754 constants and functions
 SRCS+=	infinityf_ieee754.c infinity_ieee754.c infinityl_ieee754.c
 SRCS+=	fpclassifyf_ieee754.c fpclassifyd_ieee754.c fpclassifyl_ieee754.c
+SRCS+=	fpgetmask.c fpgetround.c fpgetsticky.c
+SRCS+=	fpsetmask.c fpsetround.c fpsetsticky.c
 SRCS+=	isfinitef_ieee754.c isfinited_ieee754.c isfinitel_ieee754.c
 SRCS+=	isinff_ieee754.c isinfd_ieee754.c isinfl_ieee754.c
 SRCS+=	isnanf_ieee754.c isnand_ieee754.c isnanl_ieee754.c

Added files:

Index: src/lib/libc/arch/aarch64/gen/fpsetmask.c
diff -u /dev/null src/lib/libc/arch/aarch64/gen/fpsetmask.c:1.1
--- /dev/null	Tue Jul  7 21:40:19 2015
+++ src/lib/libc/arch/aarch64/gen/fpsetmask.c	Tue Jul  7 21:40:19 2015
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 2015 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+
+__RCSID($NetBSD: fpsetmask.c,v 1.1 2015/07/07 21:40:19 matt Exp $);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/bitops.h
+
+#include namespace.h
+
+#include ieeefp.h
+
+#include aarch64/armreg.h
+
+__weak_alias(fpsetmask,_fpsetmask);
+
+fp_except_t
+fpsetmask(fp_except_t mask)
+{
+	const uint32_t old_fpcr = reg_fpcr_read();
+	const uint32_t new_fpcr = (old_fpcr  ~FPCR_ESUM)
+	| __SHIFTIN(mask, FPCR_ESUM);
+	reg_fpcr_write(new_fpcr);
+	return __SHIFTOUT(old_fpcr, FPCR_ESUM);
+}
Index: src/lib/libc/arch/aarch64/gen/fpsetround.c
diff -u /dev/null src/lib/libc/arch/aarch64/gen/fpsetround.c:1.1
--- /dev/null	Tue Jul  7 21:40:19 2015
+++ src/lib/libc/arch/aarch64/gen/fpsetround.c	Tue Jul  7 21:40:19 2015
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 2015 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.

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

2015-07-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul  5 22:07:09 UTC 2015

Added Files:
src/lib/libc/arch/aarch64/gen: fpgetmask.c fpgetround.c fpgetsticky.c

Log Message:
Some test programs require these.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/libc/arch/aarch64/gen/fpgetmask.c \
src/lib/libc/arch/aarch64/gen/fpgetround.c \
src/lib/libc/arch/aarch64/gen/fpgetsticky.c

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

Added files:

Index: src/lib/libc/arch/aarch64/gen/fpgetmask.c
diff -u /dev/null src/lib/libc/arch/aarch64/gen/fpgetmask.c:1.1
--- /dev/null	Sun Jul  5 22:07:09 2015
+++ src/lib/libc/arch/aarch64/gen/fpgetmask.c	Sun Jul  5 22:07:09 2015
@@ -0,0 +1,50 @@
+/*-
+ * Copyright (c) 2015 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+
+__RCSID($NetBSD: fpgetmask.c,v 1.1 2015/07/05 22:07:09 matt Exp $);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/bitops.h
+
+#include namespace.h
+
+#include ieeefp.h
+
+#include aarch64/armreg.h
+
+__weak_alias(fpgetmask,_fpgetmask);
+
+fp_except_t
+fpgetmask(void)
+{
+	return __SHIFTOUT(reg_fpcr_read(), FPCR_ESUM);
+}
Index: src/lib/libc/arch/aarch64/gen/fpgetround.c
diff -u /dev/null src/lib/libc/arch/aarch64/gen/fpgetround.c:1.1
--- /dev/null	Sun Jul  5 22:07:09 2015
+++ src/lib/libc/arch/aarch64/gen/fpgetround.c	Sun Jul  5 22:07:09 2015
@@ -0,0 +1,50 @@
+/*-
+ * Copyright (c) 2015 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+
+__RCSID($NetBSD: fpgetround.c,v 1.1 2015/07/05 22:07:09 matt Exp $);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/bitops.h
+
+#include namespace.h
+
+#include ieeefp.h
+
+#include aarch64/armreg.h
+
+__weak_alias(fpgetround,_fpgetround);
+
+fp_rnd_t
+fpgetround(void)
+{
+	return __SHIFTOUT(reg_fpcr_read(), FPCR_RMODE);
+}
Index: src/lib/libc/arch/aarch64/gen/fpgetsticky.c
diff -u /dev/null src/lib/libc/arch/aarch64/gen/fpgetsticky.c:1.1
--- /dev/null	Sun Jul  5 22:07:09