SYS.h revision 1.11
11.11Sskrll/*	$NetBSD: SYS.h,v 1.11 2020/05/05 20:39:18 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.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#include <machine/frame.h>
341.1Sfredette
351.6Sskrll#define	SYSENTRY(x)	LEAF_ENTRY(x)
361.5Sskrll#define	SYSEXIT(x)	EXIT(x)
371.1Sfredette
381.5Sskrll#define	SYSCALL(x)				!\
391.4Smatt	stw	%rp, HPPA_FRAME_ERP(%sr0,%sp)	!\
401.4Smatt	ldil	L%SYSCALLGATE, %r1		!\
411.9Sskrll	ble	4(%sr2, %r1)			!\
421.4Smatt	ldi	__CONCAT(SYS_,x), %t1		!\
431.5Sskrll	.import __cerror, code			!\
441.5Sskrll	comb,<>	%r0, %t1, __cerror		!\
451.11Sskrll	 ldw	HPPA_FRAME_ERP(%sr0,%sp), %rp
461.5Sskrll
471.5Sskrll#define	PSEUDO(x,y)				!\
481.6SskrllSYSENTRY(x)					!\
491.5Sskrll	SYSCALL(y)				!\
501.5Sskrll	bv	%r0(%rp)			!\
511.11Sskrll	 nop					!\
521.5SskrllSYSEXIT(x)
531.1Sfredette
541.5Sskrll#define	PSEUDO_NOERROR(x,y)			!\
551.6SskrllSYSENTRY(x)					!\
561.5Sskrll	stw	%rp, HPPA_FRAME_ERP(%sr0,%sp)	!\
571.5Sskrll	ldil	L%SYSCALLGATE, %r1		!\
581.9Sskrll	ble	4(%sr2, %r1)			!\
591.11Sskrll	 ldi	__CONCAT(SYS_,y), %t1		!\
601.5Sskrll	ldw	HPPA_FRAME_ERP(%sr0,%sp), %rp	!\
611.4Smatt	bv	%r0(%rp)			!\
621.11Sskrll	 nop					!\
631.5SskrllSYSEXIT(x)
641.1Sfredette
651.5Sskrll#define RSYSCALL(x)		PSEUDO(x,x)
661.8Sskrll#define	RSYSCALL_NOERROR(x)	PSEUDO_NOERROR(x,x)
671.1Sfredette
681.1Sfredette#ifdef WEAK_ALIAS
691.1Sfredette#define WSYSCALL(weak,strong)		!\
701.1Sfredette	WEAK_ALIAS(weak,strong)		!\
711.1Sfredette	PSEUDO(strong,weak)
721.1Sfredette#else
731.1Sfredette#define WSYSCALL(weak,strong)		!\
741.1Sfredette	PSEUDO(weak,weak)
751.1Sfredette#endif
76