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
21 /* Symbolic names for the registers. The only portable way to write asm
22 code is to use number but this produces really unreadable code.
23 Therefore these symbolic names. */
25 /* Integer registers. */
59 /* Floating-point registers. */
93 /* Condition code registers. */
106 /* This seems to always be the case on PPC. */
107 #define ALIGNARG(log2) log2
108 /* For ELF we need the `.type' directive to make shared libs work right. */
109 #define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg;
110 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name
112 /* If compiled for profiling, call `_mcount' at the start of each function. */
114 /* The mcount code relies on a the return address being on the stack
115 to locate our caller and so it can restore it; so store one just
118 #define CALL_MCOUNT \
121 .align ALIGNARG(2); \
126 bl _GLOBAL_OFFSET_TABLE_@local-4; \
128 lwz r0,0b@got(r11); \
129 bl JUMPTARGET(_mcount);
131 #define CALL_MCOUNT \
133 .align ALIGNARG(2); \
140 bl JUMPTARGET(_mcount);
143 #define CALL_MCOUNT /* Do nothing. */
146 #define ENTRY(name) \
147 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
148 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
149 .align ALIGNARG(2); \
153 #define EALIGN_W_0 /* No words to insert. */
154 #define EALIGN_W_1 nop
155 #define EALIGN_W_2 nop;nop
156 #define EALIGN_W_3 nop;nop;nop
157 #define EALIGN_W_4 EALIGN_W_3;nop
158 #define EALIGN_W_5 EALIGN_W_4;nop
159 #define EALIGN_W_6 EALIGN_W_5;nop
160 #define EALIGN_W_7 EALIGN_W_6;nop
162 /* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes
163 past a 2^align boundary. */
165 #define EALIGN(name, alignt, words) \
166 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
167 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
168 .align ALIGNARG(2); \
172 .align ALIGNARG(alignt); \
176 #define EALIGN(name, alignt, words) \
177 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
178 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
179 .align ALIGNARG(alignt); \
186 ASM_SIZE_DIRECTIVE(name)
188 #define DO_CALL(syscall) \
193 #define JUMPTARGET(name) name##@plt
195 #define JUMPTARGET(name) name
198 #define PSEUDO(name, syscall_name, args) \
201 DO_CALL (SYS_ify (syscall_name));
205 b JUMPTARGET(__syscall_error)
206 #define ret PSEUDO_RET
209 #define PSEUDO_END(name) \
212 /* Local labels stripped out by the linker. */
216 /* Label in text section. */
217 #define C_TEXT(name) name
222 #endif /* __ASSEMBLER__ */