Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Mar 2010 01:12:16 +0000 (UTC)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r204614 - in user/jmallett/octeon/lib/libc/mips: . sys
Message-ID:  <201003030112.o231CG6L098285@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmallett
Date: Wed Mar  3 01:12:16 2010
New Revision: 204614
URL: http://svn.freebsd.org/changeset/base/204614

Log:
  Sync with NetBSD.

Modified:
  user/jmallett/octeon/lib/libc/mips/SYS.h
  user/jmallett/octeon/lib/libc/mips/sys/cerror.S

Modified: user/jmallett/octeon/lib/libc/mips/SYS.h
==============================================================================
--- user/jmallett/octeon/lib/libc/mips/SYS.h	Wed Mar  3 00:20:05 2010	(r204613)
+++ user/jmallett/octeon/lib/libc/mips/SYS.h	Wed Mar  3 01:12:16 2010	(r204614)
@@ -1,5 +1,4 @@
-/*	$NetBSD: SYS.h,v 1.18 2003/10/29 12:28:33 pooka Exp $ */
-/* $FreeBSD$ */
+/*	$NetBSD: SYS.h,v 1.19 2009/12/14 01:07:41 matt Exp $ */
 
 /*-
  * Copyright (c) 1996 Jonathan Stone
@@ -67,9 +66,9 @@
  */
 
 #include <sys/syscall.h>
-
 #include <machine/asm.h>
 
+
 /*
  * If compiling for shared libs, Emit sysV ABI PIC segment pseudo-ops.
  *
@@ -79,14 +78,28 @@
  */
 #ifdef __ABICALLS__
 	.abicalls
-# define PIC_PROLOGUE(x,sr)	.set noreorder; .cpload sr; .set reorder
-# define PIC_CALL(l,sr)		la sr, _C_LABEL(l); jr sr
+# if defined(__mips_o32) || defined(__mips_o64)
+#  define PIC_PROLOGUE(x)	SETUP_GP
+#  define PIC_TAILCALL(l)	PTR_LA t9, _C_LABEL(l); jr t9
+#  define PIC_RETURN()		j ra
+# else
+#  define PIC_PROLOGUE(x)	SETUP_GP64(t3, x)
+#  define PIC_TAILCALL(l)	PTR_LA t9, _C_LABEL(l); RESTORE_GP64; jr t9
+#  define PIC_RETURN()		RESTORE_GP64; j ra
+# endif
 #else
-# define PIC_PROLOGUE(x,sr)
-# define PIC_CALL(l,sr)		j  _C_LABEL(l)
+# define PIC_PROLOGUE(x)
+# define PIC_TAILCALL(l)	j  _C_LABEL(l)
+# define PIC_RETURN()
+#endif /* __ABICALLS__ */
+
+
+#ifdef __STDC__
+# define SYSTRAP(x)	li v0,SYS_ ## x; syscall;
+#else
+# define SYSTRAP(x)	li v0,SYS_/**/x; syscall;
 #endif
 
-# define SYSTRAP(x)	li v0, SYS_ ## x; syscall;
 
 /*
  * Do a syscall that cannot fail (sync, get{p,u,g,eu,eg)id)
@@ -106,7 +119,7 @@
  */
 #define PSEUDO_NOERROR(x)						\
 LEAF(__sys_ ## x);							\
-        .weak _C_LABEL(x);						\
+	.weak _C_LABEL(x);						\
 	_C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x));			\
 	.weak _C_LABEL(__CONCAT(_,x));					\
 	_C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x));		\
@@ -116,14 +129,14 @@ LEAF(__sys_ ## x);							\
 
 #define PSEUDO(x)							\
 LEAF(__sys_ ## x);							\
-        .weak _C_LABEL(x);						\
+	.weak _C_LABEL(x);						\
 	_C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x));			\
 	.weak _C_LABEL(__CONCAT(_,x));					\
 	_C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x));		\
-	PIC_PROLOGUE(x,t9);						\
+	PIC_PROLOGUE(x);						\
 	SYSTRAP(x);							\
 	bne a3,zero,err;						\
-	j ra;								\
+	PIC_RETURN();							\
 err:									\
-	PIC_CALL(__cerror,t9);						\
-	END(__sys_ ## x)
+	PIC_TAILCALL(__cerror);						\
+END(__sys_ ## x)

Modified: user/jmallett/octeon/lib/libc/mips/sys/cerror.S
==============================================================================
--- user/jmallett/octeon/lib/libc/mips/sys/cerror.S	Wed Mar  3 00:20:05 2010	(r204613)
+++ user/jmallett/octeon/lib/libc/mips/sys/cerror.S	Wed Mar  3 01:12:16 2010	(r204614)
@@ -1,4 +1,4 @@
-/*	$NetBSD: cerror.S,v 1.13 2003/08/07 16:42:17 agc Exp $	*/
+/*	$NetBSD: cerror.S,v 1.14 2009/12/14 01:07:42 matt Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,35 +37,31 @@ __FBSDID("$FreeBSD$");
 #include "SYS.h"
 
 #if defined(LIBC_SCCS) && !defined(lint)
-	ASMSTR("from: @(#)cerror.s	8.1 (Berkeley) 6/16/93")
-	ASMSTR("$NetBSD: cerror.S,v 1.13 2003/08/07 16:42:17 agc Exp $")
+#if 0
+	RCSID("from: @(#)cerror.s	8.1 (Berkeley) 6/16/93")
+#else
+	RCSID("$NetBSD: cerror.S,v 1.14 2009/12/14 01:07:42 matt Exp $")
+#endif
 #endif /* LIBC_SCCS and not lint */
 
-
-	/*
-	 * The __error() function is thread aware. For non-threaded
-	 * programs and the initial threaded in threaded programs,
-	 * it returns a pointer to the global errno variable.
-	 */
-	.globl  _C_LABEL(__error)
-	.type   _C_LABEL(__error),%function
-
-LEAF(__cerror)
-	.frame sp, CALLFRAME_SIZ, ra
-	PIC_PROLOGUE(__cerror, t9)
-	subu	sp, sp, CALLFRAME_SIZ
+	.globl	_C_LABEL(__error)
+NESTED_NOPROFILE(__cerror, CALLFRAME_SIZ, ra)
 	.mask	0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ)
-	sw	ra, CALLFRAME_RA(sp)
-	sw	v0, 12(sp)		# save errno value
-
-	la	t9, _C_LABEL(__error)	# locate address of errno
-	jalr	t9
-
-	lw	t0, 12(sp)
-	lw	ra, CALLFRAME_RA(sp)
-	sw	t0, 0(v0)		# update errno value
-	addiu	sp, sp, CALLFRAME_SIZ
-	li	v0, -1
-	li	v1, -1
-	j	ra
+	PIC_PROLOGUE(__cerror)
+	PTR_SUBU	sp, sp, CALLFRAME_SIZ
+	PTR_S		ra, CALLFRAME_RA(sp)
+	INT_S		v0, CALLFRAME_S0(sp)	# save errno value
+
+	SAVE_GP(CALLFRAME_GP)
+
+	PTR_LA		t9, _C_LABEL(__error)	# locate address of errno
+	jalr		t9
+
+	INT_L		t0, CALLFRAME_S0(sp)
+	PTR_L		ra, CALLFRAME_RA(sp)
+	INT_S		t0, 0(v0)		# update errno value
+	PTR_ADDU	sp, sp, CALLFRAME_SIZ
+	li		v0, -1
+	li		v1, -1
+	PIC_RETURN()
 END(__cerror)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003030112.o231CG6L098285>