1/* Copyright (C) 2010-2022 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 <https://www.gnu.org/licenses/>. */
17
18/* When this file is built for inclusion in nscd, _FORTIFY_SOURCE is
19 defined but -O is not used, resulting in a warning from features.h. */
20#undef _FORTIFY_SOURCE
21#include <sysdep.h>
22
23/* Out-of-line syscall stub. We expect the system call number in ip
24 and return the raw result in r0. No registers are clobbered.
25 We could avoid using the stack for this, but the goal is accurate
26 unwind information - and while there is a reserved prefix in the
27 ARM unwind tables for register to register moves, the actual opcodes
28 are not defined. */
29
30#if defined(__thumb__)
31 .thumb
32 .syntax unified
33 .hidden __libc_do_syscall
34
35#undef CALL_MCOUNT
36#define CALL_MCOUNT
37
38ENTRY (__libc_do_syscall)
39 .fnstart
40 push {r7, lr}
41 .save {r7, lr}
42 cfi_adjust_cfa_offset (8)
43 cfi_rel_offset (r7, 0)
44 cfi_rel_offset (lr, 4)
45 mov r7, ip
46 swi 0x0
47 pop {r7, pc}
48 .fnend
49END (__libc_do_syscall)
50
51#endif /* __thumb__ */
52

source code of glibc/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S