197403Sobrien/*-
297403Sobrien * Copyright (c) 1990 The Regents of the University of California.
397403Sobrien * All rights reserved.
497403Sobrien *
597403Sobrien * This code is derived from software contributed to Berkeley by
697403Sobrien * William Jolitz.
797403Sobrien *
897403Sobrien * Redistribution and use in source and binary forms, with or without
997403Sobrien * modification, are permitted provided that the following conditions
1097403Sobrien * are met:
1197403Sobrien * 1. Redistributions of source code must retain the above copyright
1297403Sobrien *    notice, this list of conditions and the following disclaimer.
1397403Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1497403Sobrien *    notice, this list of conditions and the following disclaimer in the
1597403Sobrien *    documentation and/or other materials provided with the distribution.
1697403Sobrien * 4. Neither the name of the University nor the names of its contributors
1797403Sobrien *    may be used to endorse or promote products derived from this software
18169691Skan *    without specific prior written permission.
1997403Sobrien *
2097403Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2197403Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2297403Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2397403Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2497403Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2597403Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2697403Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2797403Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2897403Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2997403Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3097403Sobrien * SUCH DAMAGE.
3197403Sobrien */
3297403Sobrien
3397403Sobrien#if defined(SYSLIBC_SCCS) && !defined(lint)
3497403Sobrien	.asciz "@(#)cerror.s	5.1 (Berkeley) 4/23/90"
3597403Sobrien#endif /* SYSLIBC_SCCS and not lint */
3697403Sobrien#include <machine/asm.h>
3797403Sobrien__FBSDID("$FreeBSD: releng/10.2/lib/libc/amd64/sys/cerror.S 217106 2011-01-07 16:08:40Z kib $");
3897403Sobrien
3997403Sobrien#include "SYS.h"
4097403Sobrien
4197403Sobrien	.globl HIDENAME(cerror)
4297403Sobrien
4397403Sobrien	/*
44132720Skan	 * The __error() function is thread aware. For non-threaded
45132720Skan	 * programs and the initial threaded in threaded programs,
4697403Sobrien	 * it returns a pointer to the global errno variable.
4797403Sobrien	 */
4897403Sobrien	.globl	CNAME(__error)
4997403Sobrien	.type	CNAME(__error),@function
5097403SobrienHIDENAME(cerror):
5197403Sobrien	pushq	%rax
52132720Skan	call	PIC_PLT(CNAME(__error))
53	popq	%rcx
54	movl	%ecx,(%rax)
55	movq	$-1,%rax
56	movq	$-1,%rdx
57	ret
58
59	.section .note.GNU-stack,"",%progbits
60