1234353Sdim/*-
2201360Srdivacky * Copyright (c) 1990 The Regents of the University of California.
3201360Srdivacky * All rights reserved.
4201360Srdivacky *
5201360Srdivacky * This code is derived from software contributed to Berkeley by
6201360Srdivacky * William Jolitz.
7201360Srdivacky *
8201360Srdivacky * Redistribution and use in source and binary forms, with or without
9201360Srdivacky * modification, are permitted provided that the following conditions
10201360Srdivacky * are met:
11201360Srdivacky * 1. Redistributions of source code must retain the above copyright
12201360Srdivacky *    notice, this list of conditions and the following disclaimer.
13201360Srdivacky * 2. Redistributions in binary form must reproduce the above copyright
14201360Srdivacky *    notice, this list of conditions and the following disclaimer in the
15201360Srdivacky *    documentation and/or other materials provided with the distribution.
16201360Srdivacky * 4. Neither the name of the University nor the names of its contributors
17201360Srdivacky *    may be used to endorse or promote products derived from this software
18201360Srdivacky *    without specific prior written permission.
19201360Srdivacky *
20201360Srdivacky * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21201360Srdivacky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22201360Srdivacky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23201360Srdivacky * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24201360Srdivacky * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25201360Srdivacky * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26201360Srdivacky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27201360Srdivacky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28201360Srdivacky * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29201360Srdivacky * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30201360Srdivacky * SUCH DAMAGE.
31201360Srdivacky */
32201360Srdivacky
33201360Srdivacky#if defined(SYSLIBC_SCCS) && !defined(lint)
34201360Srdivacky	.asciz "@(#)cerror.s	5.1 (Berkeley) 4/23/90"
35201360Srdivacky#endif /* SYSLIBC_SCCS and not lint */
36201360Srdivacky#include <machine/asm.h>
37201360Srdivacky__FBSDID("$FreeBSD: releng/10.2/lib/libc/i386/sys/cerror.S 240152 2012-09-05 21:41:05Z jilles $");
38201360Srdivacky
39201360Srdivacky#include "SYS.h"
40201360Srdivacky
41201360Srdivacky	.globl HIDENAME(cerror)
42201360Srdivacky
43201360Srdivacky	/*
44201360Srdivacky	 * The __error() function is thread aware. For non-threaded
45201360Srdivacky	 * programs and the initial threaded in threaded programs,
46201360Srdivacky	 * it returns a pointer to the global errno variable.
47201360Srdivacky	 */
48201360Srdivacky	.globl	CNAME(__error)
49201360Srdivacky	.type	CNAME(__error),@function
50201360SrdivackyHIDENAME(cerror):
51201360Srdivacky#ifdef PIC
52201360Srdivacky	PIC_PROLOGUE
53201360Srdivacky	pushl	%eax
54201360Srdivacky	call	PIC_PLT(CNAME(__error))
55201360Srdivacky	popl	%ecx
56201360Srdivacky	PIC_EPILOGUE
57201360Srdivacky#else
58201360Srdivacky	pushl	%eax
59201360Srdivacky	call	CNAME(__error)
60201360Srdivacky	popl	%ecx
61201360Srdivacky#endif
62201360Srdivacky	movl	%ecx,(%eax)
63201360Srdivacky	movl	$-1,%eax
64201360Srdivacky	movl	$-1,%edx
65201360Srdivacky	ret
66201360Srdivacky
67201360Srdivacky	.section .note.GNU-stack,"",%progbits
68201360Srdivacky