xref: /dflybsd-src/lib/libc/x86_64/sys/setlogin.S (revision c66c7e2fb8d0d28477d550f1d2a50c4677d547ff)
1b2b3ffcdSSimon Schubert/*-
2b2b3ffcdSSimon Schubert * Copyright (c) 1991 The Regents of the University of California.
3b2b3ffcdSSimon Schubert * All rights reserved.
4b2b3ffcdSSimon Schubert *
5b2b3ffcdSSimon Schubert * This code is derived from software contributed to Berkeley by
6b2b3ffcdSSimon Schubert * William Jolitz.
7b2b3ffcdSSimon Schubert *
8b2b3ffcdSSimon Schubert * Redistribution and use in source and binary forms, with or without
9b2b3ffcdSSimon Schubert * modification, are permitted provided that the following conditions
10b2b3ffcdSSimon Schubert * are met:
11b2b3ffcdSSimon Schubert * 1. Redistributions of source code must retain the above copyright
12b2b3ffcdSSimon Schubert *    notice, this list of conditions and the following disclaimer.
13b2b3ffcdSSimon Schubert * 2. Redistributions in binary form must reproduce the above copyright
14b2b3ffcdSSimon Schubert *    notice, this list of conditions and the following disclaimer in the
15b2b3ffcdSSimon Schubert *    documentation and/or other materials provided with the distribution.
16*c66c7e2fSzrj * 3. Neither the name of the University nor the names of its contributors
17b2b3ffcdSSimon Schubert *    may be used to endorse or promote products derived from this software
18b2b3ffcdSSimon Schubert *    without specific prior written permission.
19b2b3ffcdSSimon Schubert *
20b2b3ffcdSSimon Schubert * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21b2b3ffcdSSimon Schubert * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22b2b3ffcdSSimon Schubert * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23b2b3ffcdSSimon Schubert * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24b2b3ffcdSSimon Schubert * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25b2b3ffcdSSimon Schubert * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26b2b3ffcdSSimon Schubert * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27b2b3ffcdSSimon Schubert * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28b2b3ffcdSSimon Schubert * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29b2b3ffcdSSimon Schubert * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30b2b3ffcdSSimon Schubert * SUCH DAMAGE.
31b2b3ffcdSSimon Schubert *
32b2b3ffcdSSimon Schubert * @(#)setlogin.s	5.2 (Berkeley) 4/12/91
33b2b3ffcdSSimon Schubert * $FreeBSD: src/lib/libc/amd64/sys/setlogin.S,v 1.14 2008/11/02 01:10:54 peter Exp $
34b2b3ffcdSSimon Schubert */
35b2b3ffcdSSimon Schubert
36b2b3ffcdSSimon Schubert#include <machine/asm.h>
37b2b3ffcdSSimon Schubert#include "SYS.h"
38b2b3ffcdSSimon Schubert
39b2b3ffcdSSimon Schubert.globl	CNAME(_logname_valid)		/* in _getlogin() */
40b2b3ffcdSSimon Schubert
41b2b3ffcdSSimon Schubert	.weak	_setlogin
42b2b3ffcdSSimon Schubert	.set	_setlogin,__sys_setlogin
43b2b3ffcdSSimon Schubert	.weak	setlogin
44b2b3ffcdSSimon Schubert	.set	setlogin,__sys_setlogin
45b2b3ffcdSSimon SchubertENTRY(__sys_setlogin)
46b2b3ffcdSSimon Schubert	mov	$SYS_setlogin,%rax
47b2b3ffcdSSimon Schubert	KERNCALL
48b2b3ffcdSSimon Schubert	jb	1f
49b2b3ffcdSSimon Schubert#ifdef PIC
50b2b3ffcdSSimon Schubert	movq	PIC_GOT(CNAME(_logname_valid)),%rdx
51b2b3ffcdSSimon Schubert	movl	$0,(%rdx)
52b2b3ffcdSSimon Schubert#else
53b2b3ffcdSSimon Schubert	movl	$0,CNAME(_logname_valid)(%rip)
54b2b3ffcdSSimon Schubert#endif
55b2b3ffcdSSimon Schubert	ret				/* setlogin(name) */
56b2b3ffcdSSimon Schubert1:
57b2b3ffcdSSimon Schubert#ifdef PIC
58b2b3ffcdSSimon Schubert	movq	PIC_GOT(HIDENAME(cerror)),%rdx
59b2b3ffcdSSimon Schubert	jmp	*%rdx
60b2b3ffcdSSimon Schubert#else
61b2b3ffcdSSimon Schubert	jmp	HIDENAME(cerror)
62b2b3ffcdSSimon Schubert#endif
63b2b3ffcdSSimon SchubertEND(__sys_setlogin)
648b927cb7SJohn Marino
658b927cb7SJohn Marino	.section .note.GNU-stack,"",%progbits
66