SYS.h revision 1.6
11.6Swiz/*	$NetBSD: SYS.h,v 1.6 2002/05/26 12:24:55 wiz Exp $	*/
21.1Sbjh21
31.1Sbjh21/*-
41.1Sbjh21 * Copyright (c) 1990 The Regents of the University of California.
51.1Sbjh21 * All rights reserved.
61.1Sbjh21 *
71.1Sbjh21 * This code is derived from software contributed to Berkeley by
81.1Sbjh21 * William Jolitz.
91.1Sbjh21 *
101.1Sbjh21 * Redistribution and use in source and binary forms, with or without
111.1Sbjh21 * modification, are permitted provided that the following conditions
121.1Sbjh21 * are met:
131.1Sbjh21 * 1. Redistributions of source code must retain the above copyright
141.1Sbjh21 *    notice, this list of conditions and the following disclaimer.
151.1Sbjh21 * 2. Redistributions in binary form must reproduce the above copyright
161.1Sbjh21 *    notice, this list of conditions and the following disclaimer in the
171.1Sbjh21 *    documentation and/or other materials provided with the distribution.
181.1Sbjh21 * 3. All advertising materials mentioning features or use of this software
191.1Sbjh21 *    must display the following acknowledgement:
201.1Sbjh21 *	This product includes software developed by the University of
211.1Sbjh21 *	California, Berkeley and its contributors.
221.1Sbjh21 * 4. Neither the name of the University nor the names of its contributors
231.1Sbjh21 *    may be used to endorse or promote products derived from this software
241.1Sbjh21 *    without specific prior written permission.
251.1Sbjh21 *
261.1Sbjh21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
271.1Sbjh21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
281.1Sbjh21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
291.1Sbjh21 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
301.1Sbjh21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
311.1Sbjh21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
321.1Sbjh21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
331.1Sbjh21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
341.1Sbjh21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
351.1Sbjh21 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
361.1Sbjh21 * SUCH DAMAGE.
371.1Sbjh21 *
381.1Sbjh21 *	from: @(#)SYS.h	5.5 (Berkeley) 5/7/91
391.1Sbjh21 */
401.1Sbjh21
411.1Sbjh21#include <machine/asm.h>
421.1Sbjh21#include <sys/syscall.h>
431.4Sbjh21#include <arm/swi.h>
441.1Sbjh21
451.6Swiz#ifdef __STDC__
461.4Sbjh21#define SYSTRAP(x)	swi SWI_OS_NETBSD | SYS_ ## x
471.6Swiz#else
481.6Swiz#define SYSTRAP(x)	swi SWI_OS_NETBSD | SYS_/**/x
491.6Swiz#endif
501.1Sbjh21
511.2Smatt#ifdef __ELF__
521.2Smatt#define	CERROR		_C_LABEL(__cerror)
531.2Smatt#define	CURBRK		_C_LABEL(__curbrk)
541.2Smatt#else
551.2Smatt#define	CERROR		_ASM_LABEL(cerror)
561.2Smatt#define	CURBRK		_ASM_LABEL(curbrk)
571.2Smatt#endif
581.2Smatt
591.1Sbjh21#define _SYSCALL_NOERROR(x,y)						\
601.1Sbjh21	ENTRY(x);							\
611.1Sbjh21	SYSTRAP(y)
621.1Sbjh21
631.1Sbjh21#define _SYSCALL(x, y)							\
641.1Sbjh21	_SYSCALL_NOERROR(x,y);						\
651.2Smatt	bcs PIC_SYM(CERROR, PLT)
661.1Sbjh21
671.1Sbjh21#define SYSCALL_NOERROR(x)						\
681.1Sbjh21	_SYSCALL_NOERROR(x,x)
691.1Sbjh21
701.1Sbjh21#define SYSCALL(x)							\
711.1Sbjh21	_SYSCALL(x,x)
721.1Sbjh21
731.1Sbjh21#ifdef __APCS_26__
741.1Sbjh21
751.1Sbjh21#define PSEUDO_NOERROR(x,y)						\
761.1Sbjh21	_SYSCALL_NOERROR(x,y);						\
771.1Sbjh21	movs r15, r14
781.1Sbjh21
791.1Sbjh21#define PSEUDO(x,y)							\
801.1Sbjh21	_SYSCALL(x,y);							\
811.1Sbjh21	movs r15, r14
821.1Sbjh21
831.1Sbjh21#else /* !__APCS_26__ */
841.1Sbjh21
851.1Sbjh21#define PSEUDO_NOERROR(x,y)						\
861.1Sbjh21	_SYSCALL_NOERROR(x,y);						\
871.1Sbjh21	mov r15, r14
881.1Sbjh21
891.1Sbjh21#define PSEUDO(x,y)							\
901.1Sbjh21	_SYSCALL(x,y);							\
911.1Sbjh21	mov r15, r14
921.1Sbjh21
931.1Sbjh21#endif /* !__APCS_26__ */
941.1Sbjh21
951.1Sbjh21#define RSYSCALL_NOERROR(x)						\
961.1Sbjh21	PSEUDO_NOERROR(x,x)
971.1Sbjh21
981.1Sbjh21#define RSYSCALL(x)							\
991.1Sbjh21	PSEUDO(x,x)
1001.3Sthorpej
1011.3Sthorpej#ifdef WEAK_ALIAS
1021.3Sthorpej#define	WSYSCALL(weak,strong)						\
1031.3Sthorpej	WEAK_ALIAS(weak,strong);					\
1041.3Sthorpej	PSEUDO(strong,weak)
1051.3Sthorpej#else
1061.3Sthorpej#define	WSYSCALL(weak,strong)						\
1071.3Sthorpej	PSEUDO(weak,weak)
1081.3Sthorpej#endif
1091.1Sbjh21
1101.2Smatt	.globl	CERROR
111