1 /* Copyright (C) 1992, 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
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 not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 #include <sysdeps/unix/sysdep.h>
21 /* For Linux we can use the system call table in the header file
22 /usr/include/asm/unistd.h
23 of the kernel. But these symbols do not follow the SYS_* syntax
24 so we have to redefine the `SYS_ify' macro here. */
27 # define SYS_ify(syscall_name) __NR_##syscall_name
29 # define SYS_ify(syscall_name) __NR_/**/syscall_name
34 /* This seems to always be the case on PPC. */
35 #define ALIGNARG(log2) log2
36 /* For ELF we need the `.type' directive to make shared libs work right. */
37 #define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg;
38 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name
40 /* If compiled for profiling, call `_mcount' at the start of each function. */
42 /* The mcount code relies on a the return address being on the stack
43 to locate our caller and so it can restore it; so store one just
54 bl _GLOBAL_OFFSET_TABLE_@local-4; \
56 lwz %r0,0b@got(%r11); \
57 bl JUMPTARGET(_mcount);
68 bl JUMPTARGET(_mcount);
71 #define CALL_MCOUNT /* Do nothing. */
75 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
76 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
81 #define EALIGN_W_0 /* No words to insert. */
82 #define EALIGN_W_1 nop
83 #define EALIGN_W_2 nop;nop
84 #define EALIGN_W_3 nop;nop;nop
85 #define EALIGN_W_4 EALIGN_W_3;nop
86 #define EALIGN_W_5 EALIGN_W_4;nop
87 #define EALIGN_W_6 EALIGN_W_5;nop
88 #define EALIGN_W_7 EALIGN_W_6;nop
90 /* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes
91 past a 2^align boundary. */
93 #define EALIGN(name, alignt, words) \
94 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
95 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
100 .align ALIGNARG(alignt); \
104 #define EALIGN(name, alignt, words) \
105 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
106 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
107 .align ALIGNARG(alignt); \
114 ASM_SIZE_DIRECTIVE(name)
116 #define DO_CALL(syscall) \
121 #define JUMPTARGET(name) name##@plt
123 #define JUMPTARGET(name) name
126 #define PSEUDO(name, syscall_name, args) \
129 DO_CALL (SYS_ify (syscall_name));
133 b JUMPTARGET(__syscall_error)
134 #define ret PSEUDO_RET
137 #define PSEUDO_END(name) \
140 /* Local labels stripped out by the linker. */
143 #endif /* ASSEMBLER */