1178580Simp/*-
2178580Simp * Copyright (c) 1990 The Regents of the University of California.
3178580Simp * All rights reserved.
4178580Simp *
5178580Simp * This code is derived from software contributed to Berkeley by
6178580Simp * William Jolitz.
7178580Simp *
8178580Simp * Redistribution and use in source and binary forms, with or without
9178580Simp * modification, are permitted provided that the following conditions
10178580Simp * are met:
11178580Simp * 1. Redistributions of source code must retain the above copyright
12178580Simp *    notice, this list of conditions and the following disclaimer.
13178580Simp * 2. Redistributions in binary form must reproduce the above copyright
14178580Simp *    notice, this list of conditions and the following disclaimer in the
15178580Simp *    documentation and/or other materials provided with the distribution.
16178580Simp * 4. Neither the name of the University nor the names of its contributors
17178580Simp *    may be used to endorse or promote products derived from this software
18178580Simp *    without specific prior written permission.
19178580Simp *
20178580Simp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21178580Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22178580Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23178580Simp * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24178580Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25178580Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26178580Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27178580Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28178580Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29178580Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30178580Simp * SUCH DAMAGE.
31178580Simp *
32178580Simp *	from: FreeBSD: src/lib/libc/i386/sys/cerror.S,v 1.11 2001/08/13
33178580Simp */
34178580Simp
35178580Simp#include <machine/asm.h>
36178580Simp__FBSDID("$FreeBSD: releng/10.2/lib/libc/sparc64/sys/cerror.S 165903 2007-01-09 00:28:16Z imp $");
37178580Simp
38178580Simp#include "SYS.h"
39178580Simp
40178580Simp	.text
41178580Simp	.align	16
42178580Simp	.globl	HIDENAME(cerror)
43178580Simp	.type	HIDENAME(cerror),@function
44209231Sjchandra
45209231Sjchandra	/*
46178580Simp	 * The __error() function is thread aware. For non-threaded
47178580Simp	 * programs and the initial threaded in threaded programs,
48178580Simp	 * it returns a pointer to the global errno variable.
49178580Simp	 */
50178580Simp	.globl	CNAME(__error)
51178580SimpHIDENAME(cerror):
52178580Simp	save	%sp, -CCFSZ, %sp
53178580Simp	call	CNAME(__error)
54178580Simp	 nop
55178580Simp	stw	%i0, [%o0]
56178580Simp	mov	-1, %i0
57178580Simp	ret
58178580Simp	 restore %g0, -1, %o1
59178580SimpEND(HIDENAME(cerror))
60178580Simp