SYS.h revision 1.6
11.6Sskrll/*	$NetBSD: SYS.h,v 1.6 2007/11/18 13:25:39 skrll Exp $	*/
21.1Sfredette
31.1Sfredette/*	$OpenBSD: SYS.h,v 1.9 2001/09/20 20:52:09 millert Exp $	*/
41.1Sfredette
51.1Sfredette/*
61.1Sfredette * Copyright (c) 1998-1999 Michael Shalayeff
71.1Sfredette * All rights reserved.
81.1Sfredette *
91.1Sfredette * Redistribution and use in source and binary forms, with or without
101.1Sfredette * modification, are permitted provided that the following conditions
111.1Sfredette * are met:
121.1Sfredette * 1. Redistributions of source code must retain the above copyright
131.1Sfredette *    notice, this list of conditions and the following disclaimer.
141.1Sfredette * 2. Redistributions in binary form must reproduce the above copyright
151.1Sfredette *    notice, this list of conditions and the following disclaimer in the
161.1Sfredette *    documentation and/or other materials provided with the distribution.
171.1Sfredette * 3. All advertising materials mentioning features or use of this software
181.1Sfredette *    must display the following acknowledgement:
191.1Sfredette *	This product includes software developed by Michael Shalayeff.
201.1Sfredette * 4. The name of the author may not be used to endorse or promote products
211.1Sfredette *    derived from this software without specific prior written permission.
221.1Sfredette *
231.1Sfredette * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
241.1Sfredette * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
251.1Sfredette * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
261.1Sfredette * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
271.1Sfredette * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
281.1Sfredette * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF MIND
291.1Sfredette * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
301.1Sfredette * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
311.1Sfredette * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
321.1Sfredette * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
331.1Sfredette */
341.1Sfredette
351.1Sfredette#include <sys/syscall.h>
361.1Sfredette#include <machine/asm.h>
371.1Sfredette#include <machine/vmparam.h>
381.1Sfredette#undef _LOCORE
391.1Sfredette#define _LOCORE
401.1Sfredette#include <machine/frame.h>
411.1Sfredette
421.6Sskrll#define	SYSENTRY(x)	LEAF_ENTRY(x)
431.5Sskrll#define	SYSEXIT(x)	EXIT(x)
441.1Sfredette
451.5Sskrll#define	SYSCALL(x)				!\
461.4Smatt	stw	%rp, HPPA_FRAME_ERP(%sr0,%sp)	!\
471.4Smatt	ldil	L%SYSCALLGATE, %r1		!\
481.4Smatt	ble	4(%sr7, %r1)			!\
491.4Smatt	ldi	__CONCAT(SYS_,x), %t1		!\
501.5Sskrll	.import __cerror, code			!\
511.5Sskrll	comb,<>	%r0, %t1, __cerror		!\
521.5Sskrll	ldw	HPPA_FRAME_ERP(%sr0,%sp), %rp
531.5Sskrll
541.5Sskrll#define	PSEUDO(x,y)				!\
551.6SskrllSYSENTRY(x)					!\
561.5Sskrll	SYSCALL(y)				!\
571.5Sskrll	bv	%r0(%rp)			!\
581.5Sskrll	nop					!\
591.5SskrllSYSEXIT(x)
601.1Sfredette
611.5Sskrll#define	PSEUDO_NOERROR(x,y)			!\
621.6SskrllSYSENTRY(x)					!\
631.5Sskrll	stw	%rp, HPPA_FRAME_ERP(%sr0,%sp)	!\
641.5Sskrll	ldil	L%SYSCALLGATE, %r1		!\
651.5Sskrll	ble	4(%sr7, %r1)			!\
661.5Sskrll	ldi	__CONCAT(SYS_,y), %t1		!\
671.5Sskrll	ldw	HPPA_FRAME_ERP(%sr0,%sp), %rp	!\
681.4Smatt	bv	%r0(%rp)			!\
691.5Sskrll	nop					!\
701.5SskrllSYSEXIT(x)
711.1Sfredette
721.5Sskrll#define RSYSCALL(x)		PSEUDO(x,x)
731.5Sskrll#define	RSYSCALL_NOERROR(x)	PSEUDO_NOERROR(x,x)
741.1Sfredette
751.1Sfredette#ifdef WEAK_ALIAS
761.1Sfredette#define WSYSCALL(weak,strong)		!\
771.1Sfredette	WEAK_ALIAS(weak,strong)		!\
781.1Sfredette	PSEUDO(strong,weak)
791.1Sfredette#else
801.1Sfredette#define WSYSCALL(weak,strong)		!\
811.1Sfredette	PSEUDO(weak,weak)
821.1Sfredette#endif
83