CVS commit: src/lib/libc/arch/x86_64/sys

2020-10-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Oct 19 11:29:26 UTC 2020

Modified Files:
src/lib/libc/arch/x86_64/sys: __sigtramp2.S

Log Message:
Restore RSP from mcontext

Fixes unwinding of multiple frames without base pointer.

Patch by: Nikhil Benesch via PR lib/55719


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/arch/x86_64/sys/__sigtramp2.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/x86_64/sys/__sigtramp2.S
diff -u src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.8 src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.9
--- src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.8	Mon Oct 12 17:55:54 2020
+++ src/lib/libc/arch/x86_64/sys/__sigtramp2.S	Mon Oct 19 11:29:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: __sigtramp2.S,v 1.8 2020/10/12 17:55:54 kamil Exp $	*/
+/*	$NetBSD: __sigtramp2.S,v 1.9 2020/10/19 11:29:26 kamil Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -58,7 +58,7 @@
 	.cfi_offset rsi, UC_GREGS_RSI
 	.cfi_offset rdi, UC_GREGS_RDI
 	.cfi_offset rbp, UC_GREGS_RBP
-	/* The unwinder will use the CFA to restore RSP. */
+	.cfi_offset rsp, UC_GREGS_RSP
 	.cfi_offset r8,  UC_GREGS_R8
 	.cfi_offset r9,  UC_GREGS_R9
 	.cfi_offset r10, UC_GREGS_R10



CVS commit: src/lib/libc/arch/x86_64

2020-10-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Oct 12 21:33:46 UTC 2020

Modified Files:
src/lib/libc/arch/x86_64: genassym.cf

Log Message:
Add CVS Id


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/x86_64/genassym.cf

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/x86_64/genassym.cf
diff -u src/lib/libc/arch/x86_64/genassym.cf:1.1 src/lib/libc/arch/x86_64/genassym.cf:1.2
--- src/lib/libc/arch/x86_64/genassym.cf:1.1	Mon Oct 12 17:55:53 2020
+++ src/lib/libc/arch/x86_64/genassym.cf	Mon Oct 12 21:33:46 2020
@@ -1,3 +1,4 @@
+#	$NetBSD: genassym.cf,v 1.2 2020/10/12 21:33:46 kamil Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.



CVS commit: src/lib/libc/arch/x86_64

2020-10-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Oct 12 17:55:54 UTC 2020

Modified Files:
src/lib/libc/arch/x86_64: Makefile.inc
src/lib/libc/arch/x86_64/sys: __sigtramp2.S
Added Files:
src/lib/libc/arch/x86_64: genassym.cf

Log Message:
Decorate the x86_64 signal trampoline with CFI attributes easing unwinding

Combine the approach provided by Nikhil Benesch and Andrew Cagney.

Now, the unwinders (in gccgo, backtrace(3), etc) can unwind properly
the stack from a signal handler.

Fixes lib/55719 by Nikhil Benesch


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/x86_64/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/arch/x86_64/genassym.cf
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/arch/x86_64/sys/__sigtramp2.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/x86_64/Makefile.inc
diff -u src/lib/libc/arch/x86_64/Makefile.inc:1.6 src/lib/libc/arch/x86_64/Makefile.inc:1.7
--- src/lib/libc/arch/x86_64/Makefile.inc:1.6	Wed Jul 15 14:27:49 2015
+++ src/lib/libc/arch/x86_64/Makefile.inc	Mon Oct 12 17:55:53 2020
@@ -1,5 +1,7 @@
-#	$NetBSD: Makefile.inc,v 1.6 2015/07/15 14:27:49 pooka Exp $
+#	$NetBSD: Makefile.inc,v 1.7 2020/10/12 17:55:53 kamil Exp $
 
 .if ${RUMPRUN} != "yes"
 SRCS+=	__sigaction14_sigtramp.c __sigtramp2.S
 .endif
+
+CPPFLAGS+=	-I.

Index: src/lib/libc/arch/x86_64/sys/__sigtramp2.S
diff -u src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.7 src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.8
--- src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.7	Mon Dec  2 01:38:54 2019
+++ src/lib/libc/arch/x86_64/sys/__sigtramp2.S	Mon Oct 12 17:55:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: __sigtramp2.S,v 1.7 2019/12/02 01:38:54 christos Exp $	*/
+/*	$NetBSD: __sigtramp2.S,v 1.8 2020/10/12 17:55:54 kamil Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,14 +36,40 @@
  */
 
 #include "SYS.h"
+#include "assym.h"
 
 /*
  * The x86-64 signal trampoline is invoked only to return from
  * the signal; the kernel calls the signal handler directly.
+ *
+ * The unwind entry includes the one byte prior to the trampoline
+ * because the unwinder will look up (return PC - 1) while unwinding.
+ * Normally (return PC - 1) computes an address inside the call
+ * instruction that created the child frame, but here there is no call
+ * instruction so we have to manually add padding.
  */
+	.cfi_startproc simple
+	.cfi_signal_frame
+	.cfi_def_cfa r15, 0
+	.cfi_offset rax, UC_GREGS_RAX
+	.cfi_offset rdx, UC_GREGS_RDX
+	.cfi_offset rcx, UC_GREGS_RCX
+	.cfi_offset rbx, UC_GREGS_RBX
+	.cfi_offset rsi, UC_GREGS_RSI
+	.cfi_offset rdi, UC_GREGS_RDI
+	.cfi_offset rbp, UC_GREGS_RBP
+	/* The unwinder will use the CFA to restore RSP. */
+	.cfi_offset r8,  UC_GREGS_R8
+	.cfi_offset r9,  UC_GREGS_R9
+	.cfi_offset r10, UC_GREGS_R10
+	.cfi_offset r11, UC_GREGS_R11
+	.cfi_offset r12, UC_GREGS_R12
+	.cfi_offset r13, UC_GREGS_R13
+	.cfi_offset r14, UC_GREGS_R14
+	.cfi_offset r15, UC_GREGS_R15
+	.cfi_offset rip, UC_GREGS_RIP
+	nop
 NENTRY(__sigtramp_siginfo_2)
-	.cfi_startproc
-	.cfi_def_cfa rsp, 8
 	movq	%r15,%rdi
 	movq	$SYS_setcontext, %rax
 	syscall

Added files:

Index: src/lib/libc/arch/x86_64/genassym.cf
diff -u /dev/null src/lib/libc/arch/x86_64/genassym.cf:1.1
--- /dev/null	Mon Oct 12 17:55:54 2020
+++ src/lib/libc/arch/x86_64/genassym.cf	Mon Oct 12 17:55:53 2020
@@ -0,0 +1,45 @@
+#
+# Copyright (c) 2020 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# 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 
+
+define UC_GREGS_RAX offsetof(ucontext_t, uc_mcontext.__gregs[_REG_RAX])
+define UC_GREGS_RDX offsetof(ucontext_t, 

CVS commit: src/lib/libc/arch/x86_64/sys

2019-12-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec  2 01:38:54 UTC 2019

Modified Files:
src/lib/libc/arch/x86_64/sys: __sigtramp2.S

Log Message:
Add cfi annotations so that gdb can unwind the stack through signal handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/x86_64/sys/__sigtramp2.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/x86_64/sys/__sigtramp2.S
diff -u src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.6 src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.7
--- src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.6	Thu May 22 11:01:57 2014
+++ src/lib/libc/arch/x86_64/sys/__sigtramp2.S	Sun Dec  1 20:38:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: __sigtramp2.S,v 1.6 2014/05/22 15:01:57 uebayasi Exp $	*/
+/*	$NetBSD: __sigtramp2.S,v 1.7 2019/12/02 01:38:54 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,10 +42,13 @@
  * the signal; the kernel calls the signal handler directly.
  */
 NENTRY(__sigtramp_siginfo_2)
+	.cfi_startproc
+	.cfi_def_cfa rsp, 8
 	movq	%r15,%rdi
 	movq	$SYS_setcontext, %rax
 	syscall
 	movq	$-1,%rdi /* if we return here, something is wrong */
 	movq	$SYS_exit, %rax
 	syscall
+	.cfi_endproc
 END(__sigtramp_siginfo_2)



CVS commit: src/lib/libc/arch/x86_64/sys

2014-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov 24 15:33:18 UTC 2014

Modified Files:
src/lib/libc/arch/x86_64/sys: ptrace.S

Log Message:
Fix ptrace %rcx corruption when pthread_errno() is used. Small example:
#include sys/types.h
#include stdio.h
#include sys/ptrace.h
int main(void) { ptrace(18, getpid(), NULL, 0xabcd); }
The -lpthread cases pases 0 instead of 0xabcd


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/x86_64/sys/ptrace.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/x86_64/sys/ptrace.S
diff -u src/lib/libc/arch/x86_64/sys/ptrace.S:1.5 src/lib/libc/arch/x86_64/sys/ptrace.S:1.6
--- src/lib/libc/arch/x86_64/sys/ptrace.S:1.5	Thu May 22 11:01:57 2014
+++ src/lib/libc/arch/x86_64/sys/ptrace.S	Mon Nov 24 10:33:18 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.S,v 1.5 2014/05/22 15:01:57 uebayasi Exp $	*/
+/*	$NetBSD: ptrace.S,v 1.6 2014/11/24 15:33:18 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -36,7 +36,7 @@
 
 #include machine/asm.h
 #if defined(SYSLIBC_SCCS)  !defined(lint)
-	RCSID($NetBSD: ptrace.S,v 1.5 2014/05/22 15:01:57 uebayasi Exp $)
+	RCSID($NetBSD: ptrace.S,v 1.6 2014/11/24 15:33:18 christos Exp $)
 #endif /* SYSLIBC_SCCS and not lint */
 
 #include SYS.h
@@ -44,12 +44,21 @@
 	.globl	_C_LABEL(__errno)
 
 ENTRY(ptrace)
+	/*
+	 * The following code calls __errno() to set it to 0 before
+	 * calling ptrace(2). The libc version of __errno() does not use
+	 * any registers, but the libpthread version clobbers %rcx
+	 * before we get a chance to store it in %r10. So we save it
+	 * in %r10 and restore it.
+	 */
+	movq	%rcx, %r10
 #ifdef __PIC__
 	call	PIC_PLT(_C_LABEL(__errno))
 #else
 	call	_C_LABEL(__errno)
 #endif /* __PIC__ */
 	movl	$0,(%rax)
+	movq	%r10, %rcx
 	SYSTRAP(ptrace)
 	jc	err
 	ret



CVS commit: src/lib/libc/arch/x86_64

2014-05-22 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu May 22 14:38:38 UTC 2014

Modified Files:
src/lib/libc/arch/x86_64: SYS.h

Log Message:
Put missing END() markers to set ELF symbol size.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/arch/x86_64/SYS.h

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/x86_64/SYS.h
diff -u src/lib/libc/arch/x86_64/SYS.h:1.11 src/lib/libc/arch/x86_64/SYS.h:1.12
--- src/lib/libc/arch/x86_64/SYS.h:1.11	Fri Nov 18 20:43:01 2011
+++ src/lib/libc/arch/x86_64/SYS.h	Thu May 22 14:38:38 2014
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)SYS.h	5.5 (Berkeley) 5/7/91
- *	$NetBSD: SYS.h,v 1.11 2011/11/18 20:43:01 joerg Exp $
+ *	$NetBSD: SYS.h,v 1.12 2014/05/22 14:38:38 uebayasi Exp $
  */
 
 #include machine/asm.h
@@ -66,13 +66,15 @@
 
 #define PSEUDO_NOERROR(x,y)		\
 	_SYSCALL_NOERROR(x,y);		\
-	ret
+	ret;\
+	END(x)
 
 #define PSEUDO(x,y)			\
 	_SYSCALL_NOERROR(x,y);		\
 	jc 2f;\
 	ret;\
-	2: _SYSCALL_ERR
+	2: _SYSCALL_ERR;		\
+	END(x)
 
 #define RSYSCALL_NOERROR(x)		\
 	PSEUDO_NOERROR(x,x)



CVS commit: src/lib/libc/arch/x86_64

2014-05-22 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu May 22 15:01:57 UTC 2014

Modified Files:
src/lib/libc/arch/x86_64/gen: __setjmp14.S __sigsetjmp14.S _setjmp.S
alloca.S fabs.S flt_rounds.S fpgetmask.S fpgetprec.S fpgetround.S
fpgetsticky.S fpsetmask.S fpsetprec.S fpsetround.S fpsetsticky.S
resumecontext.S swapcontext.S
src/lib/libc/arch/x86_64/stdlib: abs.S div.S labs.S ldiv.S
src/lib/libc/arch/x86_64/string: strncmp.S swab.S
src/lib/libc/arch/x86_64/sys: __clone.S __sigtramp2.S __vfork14.S brk.S
cerror.S exect.S fork.S getcontext.S pipe.S ptrace.S sbrk.S

Log Message:
Put missing END() markers to set ELF symbol size.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/x86_64/gen/__setjmp14.S \
src/lib/libc/arch/x86_64/gen/__sigsetjmp14.S
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/x86_64/gen/_setjmp.S \
src/lib/libc/arch/x86_64/gen/alloca.S \
src/lib/libc/arch/x86_64/gen/fpgetprec.S \
src/lib/libc/arch/x86_64/gen/fpsetprec.S
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/x86_64/gen/fabs.S \
src/lib/libc/arch/x86_64/gen/fpgetmask.S \
src/lib/libc/arch/x86_64/gen/fpgetsticky.S
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/x86_64/gen/flt_rounds.S
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/x86_64/gen/fpgetround.S \
src/lib/libc/arch/x86_64/gen/fpsetround.S
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/x86_64/gen/fpsetmask.S \
src/lib/libc/arch/x86_64/gen/fpsetsticky.S \
src/lib/libc/arch/x86_64/gen/resumecontext.S \
src/lib/libc/arch/x86_64/gen/swapcontext.S
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/x86_64/stdlib/abs.S \
src/lib/libc/arch/x86_64/stdlib/labs.S \
src/lib/libc/arch/x86_64/stdlib/ldiv.S
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/x86_64/stdlib/div.S
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/x86_64/string/strncmp.S \
src/lib/libc/arch/x86_64/string/swab.S
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/x86_64/sys/__clone.S \
src/lib/libc/arch/x86_64/sys/__vfork14.S \
src/lib/libc/arch/x86_64/sys/ptrace.S
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/x86_64/sys/__sigtramp2.S \
src/lib/libc/arch/x86_64/sys/brk.S src/lib/libc/arch/x86_64/sys/sbrk.S
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/x86_64/sys/cerror.S
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/x86_64/sys/exect.S \
src/lib/libc/arch/x86_64/sys/fork.S \
src/lib/libc/arch/x86_64/sys/getcontext.S
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/x86_64/sys/pipe.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/x86_64/gen/__setjmp14.S
diff -u src/lib/libc/arch/x86_64/gen/__setjmp14.S:1.2 src/lib/libc/arch/x86_64/gen/__setjmp14.S:1.3
--- src/lib/libc/arch/x86_64/gen/__setjmp14.S:1.2	Thu Sep 12 15:36:16 2013
+++ src/lib/libc/arch/x86_64/gen/__setjmp14.S	Thu May 22 15:01:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: __setjmp14.S,v 1.2 2013/09/12 15:36:16 joerg Exp $	*/
+/*	$NetBSD: __setjmp14.S,v 1.3 2014/05/22 15:01:56 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
 #include machine/setjmp.h
 
 #if defined(LIBC_SCCS)
-	RCSID($NetBSD: __setjmp14.S,v 1.2 2013/09/12 15:36:16 joerg Exp $)
+	RCSID($NetBSD: __setjmp14.S,v 1.3 2014/05/22 15:01:56 uebayasi Exp $)
 #endif
 
 /*
@@ -75,6 +75,7 @@ ENTRY(__setjmp14)
 #endif
 2:	xorl	%eax,%eax
 	ret
+END(__setjmp14)
 
 ENTRY(__longjmp14)
 	movq	%rdi,%r12
@@ -106,3 +107,4 @@ ENTRY(__longjmp14)
 	incl	%eax
 1:	movq	%r11,0(%rsp)
 	ret
+END(__longjmp14)
Index: src/lib/libc/arch/x86_64/gen/__sigsetjmp14.S
diff -u src/lib/libc/arch/x86_64/gen/__sigsetjmp14.S:1.2 src/lib/libc/arch/x86_64/gen/__sigsetjmp14.S:1.3
--- src/lib/libc/arch/x86_64/gen/__sigsetjmp14.S:1.2	Thu Sep 12 15:36:16 2013
+++ src/lib/libc/arch/x86_64/gen/__sigsetjmp14.S	Thu May 22 15:01:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: __sigsetjmp14.S,v 1.2 2013/09/12 15:36:16 joerg Exp $	*/
+/*	$NetBSD: __sigsetjmp14.S,v 1.3 2014/05/22 15:01:56 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
 #include machine/setjmp.h
 
 #if defined(LIBC_SCCS)
-	RCSID($NetBSD: __sigsetjmp14.S,v 1.2 2013/09/12 15:36:16 joerg Exp $)
+	RCSID($NetBSD: __sigsetjmp14.S,v 1.3 2014/05/22 15:01:56 uebayasi Exp $)
 #endif
 
 /*
@@ -79,6 +79,7 @@ ENTRY(__sigsetjmp14)
 #endif
 2:	xorl	%eax,%eax
 	ret
+END(__sigsetjmp14)
 
 ENTRY(__siglongjmp14)
 	movq	%rdi,%r12
@@ -110,3 +111,4 @@ ENTRY(__siglongjmp14)
 	incl	%eax
 1:	movq	%r11,0(%rsp)
 	ret
+END(__siglongjmp14)

Index: src/lib/libc/arch/x86_64/gen/_setjmp.S
diff -u src/lib/libc/arch/x86_64/gen/_setjmp.S:1.1 src/lib/libc/arch/x86_64/gen/_setjmp.S:1.2
--- src/lib/libc/arch/x86_64/gen/_setjmp.S:1.1	Tue Jun 19 00:25:02 2001
+++ src/lib/libc/arch/x86_64/gen/_setjmp.S	Thu May 22 15:01:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: _setjmp.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $	*/
+/*	$NetBSD: _setjmp.S,v 1.2 

CVS commit: src/lib/libc/arch/x86_64/sys

2014-05-14 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Wed May 14 06:38:10 UTC 2014

Modified Files:
src/lib/libc/arch/x86_64/sys: __sigaction14_sigtramp.c

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.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/x86_64/sys/__sigaction14_sigtramp.c
diff -u src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.c:1.10 src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.c:1.11
--- src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.c:1.10	Mon Apr 28 20:22:58 2008
+++ src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.c	Wed May 14 06:38:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: __sigaction14_sigtramp.c,v 1.10 2008/04/28 20:22:58 martin Exp $	*/
+/*	$NetBSD: __sigaction14_sigtramp.c,v 1.11 2014/05/14 06:38:09 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: __sigaction14_sigtramp.c,v 1.10 2008/04/28 20:22:58 martin Exp $);
+__RCSID($NetBSD: __sigaction14_sigtramp.c,v 1.11 2014/05/14 06:38:09 uebayasi Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include sys/types.h
@@ -41,7 +41,7 @@ __RCSID($NetBSD: __sigaction14_sigtramp
 
 #include extern.h
 
- __weak_alias(__sigaction14, __libc_sigaction14)
+__weak_alias(__sigaction14, __libc_sigaction14)
 
 int
 __libc_sigaction14(int sig, const struct sigaction *act, struct sigaction *oact)



CVS commit: src/lib/libc/arch/x86_64/string

2013-11-23 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Nov 23 22:23:31 UTC 2013

Modified Files:
src/lib/libc/arch/x86_64/string: Makefile.inc

Log Message:
Remove now-non-existant bzero.S from sources list.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/x86_64/string/Makefile.inc

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/x86_64/string/Makefile.inc
diff -u src/lib/libc/arch/x86_64/string/Makefile.inc:1.4 src/lib/libc/arch/x86_64/string/Makefile.inc:1.5
--- src/lib/libc/arch/x86_64/string/Makefile.inc:1.4	Thu Jul 30 20:57:17 2009
+++ src/lib/libc/arch/x86_64/string/Makefile.inc	Sat Nov 23 22:23:31 2013
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile.inc,v 1.4 2009/07/30 20:57:17 dsl Exp $
+#	$NetBSD: Makefile.inc,v 1.5 2013/11/23 22:23:31 jakllsch Exp $
 
 # objects built from assembler sources
-SRCS+=	bcmp.S bcopy.S bzero.S ffs.S memchr.S memcmp.S \
+SRCS+=	bcmp.S bcopy.S ffs.S memchr.S memcmp.S \
 	memcpy.S memmove.S memset.S strcat.S strchr.S \
 	strcmp.S strcpy.S strlen.S strncmp.S strrchr.S swab.S



CVS commit: src/lib/libc/arch/x86_64/string

2013-11-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov 24 03:50:17 UTC 2013

Modified Files:
src/lib/libc/arch/x86_64/string: Makefile.inc

Log Message:
No need for bzero, memset provides it.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/x86_64/string/Makefile.inc

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/x86_64/string/Makefile.inc
diff -u src/lib/libc/arch/x86_64/string/Makefile.inc:1.5 src/lib/libc/arch/x86_64/string/Makefile.inc:1.6
--- src/lib/libc/arch/x86_64/string/Makefile.inc:1.5	Sat Nov 23 17:23:31 2013
+++ src/lib/libc/arch/x86_64/string/Makefile.inc	Sat Nov 23 22:50:17 2013
@@ -1,6 +1,7 @@
-#	$NetBSD: Makefile.inc,v 1.5 2013/11/23 22:23:31 jakllsch Exp $
+#	$NetBSD: Makefile.inc,v 1.6 2013/11/24 03:50:17 christos Exp $
 
 # objects built from assembler sources
 SRCS+=	bcmp.S bcopy.S ffs.S memchr.S memcmp.S \
 	memcpy.S memmove.S memset.S strcat.S strchr.S \
 	strcmp.S strcpy.S strlen.S strncmp.S strrchr.S swab.S
+NO_SRCS+= bzero.c



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

2012-01-19 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Thu Jan 19 16:37:18 UTC 2012

Modified Files:
src/lib/libc/arch/x86_64/gen: fpsetmask.S

Log Message:
let one bit more through to SSE, to make FP_X_IMP work


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/x86_64/gen/fpsetmask.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/x86_64/gen/fpsetmask.S
diff -u src/lib/libc/arch/x86_64/gen/fpsetmask.S:1.4 src/lib/libc/arch/x86_64/gen/fpsetmask.S:1.5
--- src/lib/libc/arch/x86_64/gen/fpsetmask.S:1.4	Wed Oct 19 15:24:58 2011
+++ src/lib/libc/arch/x86_64/gen/fpsetmask.S	Thu Jan 19 16:37:18 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetmask.S,v 1.4 2011/10/19 15:24:58 njoly Exp $	*/
+/*	$NetBSD: fpsetmask.S,v 1.5 2012/01/19 16:37:18 drochner Exp $	*/
 
 /*
  * Written by Frank van der Linden at Wasabi Systems for NetBSD.
@@ -33,7 +33,7 @@ ENTRY(fpsetmask)
 
 	stmxcsr	-4(%rsp)
 	movl	-4(%rsp), %edx
-	andl	$0xf07f, %edx
+	andl	$0xe07f, %edx
 	sall	$7, %edi
 	orl	%edi, %edx
 	movl	%edx,-4(%rsp)



CVS commit: src/lib/libc/arch/x86_64/sys

2011-11-18 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Nov 18 20:17:46 UTC 2011

Modified Files:
src/lib/libc/arch/x86_64/sys: cerror.S

Log Message:
Explicitly mark __cerror as hidden


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/x86_64/sys/cerror.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/x86_64/sys/cerror.S
diff -u src/lib/libc/arch/x86_64/sys/cerror.S:1.3 src/lib/libc/arch/x86_64/sys/cerror.S:1.4
--- src/lib/libc/arch/x86_64/sys/cerror.S:1.3	Thu Aug  7 16:42:37 2003
+++ src/lib/libc/arch/x86_64/sys/cerror.S	Fri Nov 18 20:17:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cerror.S,v 1.3 2003/08/07 16:42:37 agc Exp $	*/
+/*	$NetBSD: cerror.S,v 1.4 2011/11/18 20:17:46 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -36,12 +36,13 @@
 
 #include machine/asm.h
 #if defined(SYSLIBC_SCCS)  !defined(lint)
-	RCSID($NetBSD: cerror.S,v 1.3 2003/08/07 16:42:37 agc Exp $)
+	RCSID($NetBSD: cerror.S,v 1.4 2011/11/18 20:17:46 joerg Exp $)
 #endif /* SYSLIBC_SCCS and not lint */
 
 #include SYS.h
 
 	.globl	_C_LABEL(__errno)
+	.hidden	CERROR
 
 _ENTRY(CERROR)
 	pushq	%r12



CVS commit: src/lib/libc/arch/x86_64

2011-11-18 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Nov 18 20:43:01 UTC 2011

Modified Files:
src/lib/libc/arch/x86_64: SYS.h
src/lib/libc/arch/x86_64/sys: __clone.S __vfork14.S brk.S exect.S
ptrace.S sbrk.S

Log Message:
Exploit hidden __cerror


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/arch/x86_64/SYS.h
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/x86_64/sys/__clone.S \
src/lib/libc/arch/x86_64/sys/exect.S \
src/lib/libc/arch/x86_64/sys/ptrace.S
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/x86_64/sys/__vfork14.S \
src/lib/libc/arch/x86_64/sys/brk.S src/lib/libc/arch/x86_64/sys/sbrk.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/x86_64/SYS.h
diff -u src/lib/libc/arch/x86_64/SYS.h:1.10 src/lib/libc/arch/x86_64/SYS.h:1.11
--- src/lib/libc/arch/x86_64/SYS.h:1.10	Fri Nov 23 07:36:05 2007
+++ src/lib/libc/arch/x86_64/SYS.h	Fri Nov 18 20:43:01 2011
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)SYS.h	5.5 (Berkeley) 5/7/91
- *	$NetBSD: SYS.h,v 1.10 2007/11/23 07:36:05 dsl Exp $
+ *	$NetBSD: SYS.h,v 1.11 2011/11/18 20:43:01 joerg Exp $
  */
 
 #include machine/asm.h
@@ -49,14 +49,8 @@
 	ENTRY(x);			\
 	SYSTRAP(y)
 
-#ifdef PIC
 #define _SYSCALL_ERR	 		\
-	mov PIC_GOT(CERROR), %rcx;	\
-	jmp *%rcx
-#else
-#define _SYSCALL_ERR			\
 	jmp CERROR
-#endif
 
 #define _SYSCALL(x,y)			\
 	.text; _ALIGN_TEXT;		\

Index: src/lib/libc/arch/x86_64/sys/__clone.S
diff -u src/lib/libc/arch/x86_64/sys/__clone.S:1.2 src/lib/libc/arch/x86_64/sys/__clone.S:1.3
--- src/lib/libc/arch/x86_64/sys/__clone.S:1.2	Thu Jun  6 20:51:17 2002
+++ src/lib/libc/arch/x86_64/sys/__clone.S	Fri Nov 18 20:43:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: __clone.S,v 1.2 2002/06/06 20:51:17 fvdl Exp $	*/
+/*	$NetBSD: __clone.S,v 1.3 2011/11/18 20:43:01 joerg Exp $	*/
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -93,9 +93,4 @@ ENTRY(__clone)
 5:
 	popq	%r13
 	popq	%r12
-#ifdef PIC
-	movq	PIC_GOT(CERROR),%rdx
-	jmp	*%rdx
-#else
 	jmp	CERROR
-#endif
Index: src/lib/libc/arch/x86_64/sys/exect.S
diff -u src/lib/libc/arch/x86_64/sys/exect.S:1.2 src/lib/libc/arch/x86_64/sys/exect.S:1.3
--- src/lib/libc/arch/x86_64/sys/exect.S:1.2	Thu Aug  7 16:42:37 2003
+++ src/lib/libc/arch/x86_64/sys/exect.S	Fri Nov 18 20:43:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: exect.S,v 1.2 2003/08/07 16:42:37 agc Exp $	*/
+/*	$NetBSD: exect.S,v 1.3 2011/11/18 20:43:01 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -36,7 +36,7 @@
 
 #include machine/asm.h
 #if defined(SYSLIBC_SCCS)  !defined(lint)
-	RCSID($NetBSD: exect.S,v 1.2 2003/08/07 16:42:37 agc Exp $)
+	RCSID($NetBSD: exect.S,v 1.3 2011/11/18 20:43:01 joerg Exp $)
 #endif /* SYSLIBC_SCCS and not lint */
 
 #include SYS.h
@@ -47,9 +47,4 @@ ENTRY(exect)
 	orb	$(PSL_T8),1(%rsp)
 	popfq
 	SYSTRAP(execve)
-#ifdef PIC
-	movq	PIC_GOT(CERROR), %rcx
-	jmp	*%rcx
-#else
 	jmp	CERROR
-#endif
Index: src/lib/libc/arch/x86_64/sys/ptrace.S
diff -u src/lib/libc/arch/x86_64/sys/ptrace.S:1.2 src/lib/libc/arch/x86_64/sys/ptrace.S:1.3
--- src/lib/libc/arch/x86_64/sys/ptrace.S:1.2	Thu Aug  7 16:42:37 2003
+++ src/lib/libc/arch/x86_64/sys/ptrace.S	Fri Nov 18 20:43:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.S,v 1.2 2003/08/07 16:42:37 agc Exp $	*/
+/*	$NetBSD: ptrace.S,v 1.3 2011/11/18 20:43:01 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -36,7 +36,7 @@
 
 #include machine/asm.h
 #if defined(SYSLIBC_SCCS)  !defined(lint)
-	RCSID($NetBSD: ptrace.S,v 1.2 2003/08/07 16:42:37 agc Exp $)
+	RCSID($NetBSD: ptrace.S,v 1.3 2011/11/18 20:43:01 joerg Exp $)
 #endif /* SYSLIBC_SCCS and not lint */
 
 #include SYS.h
@@ -54,9 +54,4 @@ ENTRY(ptrace)
 	jc	err
 	ret
 err:
-#ifdef PIC
-	movq	PIC_GOT(CERROR), %rcx
-	jmp	*%rcx
-#else
 	jmp	CERROR
-#endif

Index: src/lib/libc/arch/x86_64/sys/__vfork14.S
diff -u src/lib/libc/arch/x86_64/sys/__vfork14.S:1.3 src/lib/libc/arch/x86_64/sys/__vfork14.S:1.4
--- src/lib/libc/arch/x86_64/sys/__vfork14.S:1.3	Thu Aug  7 16:42:37 2003
+++ src/lib/libc/arch/x86_64/sys/__vfork14.S	Fri Nov 18 20:43:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: __vfork14.S,v 1.3 2003/08/07 16:42:37 agc Exp $	*/
+/*	$NetBSD: __vfork14.S,v 1.4 2011/11/18 20:43:01 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -36,7 +36,7 @@
 
 #include machine/asm.h
 #if defined(SYSLIBC_SCCS)  !defined(lint)
-	RCSID($NetBSD: __vfork14.S,v 1.3 2003/08/07 16:42:37 agc Exp $)
+	RCSID($NetBSD: __vfork14.S,v 1.4 2011/11/18 20:43:01 joerg Exp $)
 #endif /* SYSLIBC_SCCS and not lint */
 
 #include SYS.h
@@ -57,9 +57,4 @@ ENTRY(__vfork14)
 	jmp	*%r9
 err:
 	pushq	%r9
-#ifdef PIC
-	movq	PIC_GOT(CERROR), %rcx
-	jmp	*%rcx
-#else
 	jmp	CERROR
-#endif
Index: src/lib/libc/arch/x86_64/sys/brk.S
diff -u src/lib/libc/arch/x86_64/sys/brk.S:1.3 

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

2011-10-19 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Oct 19 15:24:58 UTC 2011

Modified Files:
src/lib/libc/arch/x86_64/gen: fpsetmask.S

Log Message:
Fix fpsetmask(3) to be able to clear bits previously set.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/x86_64/gen/fpsetmask.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/x86_64/gen/fpsetmask.S
diff -u src/lib/libc/arch/x86_64/gen/fpsetmask.S:1.3 src/lib/libc/arch/x86_64/gen/fpsetmask.S:1.4
--- src/lib/libc/arch/x86_64/gen/fpsetmask.S:1.3	Wed Jun 12 19:17:22 2002
+++ src/lib/libc/arch/x86_64/gen/fpsetmask.S	Wed Oct 19 15:24:58 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetmask.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $	*/
+/*	$NetBSD: fpsetmask.S,v 1.4 2011/10/19 15:24:58 njoly Exp $	*/
 
 /*
  * Written by Frank van der Linden at Wasabi Systems for NetBSD.
@@ -20,22 +20,25 @@ ENTRY(_fpsetmask)
 #else
 ENTRY(fpsetmask)
 #endif
-	fnstcw	-4(%rsp)
-	stmxcsr	-8(%rsp)
-	andl	$63,%edi
 	notl	%edi
+	andl	$0x003f,%edi
 
-	movl	-4(%rsp),%edx
-	movl	%edx,%eax
-	andl	%edi,%edx
+	fnstcw	-4(%rsp)
+	movl	-4(%rsp), %edx
+	movl	%edx, %eax
+	andl	$0xffc0, %edx
+	orl	%edi, %edx
 	movl	%edx,-4(%rsp)
+	fldcw	-4(%rsp)
 
-	movl	-8(%rsp),%edx
-	roll	$7,%edi
-	andl	%edi,%edx
-	movl	%edx,-8(%rsp)
+	stmxcsr	-4(%rsp)
+	movl	-4(%rsp), %edx
+	andl	$0xf07f, %edx
+	sall	$7, %edi
+	orl	%edi, %edx
+	movl	%edx,-4(%rsp)
+	ldmxcsr	-4(%rsp)
 
-	fldcw	-4(%rsp)
-	ldmxcsr	-8(%rsp)
-	andl	$63,%eax
+	notl	%eax
+	andl	$0x003f, %eax
 	ret



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

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

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

Log Message:
PR/44293: Paul Goyette: Fix the mess of the rounding code.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/x86_64/gen/flt_rounds.S
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/x86_64/gen/fpgetround.S \
src/lib/libc/arch/x86_64/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/x86_64/gen/flt_rounds.S
diff -u src/lib/libc/arch/x86_64/gen/flt_rounds.S:1.5 src/lib/libc/arch/x86_64/gen/flt_rounds.S:1.6
--- src/lib/libc/arch/x86_64/gen/flt_rounds.S:1.5	Thu Sep 29 18:55:45 2011
+++ src/lib/libc/arch/x86_64/gen/flt_rounds.S	Fri Sep 30 13:42:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: flt_rounds.S,v 1.5 2011/09/29 22:55:45 christos Exp $	*/
+/*	$NetBSD: flt_rounds.S,v 1.6 2011/09/30 17:42:34 christos Exp $	*/
 
 #include machine/asm.h
 
@@ -12,8 +12,10 @@
 	_ALIGN_TEXT
 ENTRY(__flt_rounds)
 	fnstcw	-4(%rsp)
-	movl	-4(%rsp), %eax
-	shrl	$10, %eax
+	movl	-4(%rsp), %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/x86_64/gen/fpgetround.S
diff -u src/lib/libc/arch/x86_64/gen/fpgetround.S:1.3 src/lib/libc/arch/x86_64/gen/fpgetround.S:1.4
--- src/lib/libc/arch/x86_64/gen/fpgetround.S:1.3	Wed Jun 12 15:17:22 2002
+++ src/lib/libc/arch/x86_64/gen/fpgetround.S	Fri Sep 30 13:42:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpgetround.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $	*/
+/*	$NetBSD: fpgetround.S,v 1.4 2011/09/30 17:42:34 christos Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 4, 1995
@@ -8,7 +8,7 @@
 #include machine/asm.h
 
 /*
- * XXX store only x87 state. If an application only uses the fp*
+ * XXX load only x87 state. If an application only uses the fp*
  * interface, this should be in sync with the SSE mxcsr register.
  */
 
@@ -19,7 +19,6 @@ ENTRY(_fpgetround)
 ENTRY(fpgetround)
 #endif
 	fnstcw -4(%rsp)
-	movl -4(%rsp),%eax
-	rorl $10,%eax
-	andl $3,%eax
+	movl -4(%rsp), %eax
+	andl $0x0c00, %eax
 	ret
Index: src/lib/libc/arch/x86_64/gen/fpsetround.S
diff -u src/lib/libc/arch/x86_64/gen/fpsetround.S:1.3 src/lib/libc/arch/x86_64/gen/fpsetround.S:1.4
--- src/lib/libc/arch/x86_64/gen/fpsetround.S:1.3	Wed Jun 12 15:17:22 2002
+++ src/lib/libc/arch/x86_64/gen/fpsetround.S	Fri Sep 30 13:42:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetround.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $	*/
+/*	$NetBSD: fpsetround.S,v 1.4 2011/09/30 17:42:34 christos Exp $	*/
 
 /*
  * Written by Frank van der Linden at Wasabi Systems for NetBSD.
@@ -21,28 +21,22 @@ ENTRY(_fpsetround)
 #else
 ENTRY(fpsetround)
 #endif
-	fnstcw	-4(%rsp)
-	stmxcsr	-8(%rsp)
-
-	andl	$3,%edi
 
-	movl	-4(%rsp),%edx
-	rorl	$10,%edx
-	movl	%edx,%eax
-	andl	$3,%eax
+	fnstcw	-4(%rsp)
+	movl	-4(%rsp), %edx
+	movl	%edx, %eax
+	andl	$0x0c00, %eax	
+	andl	$0xf3ff, %edx
+	orl	%edi, %edx
+	movl	%edx, -4(%rsp)
+	fldcw	-4(%rsp)
 
-	andl	$~3,%edx
+	stmxcsr	-4(%rsp)
+	movl	-4(%rsp), %edx
+	andl	$0x9fff, %edx
+	sall	$3, %edi
 	orl	%edi,%edx
-	roll	$10,%edx
 	movl	%edx,-4(%rsp)
+	ldmxcsr	-4(%rsp)
 
-	movl	-8(%rsp),%edx
-	rorl	$13,%edx
-	andl	$~3,%edx
-	orl	%edi,%edx
-	roll	$13,%edx
-	movl	%edx,-8(%rsp)
-
-	ldmxcsr	-8(%rsp)
-	fldcw	-4(%rsp)
 	ret



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

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

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

Log Message:
add a simpler version.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/x86_64/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/x86_64/gen/flt_rounds.S
diff -u src/lib/libc/arch/x86_64/gen/flt_rounds.S:1.3 src/lib/libc/arch/x86_64/gen/flt_rounds.S:1.4
--- src/lib/libc/arch/x86_64/gen/flt_rounds.S:1.3	Wed Sep 28 11:11:42 2011
+++ src/lib/libc/arch/x86_64/gen/flt_rounds.S	Thu Sep 29 18:45:20 2011
@@ -1,29 +1,20 @@
-/*	$NetBSD: flt_rounds.S,v 1.3 2011/09/28 15:11:42 christos Exp $	*/
-
-/*
- * Written by J.T. Conklin, Apr 4, 1995
- * Public domain.
- */
+/*	$NetBSD: flt_rounds.S,v 1.4 2011/09/29 22:45:20 christos Exp $	*/
 
 #include machine/asm.h
 
+/*
+ * 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)
-	fnstcw -4(%rsp)
-	movl -4(%rsp),%eax
-	shrl $10,%eax
-	andl $3,%eax
-#ifdef PIC
-	leaq _map(%rip),%rcx
-	movb (%rcx,%rax,1),%al
-#else
-	movb _map(,%rax,1),%al
-#endif
+	fnstcw	-4(%rsp)
+	movl	-4(%rsp), %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/x86_64/gen

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

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

Log Message:
even simpler.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/x86_64/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/x86_64/gen/flt_rounds.S
diff -u src/lib/libc/arch/x86_64/gen/flt_rounds.S:1.4 src/lib/libc/arch/x86_64/gen/flt_rounds.S:1.5
--- src/lib/libc/arch/x86_64/gen/flt_rounds.S:1.4	Thu Sep 29 18:45:20 2011
+++ src/lib/libc/arch/x86_64/gen/flt_rounds.S	Thu Sep 29 18:55:45 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: flt_rounds.S,v 1.4 2011/09/29 22:45:20 christos Exp $	*/
+/*	$NetBSD: flt_rounds.S,v 1.5 2011/09/29 22:55:45 christos Exp $	*/
 
 #include machine/asm.h
 
@@ -12,9 +12,8 @@
 	_ALIGN_TEXT
 ENTRY(__flt_rounds)
 	fnstcw	-4(%rsp)
-	movl	-4(%rsp), %ecx
-	shrl	$9, %ecx
-	andl	$6, %ecx
-	xorl	$1, %eax	/* map 0,1,2,3 - 1,0,3,2 */
+	movl	-4(%rsp), %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/x86_64/gen

2011-09-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 28 15:11:42 UTC 2011

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

Log Message:
Instead of using a PICGOT relocation for map, use just a pc-relative one
since it is guaranteed to be close enough. Fixes issue with binutils-2.21.1a
(probably a bug).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/x86_64/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/x86_64/gen/flt_rounds.S
diff -u src/lib/libc/arch/x86_64/gen/flt_rounds.S:1.2 src/lib/libc/arch/x86_64/gen/flt_rounds.S:1.3
--- src/lib/libc/arch/x86_64/gen/flt_rounds.S:1.2	Thu Jun  6 19:04:35 2002
+++ src/lib/libc/arch/x86_64/gen/flt_rounds.S	Wed Sep 28 11:11:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: flt_rounds.S,v 1.2 2002/06/06 23:04:35 fvdl Exp $	*/
+/*	$NetBSD: flt_rounds.S,v 1.3 2011/09/28 15:11:42 christos Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 4, 1995
@@ -21,7 +21,7 @@ ENTRY(__flt_rounds)
 	shrl $10,%eax
 	andl $3,%eax
 #ifdef PIC
-	leaq PIC_GOT(_map),%rcx
+	leaq _map(%rip),%rcx
 	movb (%rcx,%rax,1),%al
 #else
 	movb _map(,%rax,1),%al



CVS commit: src/lib/libc/arch/x86_64/gdtoa

2011-03-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 20 23:16:07 UTC 2011

Modified Files:
src/lib/libc/arch/x86_64/gdtoa: gd_qnan.h

Log Message:
Add ld formats for the unit-tests.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/x86_64/gdtoa/gd_qnan.h

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/x86_64/gdtoa/gd_qnan.h
diff -u src/lib/libc/arch/x86_64/gdtoa/gd_qnan.h:1.1 src/lib/libc/arch/x86_64/gdtoa/gd_qnan.h:1.2
--- src/lib/libc/arch/x86_64/gdtoa/gd_qnan.h:1.1	Wed Jan 25 10:33:28 2006
+++ src/lib/libc/arch/x86_64/gdtoa/gd_qnan.h	Sun Mar 20 19:16:07 2011
@@ -1,8 +1,12 @@
-/* $NetBSD: gd_qnan.h,v 1.1 2006/01/25 15:33:28 kleink Exp $ */
+/* $NetBSD: gd_qnan.h,v 1.2 2011/03/20 23:16:07 christos Exp $ */
 
 #define f_QNAN 0x7fc0
 #define d_QNAN0 0x0
 #define d_QNAN1 0x7ff8
+#define ld_QNAN0 0x0
+#define ld_QNAN1 0xc000
+#define ld_QNAN2 0x7fff
+#define ld_QNAN3 0x0
 #define ldus_QNAN0 0x0
 #define ldus_QNAN1 0x0
 #define ldus_QNAN2 0x0