1/* Copyright (C) 2005 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16 <http://www.gnu.org/licenses/>. */ 17 18#include <features.h> 19#include <bits/arm_asm.h> 20#include <bits/arm_bx.h> 21 22/* In the EABI syscall interface, we don't need a special syscall to 23 implement syscall(). It won't work reliably with 64-bit arguments 24 (but that is true on many modern platforms). */ 25 26.text 27.global syscall 28.type syscall,%function 29.align 4 30#if defined(THUMB1_ONLY) 31.thumb_func 32syscall: 33 push {r4, r5, r6, r7} 34 mov ip, r0 35 mov r0, r1 36 mov r1, r2 37 mov r2, r3 38 add r7, sp, #(4 * 4) 39 ldmia r7!, {r3, r4, r5, r6} 40 mov r7, ip 41 swi 0x0 42 pop {r4, r5, r6, r7} 43 ldr r1, =0xfffff000 44 cmp r0, r1 45 bcs 1f 46 bx lr 471: 48 push {r3, lr} 49 bl __syscall_error 50 POP_RET 51.pool 52#else 53syscall: 54 mov ip, sp 55 stmfd sp!, {r4, r5, r6, r7} 56 mov r7, r0 57 mov r0, r1 58 mov r1, r2 59 mov r2, r3 60 ldmfd ip, {r3, r4, r5, r6} 61 swi 0x0 62 ldmfd sp!, {r4, r5, r6, r7} 63 cmn r0, #4096 64 IT(t, cc) 65 BXC(cc, lr) 66 b __syscall_error 67#endif 68 69.size syscall,.-syscall 70