185518Sjake/*-
285518Sjake * Copyright (c) 1990 The Regents of the University of California.
385518Sjake * All rights reserved.
485518Sjake *
585518Sjake * This code is derived from software contributed to Berkeley by
685518Sjake * William Jolitz.
785518Sjake *
885518Sjake * Redistribution and use in source and binary forms, with or without
985518Sjake * modification, are permitted provided that the following conditions
1085518Sjake * are met:
1185518Sjake * 1. Redistributions of source code must retain the above copyright
1285518Sjake *    notice, this list of conditions and the following disclaimer.
1385518Sjake * 2. Redistributions in binary form must reproduce the above copyright
1485518Sjake *    notice, this list of conditions and the following disclaimer in the
1585518Sjake *    documentation and/or other materials provided with the distribution.
1685518Sjake * 4. Neither the name of the University nor the names of its contributors
1785518Sjake *    may be used to endorse or promote products derived from this software
1885518Sjake *    without specific prior written permission.
1985518Sjake *
2085518Sjake * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2185518Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2285518Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2385518Sjake * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2485518Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2585518Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2685518Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2785518Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2885518Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2985518Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3085518Sjake * SUCH DAMAGE.
3185518Sjake *
3285518Sjake *	from: FreeBSD: src/lib/libc/i386/sys/cerror.S,v 1.11 2001/08/13
3385518Sjake */
3485518Sjake
3599116Sobrien#include <machine/asm.h>
3699116Sobrien__FBSDID("$FreeBSD$");
3785518Sjake
3885518Sjake#include "SYS.h"
3985518Sjake
4085518Sjake	.text
4186536Sjake	.align	16
4286536Sjake	.globl	HIDENAME(cerror)
4386536Sjake	.type	HIDENAME(cerror),@function
4485518Sjake
4585518Sjake	/*
4685518Sjake	 * The __error() function is thread aware. For non-threaded
4785518Sjake	 * programs and the initial threaded in threaded programs,
4885518Sjake	 * it returns a pointer to the global errno variable.
4985518Sjake	 */
5085518Sjake	.globl	CNAME(__error)
5185518SjakeHIDENAME(cerror):
5285518Sjake	save	%sp, -CCFSZ, %sp
5385518Sjake	call	CNAME(__error)
5485518Sjake	 nop
5585518Sjake	stw	%i0, [%o0]
5685518Sjake	mov	-1, %i0
5785518Sjake	ret
5885518Sjake	 restore %g0, -1, %o1
5986536SjakeEND(HIDENAME(cerror))
60