CVS commit: [matt-nb6-plus] src/lib/libc/arch/arm/string

2013-02-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  7 07:06:28 UTC 2013

Added Files:
src/lib/libc/arch/arm/string [matt-nb6-plus]: strncat_naive.S

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.2 src/lib/libc/arch/arm/string/strncat_naive.S

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/arm/string/strncat_naive.S
diff -u /dev/null src/lib/libc/arch/arm/string/strncat_naive.S:1.1.2.2
--- /dev/null	Thu Feb  7 07:06:28 2013
+++ src/lib/libc/arch/arm/string/strncat_naive.S	Thu Feb  7 07:06:28 2013
@@ -0,0 +1,53 @@
+/*-
+ * Copyright (c) 2013 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 
+
+RCSID("$NetBSD: strncat_naive.S,v 1.1.2.2 2013/02/07 07:06:28 matt Exp $")
+
+/* LINTSTUB: char *strncat(char *, const char *, size_t) */
+ENTRY(strncat)
+	teq	r2, #0			/* count is 0? */
+	RETc(eq)			/*   yes, just return dst */
+	mov	ip, r0			/* need to preserve r0 */
+1:	ldrb	r3, [ip], #1		/* load next byte */
+	teq	r3, #0			/* was it a NUL? */
+	bne	1b			/*   no, get next byte */
+	sub	ip, ip, #1		/* back up one to the NUL */
+2:	subs	r2, r2, #1		/* subtract 1 from the count */
+	blt	3f			/*   <0? write terminating NUL */
+	ldrb	r3, [r1], #1		/* load next byte from append */
+	strb	r3, [ip], #1		/* store it */
+	teq	r3, #0			/* was it a NUL? */
+	bne	2b			/*   no, get next byte */
+	RET/* return */
+3:	mov	r3, #0			/* load a NUL */
+	strb	r3, [ip]		/* store it */
+	RET/* return */
+END(strncat)



CVS commit: [matt-nb6-plus] src/lib/libc/arch/arm

2012-11-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Nov 28 02:21:41 UTC 2012

Modified Files:
src/lib/libc/arch/arm [matt-nb6-plus]: Makefile.inc
src/lib/libc/arch/arm/gen [matt-nb6-plus]: _lwp.c makecontext.c
swapcontext.S
Added Files:
src/lib/libc/arch/arm [matt-nb6-plus]: genassym.cf

Log Message:
Pullup EABI changes.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.4.1 src/lib/libc/arch/arm/Makefile.inc
cvs rdiff -u -r0 -r1.1.6.2 src/lib/libc/arch/arm/genassym.cf
cvs rdiff -u -r1.5 -r1.5.8.1 src/lib/libc/arch/arm/gen/_lwp.c
cvs rdiff -u -r1.3 -r1.3.26.1 src/lib/libc/arch/arm/gen/makecontext.c
cvs rdiff -u -r1.5.26.1 -r1.5.26.2 src/lib/libc/arch/arm/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/arm/Makefile.inc
diff -u src/lib/libc/arch/arm/Makefile.inc:1.10 src/lib/libc/arch/arm/Makefile.inc:1.10.4.1
--- src/lib/libc/arch/arm/Makefile.inc:1.10	Fri Nov 18 16:10:02 2011
+++ src/lib/libc/arch/arm/Makefile.inc	Wed Nov 28 02:21:41 2012
@@ -1,10 +1,11 @@
-# $NetBSD: Makefile.inc,v 1.10 2011/11/18 16:10:02 joerg Exp $
+# $NetBSD: Makefile.inc,v 1.10.4.1 2012/11/28 02:21:41 matt Exp $
 
 .include 
 
 SRCS+=	__aeabi_read_tp.S __sigaction14_sigtramp.c __sigtramp2.S
 
-CPPFLAGS += -DSOFTFLOAT
+CPPFLAGS += -I.
+CPPFLAGS += -DSOFTFLOAT -I.
 
 SOFTFLOAT_BITS=32
 .include 

Index: src/lib/libc/arch/arm/gen/_lwp.c
diff -u src/lib/libc/arch/arm/gen/_lwp.c:1.5 src/lib/libc/arch/arm/gen/_lwp.c:1.5.8.1
--- src/lib/libc/arch/arm/gen/_lwp.c:1.5	Thu Feb 24 04:28:41 2011
+++ src/lib/libc/arch/arm/gen/_lwp.c	Wed Nov 28 02:21:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: _lwp.c,v 1.5 2011/02/24 04:28:41 joerg Exp $	*/
+/*	$NetBSD: _lwp.c,v 1.5.8.1 2012/11/28 02:21:41 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _lwp.c,v 1.5 2011/02/24 04:28:41 joerg Exp $");
+__RCSID("$NetBSD: _lwp.c,v 1.5.8.1 2012/11/28 02:21:41 matt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -50,7 +50,7 @@ void
 _lwp_makecontext(ucontext_t *u, void (*start)(void *),
 void *arg, void *private, caddr_t stack_base, size_t stack_size)
 {
-	void **sp;
+	uintptr_t sp;
 
 	getcontext(u);
 	u->uc_link = NULL;
@@ -58,16 +58,15 @@ _lwp_makecontext(ucontext_t *u, void (*s
 	u->uc_stack.ss_sp = stack_base;
 	u->uc_stack.ss_size = stack_size;
 
-	sp = (void **) (stack_base + stack_size);
-
+	sp = (uintptr_t)stack_base + stack_size;
 	/*
 	 * Note: We make sure the stack is 8-byte aligned, here.
 	 */
 
-	u->uc_mcontext.__gregs[_REG_R0] = (__greg_t) arg;
-	u->uc_mcontext.__gregs[_REG_SP] = ((__greg_t) sp) & ~7;
-	u->uc_mcontext.__gregs[_REG_LR] = (__greg_t) _lwp_exit;
-	u->uc_mcontext.__gregs[_REG_PC] = (__greg_t) start;
-	u->uc_mcontext._mc_tlsbase = (uintptr_t)private;
+	u->uc_mcontext.__gregs[_REG_R0] = (__greg_t)(uintptr_t)arg;
+	u->uc_mcontext.__gregs[_REG_SP] = ((__greg_t)sp) & ~7;
+	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._mc_tlsbase = (__greg_t)(uintptr_t)private;
 	u->uc_flags |= _UC_TLSBASE;
 }

Index: src/lib/libc/arch/arm/gen/makecontext.c
diff -u src/lib/libc/arch/arm/gen/makecontext.c:1.3 src/lib/libc/arch/arm/gen/makecontext.c:1.3.26.1
--- src/lib/libc/arch/arm/gen/makecontext.c:1.3	Mon Apr 28 20:22:55 2008
+++ src/lib/libc/arch/arm/gen/makecontext.c	Wed Nov 28 02:21:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: makecontext.c,v 1.3 2008/04/28 20:22:55 martin Exp $	*/
+/*	$NetBSD: makecontext.c,v 1.3.26.1 2012/11/28 02:21:41 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: makecontext.c,v 1.3 2008/04/28 20:22:55 martin Exp $");
+__RCSID("$NetBSD: makecontext.c,v 1.3.26.1 2012/11/28 02:21:41 matt Exp $");
 #endif
 
 #include 
@@ -55,12 +55,12 @@ makecontext(ucontext_t *ucp, void (*func
 	/* Allocate necessary stack space for arguments exceeding r0-3. */
 	if (argc > 4)
 		sp -= argc - 4;
-	gr[_REG_SP] = (__greg_t)sp;
+	gr[_REG_SP] = (__greg_t)(uintptr_t)sp;
 	/* Wipe out frame pointer. */
 	gr[_REG_FP] = 0;
 	/* Arrange for return via the trampoline code. */
-	gr[_REG_LR] = (__greg_t)_resumecontext;
-	gr[_REG_PC] = (__greg_t)func;
+	gr[_REG_LR] = (__greg_t)(uintptr_t)_resumecontext;
+	gr[_REG_PC] = (__greg_t)(uintptr_t)func;
 
 	va_start(ap, argc);
 	/* Pass up to four arguments in r0-3. */

Index: src/lib/libc/arch/arm/gen/swapcontext.S
diff -u src/lib/libc/arch/arm/gen/swapcontext.S:1.5.26.1 src/lib/libc/arch/arm/gen/swapcontext.S:1.5.26.2
--- src/lib/libc/arch/arm/gen/swapcontext.S:1.5.26.1	Thu Nov  1 16:44:57 2012
+++ src/lib/libc/arch/arm/gen/swapcontext.S	Wed Nov 28 02:21:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: swapcontext.S,v 1.

CVS commit: [matt-nb6-plus] src/lib/libc/arch/arm/sys

2012-11-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Nov 20 23:25:41 UTC 2012

Modified Files:
src/lib/libc/arch/arm/sys [matt-nb6-plus]: __aeabi_read_tp.S

Log Message:
Don't push/pop r1 around SYSTRAP, save it in ip instead.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.6.1 src/lib/libc/arch/arm/sys/__aeabi_read_tp.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/arm/sys/__aeabi_read_tp.S
diff -u src/lib/libc/arch/arm/sys/__aeabi_read_tp.S:1.2 src/lib/libc/arch/arm/sys/__aeabi_read_tp.S:1.2.6.1
--- src/lib/libc/arch/arm/sys/__aeabi_read_tp.S:1.2	Tue Feb 14 17:32:43 2012
+++ src/lib/libc/arch/arm/sys/__aeabi_read_tp.S	Tue Nov 20 23:25:41 2012
@@ -1,13 +1,20 @@
+/* $NetBSD: __aeabi_read_tp.S,v 1.2.6.1 2012/11/20 23:25:41 matt Exp $ */
+
 #include "SYS.h"
 
+/*
+ * Implementations of this function should corrupt only the result register
+ * (r0) and the non-parameter integer core registers allowed to be corrupted
+ * by the [AAPCS] (ip, lr, and CPSR).
+ */
 ENTRY(__aeabi_read_tp)
-	mrc p15, 0, r0, c13, c0, 3
+	mrc	p15, 0, r0, c13, c0, 3
 #ifndef _ARM_ARCH_6
-	cmp r0, #0			/* was it zero? */
+	cmp	r0, #0			/* was it zero? */
 	RETc(ne)			/* return it's not zero */
-	push {r1}			/* syscall zeroes r1 */
+	mov	ip, r1 			/* syscall zeroes r1 */
 	SYSTRAP(_lwp_getprivate)	/* can't fail */
-	pop {r1}			/* restore r1 */
+	mov	r1, ip			/* restore r1 */
 #endif
 	RET
 _END(__aeabi_read_tp)