cerror.S revision 1.1 1 1.1 matt /* $NetBSD: cerror.S,v 1.1 2014/09/03 19:34:26 matt Exp $ */
2 1.1 matt
3 1.1 matt #include "SYS.h"
4 1.1 matt #include "assym.h"
5 1.1 matt
6 1.1 matt #if defined(LIBC_SCCS) && !defined(lint)
7 1.1 matt __RCSID("$NetBSD: cerror.S,v 1.1 2014/09/03 19:34:26 matt Exp $")
8 1.1 matt #endif /* LIBC_SCCS && !lint */
9 1.1 matt
10 1.1 matt #ifndef _REENTRANT
11 1.1 matt .globl _C_LABEL(errno)
12 1.1 matt #endif
13 1.1 matt #ifdef __PIC__
14 1.1 matt .protected _C_LABEL(__cerror)
15 1.1 matt #endif
16 1.1 matt
17 1.1 matt ENTRY(__cerror)
18 1.1 matt #ifdef _REENTRANT
19 1.1 matt l.sw -4(r1),r3
20 1.1 matt l.sw -8(r1),lr
21 1.1 matt l.sw -16(r1),r1
22 1.1 matt l.addi r1,r1,-16
23 1.1 matt #ifdef __PIC__
24 1.1 matt l.sw -12(r1),r16
25 1.1 matt PIC_GOTSETUP(r16)
26 1.1 matt #endif
27 1.1 matt l.jal PLT(_C_LABEL(__errno)) # needs got in r16
28 1.1 matt l.nop
29 1.1 matt l.addi r1,r1,16
30 1.1 matt #ifdef __PIC__
31 1.1 matt l.lwz r16,-12(r1)
32 1.1 matt #endif
33 1.1 matt l.lwz lr,-8(r1)
34 1.1 matt l.lwz r3,-4(r1)
35 1.1 matt #else
36 1.1 matt #ifdef __PIC__
37 1.1 matt l.or r8,r9,r0
38 1.1 matt PIC_GOTSETUP(r4)
39 1.1 matt l.lwz r11,got(_C_LABEL(errno))(r4)
40 1.1 matt l.or r9,r8,r0
41 1.1 matt #else
42 1.1 matt l.movi r11,hi(_C_LABEL(errno))
43 1.1 matt l.ori r11,lo(_C_LABEL(errno))
44 1.1 matt #endif /* __PIC__ */
45 1.1 matt #endif /* _REENTRANT */
46 1.1 matt l.sw 0(r11),r3
47 1.1 matt l.addi r11,r0,-1
48 1.1 matt l.addi r12,r0,-1
49 1.1 matt l.jr lr
50 1.1 matt l.nop
51 1.1 matt END(__cerror)
52