SYS.h revision 1.10
11.10Sagc/*	$NetBSD: SYS.h,v 1.10 2003/08/07 16:42:30 agc Exp $ */
21.1Sragge/*
31.1Sragge * Copyright (c) 1983, 1993
41.1Sragge *	The Regents of the University of California.  All rights reserved.
51.1Sragge *
61.1Sragge * Redistribution and use in source and binary forms, with or without
71.1Sragge * modification, are permitted provided that the following conditions
81.1Sragge * are met:
91.1Sragge * 1. Redistributions of source code must retain the above copyright
101.1Sragge *    notice, this list of conditions and the following disclaimer.
111.1Sragge * 2. Redistributions in binary form must reproduce the above copyright
121.1Sragge *    notice, this list of conditions and the following disclaimer in the
131.1Sragge *    documentation and/or other materials provided with the distribution.
141.10Sagc * 3. Neither the name of the University nor the names of its contributors
151.1Sragge *    may be used to endorse or promote products derived from this software
161.1Sragge *    without specific prior written permission.
171.1Sragge *
181.1Sragge * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
191.1Sragge * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
201.1Sragge * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
211.1Sragge * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
221.1Sragge * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
231.1Sragge * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
241.1Sragge * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
251.1Sragge * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
261.1Sragge * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
271.1Sragge * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
281.1Sragge * SUCH DAMAGE.
291.1Sragge *
301.1Sragge *	@(#)SYS.h	8.1 (Berkeley) 6/4/93
311.1Sragge */
321.1Sragge
331.3Sjtc#include <machine/asm.h>
341.1Sragge#include <sys/syscall.h>
351.1Sragge
361.9Swiz#ifdef __STDC__
371.3Sjtc#define SYSTRAP(x)	chmk $ SYS_ ## x
381.9Swiz#else
391.9Swiz#define SYSTRAP(x)	chmk $ SYS_/**/x
401.9Swiz#endif
411.3Sjtc
421.4Skleink#define _SYSCALL_NOERROR(x,y)						\
431.4Skleink	ENTRY(x,0);							\
441.4Skleink	SYSTRAP(y)
451.4Skleink
461.4Skleink#define _SYSCALL(x,y)							\
471.6Smatt	err: nop; nop; jmp CERROR+2;					\
481.4Skleink	_SYSCALL_NOERROR(x,y);						\
491.5Smatt	jcs err+2
501.3Sjtc
511.4Skleink#define SYSCALL_NOERROR(x)						\
521.4Skleink	_SYSCALL_NOERROR(x,x)
531.2Sragge
541.4Skleink#define SYSCALL(x)							\
551.4Skleink	_SYSCALL(x,x)
561.2Sragge
571.4Skleink#define PSEUDO_NOERROR(x,y)						\
581.4Skleink	_SYSCALL_NOERROR(x,y);						\
591.3Sjtc	ret
601.4Skleink
611.4Skleink#define PSEUDO(x,y)							\
621.4Skleink	_SYSCALL(x,y);							\
631.3Sjtc	ret
641.4Skleink
651.4Skleink#define RSYSCALL_NOERROR(x)						\
661.4Skleink	PSEUDO_NOERROR(x,x)
671.4Skleink
681.4Skleink#define RSYSCALL(x)							\
691.4Skleink	PSEUDO(x,x)
701.7Sthorpej
711.7Sthorpej#ifdef WEAK_ALIAS
721.7Sthorpej#define	WSYSCALL(weak,strong)						\
731.7Sthorpej	WEAK_ALIAS(weak,strong);					\
741.7Sthorpej	PSEUDO(strong,weak)
751.7Sthorpej#else
761.7Sthorpej#define	WSYSCALL(weak,strong)						\
771.7Sthorpej	PSEUDO(weak,weak)
781.7Sthorpej#endif
791.1Sragge
801.1Sragge#define	ASMSTR		.asciz
811.1Sragge
821.6Smatt#ifdef __ELF__
831.6Smatt#define	CERROR	_C_LABEL(__cerror)
841.6Smatt#define	CURBRK	_C_LABEL(__curbrk)
851.6Smatt#else
861.6Smatt#define	CERROR	_ASM_LABEL(cerror)
871.6Smatt#define	CURBRK	_ASM_LABEL(curbrk)
881.6Smatt#endif
891.6Smatt
901.6Smatt	.globl	CERROR
91