aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/mips/sys/cerror.S
diff options
context:
space:
mode:
authorJayachandran C. <jchandra@FreeBSD.org>2010-06-16 12:55:14 +0000
committerJayachandran C. <jchandra@FreeBSD.org>2010-06-16 12:55:14 +0000
commita7c139c0afa4e4ca5bee2fbef192942e098fe57d (patch)
treed284347736f86f7dd0b741263f711a8858174bbc /lib/libc/mips/sys/cerror.S
parentfcc7888f82d9fe3386caa691071d94a553b0a8ae (diff)
Merge jmallett@'s n64 work into HEAD - changeset 1.
Update libc assembly code to use macros that work on both o32 and n64. Merge string functions from NetBSD. The changes are from http://svn.freebsd.org/base/user/jmallett/octeon Approved by: rrs (mentor), jmallett
Notes
Notes: svn path=/head/; revision=209231
Diffstat (limited to 'lib/libc/mips/sys/cerror.S')
-rw-r--r--lib/libc/mips/sys/cerror.S53
1 files changed, 27 insertions, 26 deletions
diff --git a/lib/libc/mips/sys/cerror.S b/lib/libc/mips/sys/cerror.S
index 535fbe063b6c..c504d73afa3f 100644
--- a/lib/libc/mips/sys/cerror.S
+++ b/lib/libc/mips/sys/cerror.S
@@ -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,36 @@ __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 */
+ .globl _C_LABEL(__error)
+NESTED_NOPROFILE(__cerror, CALLFRAME_SIZ, ra)
+ .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ)
+ SETUP_GP
+ PTR_SUBU sp, sp, CALLFRAME_SIZ
+ SETUP_GP64(CALLFRAME_GP, __cerror)
+ SAVE_GP(CALLFRAME_GP)
- /*
- * 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
+ PTR_S ra, CALLFRAME_RA(sp)
+ REG_S v0, CALLFRAME_S0(sp) # save errno value
-LEAF(__cerror)
- .frame sp, CALLFRAME_SIZ, ra
- PIC_PROLOGUE(__cerror, t9)
- subu sp, sp, CALLFRAME_SIZ
- .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ)
- sw ra, CALLFRAME_RA(sp)
- sw v0, 12(sp) # save errno value
+ PTR_LA t9, _C_LABEL(__error) # locate address of errno
+ jalr t9
+
+ REG_L t0, CALLFRAME_S0(sp)
+ PTR_L ra, CALLFRAME_RA(sp)
+ INT_S t0, 0(v0) # update errno value
+
+ RESTORE_GP64
+ PTR_ADDU sp, sp, CALLFRAME_SIZ
- la t9, _C_LABEL(__error) # locate address of errno
- jalr t9
+ li v0, -1
+ li v1, -1
- 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
+ j ra
END(__cerror)