Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/powerpc/sys/cerror.S
Show All 34 Lines | #include "SYS.h" | ||||
/* | /* | ||||
* The __error() function is thread aware. For non-threaded | * The __error() function is thread aware. For non-threaded | ||||
* programs and the initial threaded in threaded programs, | * programs and the initial threaded in threaded programs, | ||||
* it returns a pointer to the global errno variable. | * it returns a pointer to the global errno variable. | ||||
*/ | */ | ||||
HIDENAME(cerror): | HIDENAME(cerror): | ||||
mflr %r0 | mflr %r0 | ||||
stwu %r1,-16(%r1) /* allocate new stack frame */ | stwu %r1,-20(%r1) /* allocate new stack frame */ | ||||
stw %r0,20(%r1) /* and save lr, r31 */ | stw %r0,24(%r1) /* and save lr, r31 */ | ||||
stw %r31,8(%r1) | stw %r31,12(%r1) | ||||
#ifdef __PIC__ | |||||
stw %r30,8(%r1) | |||||
bcl 20,31,1f | |||||
1: | |||||
mflr %r30 | |||||
addis %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@ha | |||||
addi %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@l | |||||
#endif | |||||
mr %r31,%r3 /* stash errval in callee-saved register */ | mr %r31,%r3 /* stash errval in callee-saved register */ | ||||
bl PIC_PLT(CNAME(__error)) | bl PIC_PLT(CNAME(__error)) | ||||
stw %r31,0(%r3) /* store errval into &errno */ | stw %r31,0(%r3) /* store errval into &errno */ | ||||
lwz %r0,20(%r1) | lwz %r0,24(%r1) | ||||
lwz %r31,8(%r1) | lwz %r31,12(%r1) | ||||
#ifdef __PIC__ | |||||
lwz %r30,8(%r1) | |||||
#endif | |||||
mtlr %r0 | mtlr %r0 | ||||
la %r1,16(%r1) | la %r1,20(%r1) | ||||
li %r3,-1 | li %r3,-1 | ||||
li %r4,-1 | li %r4,-1 | ||||
blr /* return to callers caller */ | blr /* return to callers caller */ | ||||
.section .note.GNU-stack,"",%progbits | .section .note.GNU-stack,"",%progbits |