2013-12-06 12:04:52 +01:00
|
|
|
/* $NetBSD: cerror.S,v 1.11 2013/09/12 15:36:15 joerg Exp $ */
|
2011-02-14 20:36:03 +01:00
|
|
|
|
|
|
|
#include "SYS.h"
|
|
|
|
#include "assym.h"
|
|
|
|
|
|
|
|
#if defined(LIBC_SCCS) && !defined(lint)
|
2013-12-06 12:04:52 +01:00
|
|
|
__RCSID("$NetBSD: cerror.S,v 1.11 2013/09/12 15:36:15 joerg Exp $")
|
2011-02-14 20:36:03 +01:00
|
|
|
#endif /* LIBC_SCCS && !lint */
|
|
|
|
|
|
|
|
#ifndef _REENTRANT
|
|
|
|
.globl _C_LABEL(errno)
|
|
|
|
#endif
|
2013-12-06 12:04:52 +01:00
|
|
|
#ifdef __PIC__
|
2012-09-17 11:09:12 +02:00
|
|
|
.protected _C_LABEL(__cerror)
|
2011-02-14 20:36:03 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
ENTRY(__cerror)
|
|
|
|
#ifdef _REENTRANT
|
|
|
|
mflr %r0
|
|
|
|
stwu %r1,-CALLFRAMELEN(%r1) # allocate new stack frame
|
|
|
|
stw %r0,CALLFRAMELEN+CALLFRAME_LR(%r1)
|
2013-12-06 12:04:52 +01:00
|
|
|
#ifdef __PIC__
|
2011-02-14 20:36:03 +01:00
|
|
|
stw %r30,CALLFRAME_R30(%r1)
|
|
|
|
PIC_TOCSETUP(__cerror, %r30)
|
|
|
|
#endif
|
|
|
|
stw %r31,CALLFRAME_R31(%r1)
|
|
|
|
mr %r31,%r3 # stash away in callee-saved register
|
|
|
|
bl PIC_PLT(_C_LABEL(__errno))
|
|
|
|
stw %r31,0(%r3)
|
|
|
|
lwz %r0,CALLFRAMELEN+CALLFRAME_LR(%r1)
|
|
|
|
lwz %r31,CALLFRAME_R31(%r1)
|
2013-12-06 12:04:52 +01:00
|
|
|
#ifdef __PIC__
|
2011-02-14 20:36:03 +01:00
|
|
|
lwz %r30,CALLFRAME_R30(%r1)
|
|
|
|
#endif
|
|
|
|
mtlr %r0
|
|
|
|
addi %r1,%r1,CALLFRAMELEN
|
|
|
|
#else
|
2013-12-06 12:04:52 +01:00
|
|
|
#ifdef __PIC__
|
2011-02-14 20:36:03 +01:00
|
|
|
mflr %r10
|
|
|
|
PIC_GOTSETUP(%r4)
|
|
|
|
lwz %r4,_C_LABEL(errno)@got(%r4)
|
|
|
|
stw %r3,0(%r4)
|
|
|
|
mtlr %r10
|
|
|
|
#else
|
|
|
|
lis %r4,_C_LABEL(errno)@ha
|
|
|
|
stw %r3,_C_LABEL(errno)@l(%r4)
|
2013-12-06 12:04:52 +01:00
|
|
|
#endif /* __PIC__ */
|
2011-02-14 20:36:03 +01:00
|
|
|
#endif /* _REENTRANT */
|
|
|
|
li %r3,-1
|
|
|
|
li %r4,-1
|
|
|
|
blr
|
|
|
|
END(__cerror)
|