syscall.S revision 1.4
11.4Smarcus/*	$NetBSD: syscall.S,v 1.4 2003/07/01 14:35:45 marcus 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.1Smsaitoh * 3. All advertising materials mentioning features or use of this software
191.1Smsaitoh *    must display the following acknowledgement:
201.1Smsaitoh *	This product includes software developed by the University of
211.1Smsaitoh *	California, Berkeley and its contributors.
221.1Smsaitoh * 4. Neither the name of the University nor the names of its contributors
231.1Smsaitoh *    may be used to endorse or promote products derived from this software
241.1Smsaitoh *    without specific prior written permission.
251.1Smsaitoh *
261.1Smsaitoh * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
271.1Smsaitoh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
281.1Smsaitoh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
291.1Smsaitoh * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
301.1Smsaitoh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
311.1Smsaitoh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
321.1Smsaitoh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
331.1Smsaitoh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
341.1Smsaitoh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
351.1Smsaitoh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
361.1Smsaitoh * SUCH DAMAGE.
371.1Smsaitoh *
381.1Smsaitoh *	from: @(#)syscall.s	5.1 (Berkeley) 4/23/90
391.1Smsaitoh */
401.1Smsaitoh
411.1Smsaitoh#include <machine/asm.h>
421.1Smsaitoh#if defined(SYSLIBC_SCCS) && !defined(lint)
431.4Smarcus	RCSID("$NetBSD: syscall.S,v 1.4 2003/07/01 14:35:45 marcus Exp $")
441.1Smsaitoh#endif /* SYSLIBC_SCCS and not lint */
451.1Smsaitoh
461.1Smsaitoh#include "SYS.h"
471.1Smsaitoh
481.1SmsaitohENTRY(syscall)
491.3Smsaitoh	sts	pr, r2		/* rta */
501.3Smsaitoh	mov.l	Lsyscall, r0	/* syscall number */
511.1Smsaitoh	trapa	#0x80
521.1Smsaitoh	bf	err
531.1Smsaitoh	rts
541.1Smsaitoh	nop
551.1Smsaitoherr:
561.1Smsaitoh	mov.l	Lcerror, r1
571.4Smarcus#ifdef PIC
581.4Smarcus	braf	r1
591.4Smarcus#else
601.1Smsaitoh	jmp	@r1
611.4Smarcus#endif
621.1Smsaitoh	nop
631.4Smarcus1:
641.1Smsaitoh
651.3Smsaitoh	.align	2
661.4Smarcus#ifdef PIC
671.4SmarcusLcerror:	.long	cerror-1b
681.4Smarcus#else
691.1SmsaitohLcerror:	.long	cerror
701.4Smarcus#endif
711.2SitojunLsyscall:	.long	SYS_syscall
72