1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * |
36 * $Id: cerror.S,v 1.4 1996/01/22 00:00:57 julian Exp $ |
37 */ 38 39#if defined(SYSLIBC_RCS) && !defined(lint) 40 .text |
41 .asciz "$Id: cerror.S,v 1.4 1996/01/22 00:00:57 julian Exp $" |
42#endif /* SYSLIBC_RCS and not lint */ 43 44#include "SYS.h" 45 |
46 .globl HIDENAME(cerror) 47 |
48#ifdef _THREAD_SAFE 49 /* 50 * Threaded version using __error(). 51 */ |
52 .globl CNAME(__error) 53 .type CNAME(__error),@function 54HIDENAME(cerror): |
55 pushl %eax 56#ifdef PIC |
57 /* The caller must execute the PIC prologue before jumping to cerror. */ 58 call PIC_PLT(CNAME(__error)) |
59#else |
60 call CNAME(__error) |
61#endif 62 popl %ecx 63 movl %ecx,(%eax) 64 movl $-1,%eax 65 movl $-1,%edx 66 ret 67 68#else /* _THREAD_SAFE */ 69 /* 70 * Non-threaded version using global errno. 71 */ |
72 .globl CNAME(errno) 73HIDENAME(cerror): |
74#ifdef PIC |
75 /* The caller must execute the PIC prologue before jumping to cerror. */ 76 movl PIC_GOT(CNAME(errno)),%ecx |
77 movl %eax,(%ecx) 78 PIC_EPILOGUE 79#else |
80 movl %eax,CNAME(errno) |
81#endif 82 movl $-1,%eax 83 movl $-1,%edx 84 ret 85#endif /* _THREAD_SAFE */ |