cerror.S revision 99116
1189251Ssam/*-
2189251Ssam * Copyright (c) 1990 The Regents of the University of California.
3252726Srpaulo * All rights reserved.
4189251Ssam *
5252726Srpaulo * This code is derived from software contributed to Berkeley by
6252726Srpaulo * William Jolitz.
7189251Ssam *
8189251Ssam * Redistribution and use in source and binary forms, with or without
9189251Ssam * modification, are permitted provided that the following conditions
10189251Ssam * are met:
11189251Ssam * 1. Redistributions of source code must retain the above copyright
12214734Srpaulo *    notice, this list of conditions and the following disclaimer.
13214734Srpaulo * 2. Redistributions in binary form must reproduce the above copyright
14252726Srpaulo *    notice, this list of conditions and the following disclaimer in the
15189251Ssam *    documentation and/or other materials provided with the distribution.
16189251Ssam * 3. All advertising materials mentioning features or use of this software
17189251Ssam *    must display the following acknowledgement:
18189251Ssam *	This product includes software developed by the University of
19189251Ssam *	California, Berkeley and its contributors.
20189251Ssam * 4. Neither the name of the University nor the names of its contributors
21189251Ssam *    may be used to endorse or promote products derived from this software
22189251Ssam *    without specific prior written permission.
23189251Ssam *
24189251Ssam * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25189251Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26189251Ssam * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27189251Ssam * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28189251Ssam * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29189251Ssam * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30189251Ssam * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31189251Ssam * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32189251Ssam * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33189251Ssam * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34189251Ssam * SUCH DAMAGE.
35189251Ssam *
36189251Ssam *	from: FreeBSD: src/lib/libc/i386/sys/cerror.S,v 1.11 2001/08/13
37189251Ssam */
38189251Ssam
39189251Ssam#include <machine/asm.h>
40189251Ssam__FBSDID("$FreeBSD: head/lib/libc/sparc64/sys/cerror.S 99116 2002-06-30 05:36:49Z obrien $");
41189251Ssam
42189251Ssam#include "SYS.h"
43189251Ssam
44189251Ssam	.text
45189251Ssam	.align	16
46189251Ssam	.globl	HIDENAME(cerror)
47189251Ssam	.type	HIDENAME(cerror),@function
48189251Ssam
49189251Ssam	/*
50189251Ssam	 * The __error() function is thread aware. For non-threaded
51189251Ssam	 * programs and the initial threaded in threaded programs,
52189251Ssam	 * it returns a pointer to the global errno variable.
53189251Ssam	 */
54189251Ssam	.globl	CNAME(__error)
55189251SsamHIDENAME(cerror):
56189251Ssam	save	%sp, -CCFSZ, %sp
57189251Ssam	call	CNAME(__error)
58189251Ssam	 nop
59189251Ssam	stw	%i0, [%o0]
60189251Ssam	mov	-1, %i0
61189251Ssam	ret
62189251Ssam	 restore %g0, -1, %o1
63189251SsamEND(HIDENAME(cerror))
64189251Ssam