1/* Out-of-line syscall stub for six-argument syscalls from C.
2 Copyright (C) 2015-2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sysdep.h>
20
21/* %eax, %ecx, %edx and %esi contain the values expected by the kernel.
22 %edi points to a structure with the values of %ebx, %edi and %ebp. */
23
24 .hidden __libc_do_syscall
25
26ENTRY (__libc_do_syscall)
27 pushl %ebx
28 cfi_adjust_cfa_offset (4)
29 cfi_rel_offset (ebx, 0)
30 pushl %edi
31 cfi_adjust_cfa_offset (4)
32 cfi_rel_offset (edi, 0)
33 pushl %ebp
34 cfi_adjust_cfa_offset (4)
35 cfi_rel_offset (ebp, 0)
36 movl 0(%edi), %ebx
37 movl 8(%edi), %ebp
38 movl 4(%edi), %edi
39 ENTER_KERNEL
40 popl %ebp
41 cfi_adjust_cfa_offset (-4)
42 cfi_restore (ebp)
43 popl %edi
44 cfi_adjust_cfa_offset (-4)
45 cfi_restore (edi)
46 popl %ebx
47 cfi_adjust_cfa_offset (-4)
48 cfi_restore (ebx)
49 ret
50END (__libc_do_syscall)
51

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