cerror.S revision 1.6
11.6Smatt/* $NetBSD: cerror.S,v 1.6 2014/08/23 02:24:22 matt Exp $ */ 21.1Sross 31.1Sross#include <machine/asm.h> 41.1Sross#include "SYS.h" 51.1Sross 61.1Sross#ifndef _REENTRANT 71.1Sross .globl _C_LABEL(errno) 81.1Sross#endif 91.5Sjoerg#ifdef __PIC__ 101.4Smatt .protected _C_LABEL(__cerror) 111.2Schristos#endif 121.1Sross 131.1SrossENTRY(__cerror) 141.1Sross#ifdef _REENTRANT 151.1Sross mflr %r0 161.6Smatt streg %r0,__SIZEOF_POINTER__(%r1) 171.6Smatt stptru %r1,-(4*__SIZEOF_POINTER__)(%r1) # allocate new stack frame 181.6Smatt streg %r31,(3*__SIZEOF_POINTER__)(%r1) 191.1Sross mr %r31,%r3 # stash away in callee-saved register 201.1Sross bl PIC_PLT(_C_LABEL(__errno)) 211.6Smatt nop 221.6Smatt stint %r31,0(%r3) 231.6Smatt 241.6Smatt ldreg %r31,(3*__SIZEOF_POINTER__)(%r1) 251.6Smatt addi %r1,%r1,4*__SIZEOF_POINTER__ 261.6Smatt ldreg %r0,__SIZEOF_POINTER__(%r1) 271.1Sross mtlr %r0 281.1Sross#else 291.6Smatt .pushsection ".toc", "aw" 301.6Smatt.Lerrno:.tc errno[TC], errno 311.6Smatt .popsection 321.6Smatt lwz %r4,_C_LABEL(.Lerrno)@toc(%r2) 331.1Sross stw %r3,0(%r4) 341.1Sross#endif /* _REENTRANT */ 351.1Sross li %r3,-1 361.1Sross li %r4,-1 371.1Sross blr 381.6SmattEND(__cerror) 39