syscall.S revision 1.5
11.5Sagc/*	$NetBSD: syscall.S,v 1.5 2003/08/07 16:42:21 agc Exp $	*/
21.1Smsaitoh
31.1Smsaitoh/*-
41.1Smsaitoh * Copyright (c) 1990 The Regents of the University of California.
51.1Smsaitoh * All rights reserved.
61.1Smsaitoh *
71.1Smsaitoh * This code is derived from software contributed to Berkeley by
81.1Smsaitoh * William Jolitz.
91.1Smsaitoh *
101.1Smsaitoh * Redistribution and use in source and binary forms, with or without
111.1Smsaitoh * modification, are permitted provided that the following conditions
121.1Smsaitoh * are met:
131.1Smsaitoh * 1. Redistributions of source code must retain the above copyright
141.1Smsaitoh *    notice, this list of conditions and the following disclaimer.
151.1Smsaitoh * 2. Redistributions in binary form must reproduce the above copyright
161.1Smsaitoh *    notice, this list of conditions and the following disclaimer in the
171.1Smsaitoh *    documentation and/or other materials provided with the distribution.
181.5Sagc * 3. Neither the name of the University nor the names of its contributors
191.1Smsaitoh *    may be used to endorse or promote products derived from this software
201.1Smsaitoh *    without specific prior written permission.
211.1Smsaitoh *
221.1Smsaitoh * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
231.1Smsaitoh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
241.1Smsaitoh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
251.1Smsaitoh * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
261.1Smsaitoh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
271.1Smsaitoh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
281.1Smsaitoh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
291.1Smsaitoh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
301.1Smsaitoh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
311.1Smsaitoh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
321.1Smsaitoh * SUCH DAMAGE.
331.1Smsaitoh *
341.1Smsaitoh *	from: @(#)syscall.s	5.1 (Berkeley) 4/23/90
351.1Smsaitoh */
361.1Smsaitoh
371.1Smsaitoh#include <machine/asm.h>
381.1Smsaitoh#if defined(SYSLIBC_SCCS) && !defined(lint)
391.5Sagc	RCSID("$NetBSD: syscall.S,v 1.5 2003/08/07 16:42:21 agc Exp $")
401.1Smsaitoh#endif /* SYSLIBC_SCCS and not lint */
411.1Smsaitoh
421.1Smsaitoh#include "SYS.h"
431.1Smsaitoh
441.1SmsaitohENTRY(syscall)
451.3Smsaitoh	sts	pr, r2		/* rta */
461.3Smsaitoh	mov.l	Lsyscall, r0	/* syscall number */
471.1Smsaitoh	trapa	#0x80
481.1Smsaitoh	bf	err
491.1Smsaitoh	rts
501.1Smsaitoh	nop
511.1Smsaitoherr:
521.1Smsaitoh	mov.l	Lcerror, r1
531.4Smarcus#ifdef PIC
541.4Smarcus	braf	r1
551.4Smarcus#else
561.1Smsaitoh	jmp	@r1
571.4Smarcus#endif
581.1Smsaitoh	nop
591.4Smarcus1:
601.1Smsaitoh
611.3Smsaitoh	.align	2
621.4Smarcus#ifdef PIC
631.4SmarcusLcerror:	.long	cerror-1b
641.4Smarcus#else
651.1SmsaitohLcerror:	.long	cerror
661.4Smarcus#endif
671.2SitojunLsyscall:	.long	SYS_syscall
68