1 /* Assembler macros for CRIS.
2 Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
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 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 see <http://www.gnu.org/licenses/>. */
22 #include <sys/syscall.h>
26 /* Define a macro we can use to construct the asm name for a C symbol. */
28 #define C_LABEL(name) name##:
30 #define C_LABEL(name) name/**/:
36 #define STR(x) __STR(x)
38 /* Mark the end of function named SYM. This is used on some platforms
39 to generate correct debugging information. */
45 #define SYS_ify(syscall_name) (__NR_##syscall_name)
50 #define SYS_ify(syscall_name) __NR_##syscall_name
52 /* Syntactic details of assembly-code. */
54 /* It is *not* generally true that "ELF uses byte-counts for .align, most
55 others use log2 of count of bytes", like some neighboring configs say.
56 See "align" in gas/read.c which is not overridden by
57 gas/config/obj-elf.c. It takes a log2 argument. *Some* targets
58 override it to take a byte argument. People should read source instead
59 of relying on hearsay. */
60 #define ALIGNARG(log2) log2
62 #define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg
63 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name
65 /* The non-PIC jump is preferred, since it does not stall, and does not
66 invoke generation of a PLT. These macros assume that $r0 is set up as
71 ba C_SYMBOL_NAME (_x):PLT @ \
75 bsr C_SYMBOL_NAME (_x):PLT @ \
81 lapc _GLOBAL_OFFSET_TABLE_,$r0
83 #define TEARDOWN_PIC move.d [$sp+],$r0
86 ba C_SYMBOL_NAME (_x) @ \
90 bsr C_SYMBOL_NAME (_x) @ \
100 #define PLTJUMP(_x) \
101 add.d C_SYMBOL_NAME (_x):PLT,$pc
103 #define PLTCALL(_x) \
104 jsr [$r0+C_SYMBOL_NAME (_x):GOTPLT16]
111 #define TEARDOWN_PIC pop $r0
113 #define PLTJUMP(_x) jump C_SYMBOL_NAME (_x)
114 #define PLTCALL(_x) jsr C_SYMBOL_NAME (_x)
119 #endif /* __arch_v32 */
121 /* Define an entry point visible from C. */
122 #define ENTRY(name) \
124 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (name) @ \
125 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME (name), function) @ \
126 .align ALIGNARG (2) @ \
129 #define HIDDEN_ENTRY(name) \
131 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (name) @ \
132 .hidden C_SYMBOL_NAME (name) @ \
133 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME (name), function) @ \
134 .align ALIGNARG (2) @ \
139 ASM_SIZE_DIRECTIVE (C_SYMBOL_NAME (name))
141 #define PSEUDO(name, syscall_name, args) \
144 movu.w SYS_ify (syscall_name),$r9 @ \
146 cmps.w -4096,$r10 @ \
149 UNDOARGS_return_##args
151 #define PSEUDO_END(name) \
154 PLTJUMP (__syscall_error) @ \
157 #endif /* __ASSEMBLER__ */
158 #endif /* _SYSDEP_H_ */