cerror.S revision 1.6
1/* $NetBSD: cerror.S,v 1.6 2014/08/23 02:24:22 matt Exp $ */ 2 3#include <machine/asm.h> 4#include "SYS.h" 5 6#ifndef _REENTRANT 7 .globl _C_LABEL(errno) 8#endif 9#ifdef __PIC__ 10 .protected _C_LABEL(__cerror) 11#endif 12 13ENTRY(__cerror) 14#ifdef _REENTRANT 15 mflr %r0 16 streg %r0,__SIZEOF_POINTER__(%r1) 17 stptru %r1,-(4*__SIZEOF_POINTER__)(%r1) # allocate new stack frame 18 streg %r31,(3*__SIZEOF_POINTER__)(%r1) 19 mr %r31,%r3 # stash away in callee-saved register 20 bl PIC_PLT(_C_LABEL(__errno)) 21 nop 22 stint %r31,0(%r3) 23 24 ldreg %r31,(3*__SIZEOF_POINTER__)(%r1) 25 addi %r1,%r1,4*__SIZEOF_POINTER__ 26 ldreg %r0,__SIZEOF_POINTER__(%r1) 27 mtlr %r0 28#else 29 .pushsection ".toc", "aw" 30.Lerrno:.tc errno[TC], errno 31 .popsection 32 lwz %r4,_C_LABEL(.Lerrno)@toc(%r2) 33 stw %r3,0(%r4) 34#endif /* _REENTRANT */ 35 li %r3,-1 36 li %r4,-1 37 blr 38END(__cerror) 39