SYS.h revision 158846
1251881Speter/*	$NetBSD: SYS.h,v 1.8 2003/08/07 16:42:02 agc Exp $	*/
2251881Speter
3251881Speter/*-
4251881Speter * Copyright (c) 1990 The Regents of the University of California.
5251881Speter * All rights reserved.
6251881Speter *
7251881Speter * This code is derived from software contributed to Berkeley by
8251881Speter * William Jolitz.
9251881Speter *
10251881Speter * Redistribution and use in source and binary forms, with or without
11251881Speter * modification, are permitted provided that the following conditions
12251881Speter * are met:
13251881Speter * 1. Redistributions of source code must retain the above copyright
14251881Speter *    notice, this list of conditions and the following disclaimer.
15251881Speter * 2. Redistributions in binary form must reproduce the above copyright
16251881Speter *    notice, this list of conditions and the following disclaimer in the
17251881Speter *    documentation and/or other materials provided with the distribution.
18251881Speter * 3. Neither the name of the University nor the names of its contributors
19251881Speter *    may be used to endorse or promote products derived from this software
20251881Speter *    without specific prior written permission.
21251881Speter *
22251881Speter * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23251881Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24251881Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25251881Speter * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26251881Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27251881Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28251881Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29251881Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30251881Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31251881Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32251881Speter * SUCH DAMAGE.
33251881Speter *
34251881Speter *	from: @(#)SYS.h	5.5 (Berkeley) 5/7/91
35251881Speter * $FreeBSD: head/lib/libc/arm/SYS.h 158846 2006-05-23 02:52:14Z imp $
36251881Speter */
37251881Speter
38251881Speter#include <machine/asm.h>
39251881Speter#include <sys/syscall.h>
40251881Speter#include <machine/swi.h>
41251881Speter
42251881Speter#define SYSTRAP(x)	swi 0 | SYS_ ## x
43251881Speter
44251881Speter#define	CERROR		_C_LABEL(cerror)
45251881Speter#define	CURBRK		_C_LABEL(curbrk)
46251881Speter
47251881Speter#define _SYSCALL_NOERROR(x)						\
48251881Speter	ENTRY(__CONCAT(__sys_, x));					\
49251881Speter	.weak _C_LABEL(x);						\
50251881Speter	.set _C_LABEL(x), _C_LABEL(__CONCAT(__sys_,x));			\
51251881Speter	.weak _C_LABEL(__CONCAT(_,x));					\
52251881Speter	.set _C_LABEL(__CONCAT(_,x)),_C_LABEL(__CONCAT(__sys_,x));	\
53251881Speter	SYSTRAP(x)
54251881Speter
55251881Speter#define _SYSCALL(x)							\
56251881Speter	_SYSCALL_NOERROR(x);						\
57251881Speter	bcs PIC_SYM(CERROR, PLT)
58251881Speter
59251881Speter#define SYSCALL_NOERROR(x)						\
60251881Speter	_SYSCALL_NOERROR(x)
61251881Speter
62251881Speter#define SYSCALL(x)							\
63251881Speter	_SYSCALL(x)
64251881Speter
65251881Speter
66251881Speter#define PSEUDO_NOERROR(x)						\
67251881Speter	_SYSCALL_NOERROR(x);						\
68251881Speter	RET
69251881Speter
70251881Speter#define PSEUDO(x)							\
71251881Speter	_SYSCALL(x);							\
72251881Speter	RET
73251881Speter
74251881Speter
75251881Speter#define RSYSCALL_NOERROR(x)						\
76251881Speter	PSEUDO_NOERROR(x)
77251881Speter
78251881Speter#define RSYSCALL(x)							\
79251881Speter	PSEUDO(x)
80251881Speter
81251881Speter	.globl  CERROR
82251881Speter