1 /* Copyright (C) 1999, 2001 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 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.
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.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 #include_next <sysdep.h>
23 /* Symbolic names for the registers. The only portable way to write asm
24 code is to use number but this produces really unreadable code.
25 Therefore these symbolic names. */
27 /* Integer registers. */
61 /* Floating-point registers. */
95 /* Condition code registers. */
108 /* This seems to always be the case on PPC. */
109 #define ALIGNARG(log2) log2
110 /* For ELF we need the `.type' directive to make shared libs work right. */
111 #define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg;
112 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name
114 /* If compiled for profiling, call `_mcount' at the start of each function. */
116 /* The mcount code relies on a the return address being on the stack
117 to locate our caller and so it can restore it; so store one just
120 #define CALL_MCOUNT \
123 .align ALIGNARG(2); \
128 bl _GLOBAL_OFFSET_TABLE_@local-4; \
130 lwz r0,0b@got(r11); \
131 bl JUMPTARGET(_mcount);
133 #define CALL_MCOUNT \
135 .align ALIGNARG(2); \
142 bl JUMPTARGET(_mcount);
145 #define CALL_MCOUNT /* Do nothing. */
148 #define ENTRY(name) \
149 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
150 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
151 .align ALIGNARG(2); \
155 #define EALIGN_W_0 /* No words to insert. */
156 #define EALIGN_W_1 nop
157 #define EALIGN_W_2 nop;nop
158 #define EALIGN_W_3 nop;nop;nop
159 #define EALIGN_W_4 EALIGN_W_3;nop
160 #define EALIGN_W_5 EALIGN_W_4;nop
161 #define EALIGN_W_6 EALIGN_W_5;nop
162 #define EALIGN_W_7 EALIGN_W_6;nop
164 /* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes
165 past a 2^align boundary. */
167 #define EALIGN(name, alignt, words) \
168 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
169 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
170 .align ALIGNARG(2); \
174 .align ALIGNARG(alignt); \
178 #define EALIGN(name, alignt, words) \
179 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
180 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
181 .align ALIGNARG(alignt); \
188 ASM_SIZE_DIRECTIVE(name)
190 #define DO_CALL(syscall) \
195 #define JUMPTARGET(name) name##@plt
197 #define JUMPTARGET(name) name
200 #define PSEUDO(name, syscall_name, args) \
203 DO_CALL (SYS_ify (syscall_name));
207 b JUMPTARGET(__syscall_error)
208 #define ret PSEUDO_RET
211 #define PSEUDO_END(name) \
214 /* Local labels stripped out by the linker. */
218 /* Label in text section. */
219 #define C_TEXT(name) name
224 #endif /* __ASSEMBLER__ */