setlogin.S revision 107571
1284447Smarius/*- 2213878Smarius * Copyright (c) 2002 Peter Grehan. 3139749Simp * All rights reserved. 450120Swpaul * 550120Swpaul * Redistribution and use in source and binary forms, with or without 650120Swpaul * modification, are permitted provided that the following conditions 750120Swpaul * are met: 850120Swpaul * 1. Redistributions of source code must retain the above copyright 950120Swpaul * notice, this list of conditions and the following disclaimer. 1050120Swpaul * 2. Redistributions in binary form must reproduce the above copyright 1150120Swpaul * notice, this list of conditions and the following disclaimer in the 1250120Swpaul * documentation and/or other materials provided with the distribution. 1350120Swpaul * 1450120Swpaul * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1550120Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1650120Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1750120Swpaul * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1850120Swpaul * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1950120Swpaul * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2050120Swpaul * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2150120Swpaul * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2250120Swpaul * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2350120Swpaul * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2450120Swpaul * SUCH DAMAGE. 2550120Swpaul */ 2650120Swpaul/* $NetBSD: setlogin.S,v 1.3 1998/11/24 11:14:57 tsubai Exp $ */ 2750120Swpaul 2850120Swpaul#include <machine/asm.h> 2950477Speter__FBSDID("$FreeBSD: head/lib/libc/powerpc/sys/setlogin.S 107571 2002-12-04 07:25:14Z grehan $"); 3050120Swpaul 3150120Swpaul#include "SYS.h" 3250120Swpaul 3350120Swpaul .globl CNAME(_logname_valid) /* in _getlogin() */ 3450120Swpaul 3550120SwpaulSYSCALL(setlogin) 3650120Swpaul#ifdef PIC 3750120Swpaul mflr %r10 3850120Swpaul bl _GLOBAL_OFFSET_TABLE_@local-4 3950120Swpaul mflr %r4 4050120Swpaul lwz %r4,CNAME(_logname_valid)@got(%r4) 4150120Swpaul li %r5,%r0 4250120Swpaul stw %r5,0(%r4) 4350120Swpaul mtlr %r10 4450120Swpaul#else 4550120Swpaul lis %r4,CNAME(_logname_valid)@ha 4650120Swpaul li %r5,0 4750120Swpaul stw %r5,CNAME(_logname_valid)@l(%r4) 4850120Swpaul#endif 4950120Swpaul blr 50213878Smarius