SYS.h revision 1.7
11.7Ssnj/*	$NetBSD: SYS.h,v 1.7 2009/11/03 05:07:25 snj Exp $	*/
21.1Sfredette
31.1Sfredette/*	$OpenBSD: SYS.h,v 1.9 2001/09/20 20:52:09 millert Exp $	*/
41.1Sfredette
51.1Sfredette/*
61.7Ssnj * Copyright (c) 1998-2002 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 *
181.1Sfredette * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
191.1Sfredette * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
201.1Sfredette * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
211.1Sfredette * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
221.1Sfredette * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
231.1Sfredette * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF MIND
241.1Sfredette * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
251.1Sfredette * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
261.1Sfredette * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
271.1Sfredette * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
281.1Sfredette */
291.1Sfredette
301.1Sfredette#include <sys/syscall.h>
311.1Sfredette#include <machine/asm.h>
321.1Sfredette#include <machine/vmparam.h>
331.1Sfredette#undef _LOCORE
341.1Sfredette#define _LOCORE
351.1Sfredette#include <machine/frame.h>
361.1Sfredette
371.6Sskrll#define	SYSENTRY(x)	LEAF_ENTRY(x)
381.5Sskrll#define	SYSEXIT(x)	EXIT(x)
391.1Sfredette
401.5Sskrll#define	SYSCALL(x)				!\
411.4Smatt	stw	%rp, HPPA_FRAME_ERP(%sr0,%sp)	!\
421.4Smatt	ldil	L%SYSCALLGATE, %r1		!\
431.4Smatt	ble	4(%sr7, %r1)			!\
441.4Smatt	ldi	__CONCAT(SYS_,x), %t1		!\
451.5Sskrll	.import __cerror, code			!\
461.5Sskrll	comb,<>	%r0, %t1, __cerror		!\
471.5Sskrll	ldw	HPPA_FRAME_ERP(%sr0,%sp), %rp
481.5Sskrll
491.5Sskrll#define	PSEUDO(x,y)				!\
501.6SskrllSYSENTRY(x)					!\
511.5Sskrll	SYSCALL(y)				!\
521.5Sskrll	bv	%r0(%rp)			!\
531.5Sskrll	nop					!\
541.5SskrllSYSEXIT(x)
551.1Sfredette
561.5Sskrll#define	PSEUDO_NOERROR(x,y)			!\
571.6SskrllSYSENTRY(x)					!\
581.5Sskrll	stw	%rp, HPPA_FRAME_ERP(%sr0,%sp)	!\
591.5Sskrll	ldil	L%SYSCALLGATE, %r1		!\
601.5Sskrll	ble	4(%sr7, %r1)			!\
611.5Sskrll	ldi	__CONCAT(SYS_,y), %t1		!\
621.5Sskrll	ldw	HPPA_FRAME_ERP(%sr0,%sp), %rp	!\
631.4Smatt	bv	%r0(%rp)			!\
641.5Sskrll	nop					!\
651.5SskrllSYSEXIT(x)
661.1Sfredette
671.5Sskrll#define RSYSCALL(x)		PSEUDO(x,x)
681.5Sskrll#define	RSYSCALL_NOERROR(x)	PSEUDO_NOERROR(x,x)
691.1Sfredette
701.1Sfredette#ifdef WEAK_ALIAS
711.1Sfredette#define WSYSCALL(weak,strong)		!\
721.1Sfredette	WEAK_ALIAS(weak,strong)		!\
731.1Sfredette	PSEUDO(strong,weak)
741.1Sfredette#else
751.1Sfredette#define WSYSCALL(weak,strong)		!\
761.1Sfredette	PSEUDO(weak,weak)
771.1Sfredette#endif
78