Changeset View
Changeset View
Standalone View
Standalone View
lib/libsys/arm/SYS.h
- This file was copied from lib/libc/i386/SYS.h.
/* $NetBSD: SYS.h,v 1.8 2003/08/07 16:42:02 agc Exp $ */ | |||||
/*- | /*- | ||||
* SPDX-License-Identifier: BSD-3-Clause | * SPDX-License-Identifier: BSD-3-Clause | ||||
* | * | ||||
* Copyright (c) 1990 The Regents of the University of California. | * Copyright (c) 1990 The Regents of the University of California. | ||||
* All rights reserved. | * All rights reserved. | ||||
* | * | ||||
* This code is derived from software contributed to Berkeley by | * This code is derived from software contributed to Berkeley by | ||||
* William Jolitz. | * William Jolitz. | ||||
Show All 17 Lines | |||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
* | * | ||||
* @(#)SYS.h 5.5 (Berkeley) 5/7/91 | * from: @(#)SYS.h 5.5 (Berkeley) 5/7/91 | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#include <sys/syscall.h> | |||||
#include <machine/asm.h> | #include <machine/asm.h> | ||||
#include <sys/syscall.h> | |||||
#include <machine/swi.h> | |||||
#define SYSCALL(name) ENTRY(__sys_##name); \ | #define SYSTRAP(x) \ | ||||
WEAK_REFERENCE(__sys_##name, name); \ | mov ip, r7; \ | ||||
WEAK_REFERENCE(__sys_##name, _##name); \ | ldr r7, =SYS_ ## x; \ | ||||
mov $SYS_##name,%eax; KERNCALL; \ | swi 0; \ | ||||
jb HIDENAME(cerror) | mov r7, ip | ||||
#define RSYSCALL(name) SYSCALL(name); ret; END(__sys_##name) | #define CERROR _C_LABEL(cerror) | ||||
#define CURBRK _C_LABEL(curbrk) | |||||
#define PSEUDO(name) ENTRY(__sys_##name); \ | #define _SYSCALL_NOERROR(x) \ | ||||
WEAK_REFERENCE(__sys_##name, _##name); \ | ENTRY(__CONCAT(__sys_, x)); \ | ||||
mov $SYS_##name,%eax; KERNCALL; \ | .weak _C_LABEL(x); \ | ||||
jb HIDENAME(cerror); ret; \ | .set _C_LABEL(x), _C_LABEL(__CONCAT(__sys_,x)); \ | ||||
END(__sys_##name) | .weak _C_LABEL(__CONCAT(_,x)); \ | ||||
.set _C_LABEL(__CONCAT(_,x)),_C_LABEL(__CONCAT(__sys_,x)); \ | |||||
SYSTRAP(x) | |||||
/* gas messes up offset -- although we don't currently need it, do for BCS */ | #define _SYSCALL(x) \ | ||||
#define LCALL(x,y) .byte 0x9a ; .long y; .word x | _SYSCALL_NOERROR(x); \ | ||||
it cs; \ | |||||
bcs PIC_SYM(CERROR, PLT) | |||||
#define KERNCALL int $0x80 | #define SYSCALL(x) \ | ||||
_SYSCALL(x) | |||||
#define PSEUDO(x) \ | |||||
ENTRY(__CONCAT(__sys_, x)); \ | |||||
.weak _C_LABEL(__CONCAT(_,x)); \ | |||||
.set _C_LABEL(__CONCAT(_,x)),_C_LABEL(__CONCAT(__sys_,x)); \ | |||||
SYSTRAP(x); \ | |||||
it cs; \ | |||||
bcs PIC_SYM(CERROR, PLT); \ | |||||
RET | |||||
#define RSYSCALL(x) \ | |||||
_SYSCALL(x); \ | |||||
RET | |||||
.globl CERROR |