]> code.delx.au - gnu-emacs/blob - test/etags/c-src/sysdep.h
* test/automated/viper-tests.el (viper-test-undo-kmacro):
[gnu-emacs] / test / etags / c-src / sysdep.h
1 /* Copyright (C) 1992-1993, 2016 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 Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 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 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
18
19 #include <sysdeps/unix/sysdep.h>
20
21 #define ENTRY(name) \
22 .globl _##name; \
23 .align 2; \
24 _##name##:
25
26 #define PSEUDO(name, syscall_name, args) \
27 .text; \
28 .globl syscall_error; \
29 ENTRY (name) \
30 XCHG_##args
31 movl $SYS_##syscall_name, %eax; \
32 int $0x80; \
33 test %eax, %eax; \
34 jl syscall_error; \
35 XCHG_##args
36
37 /* Linux takes system call arguments in registers:
38 1: %ebx
39 2: %ecx
40 3: %edx
41 4: %esi
42 5: %edi
43 We put the arguments into registers from the stack,
44 and save the registers, by using the 386 `xchg' instruction
45 to swap the values in both directions. */
46
47 #define XCHG_0 /* No arguments to frob. */
48 #define XCHG_1 xchg 8(%esp), %ebx; XCHG_0
49 #define XCHG_2 xchg 12(%esp), %ecx; XCHG_1
50 #define XCHG_3 xchg 16(%esp), %edx; XCHG_2
51 #define XCHG_4 xchg 20(%esp), %esi; XCHG_3
52 #define XCHG_5 xchg 24(%esp), %edi; XCHG_3
53
54 #define r0 %eax /* Normal return-value register. */
55 #define r1 %edx /* Secondary return-value register. */
56 #define scratch %ecx /* Call-clobbered register for random use. */
57 #define MOVE(x,y) movl x, y