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 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
23 #include <sys/syscall.h>
27 /* Define a macro we can use to construct the asm name for a C symbol. */
29 #define C_LABEL(name) name##:
31 #define C_LABEL(name) name/**/:
37 #define STR(x) __STR(x)
39 /* Mark the end of function named SYM. This is used on some platforms
40 to generate correct debugging information. */
46 #define SYS_ify(syscall_name) (__NR_##syscall_name)
51 #define SYS_ify(syscall_name) __NR_##syscall_name
53 /* Syntactic details of assembly-code. */
55 /* It is *not* generally true that "ELF uses byte-counts for .align, most
56 others use log2 of count of bytes", like some neighboring configs say.
57 See "align" in gas/read.c which is not overridden by
58 gas/config/obj-elf.c. It takes a log2 argument. *Some* targets
59 override it to take a byte argument. People should read source instead
60 of relying on hearsay. */
61 #define ALIGNARG(log2) log2
63 #define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg
64 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name
66 /* The non-PIC jump is preferred, since it does not stall, and does not
67 invoke generation of a PLT. These macros assume that $r0 is set up as
72 ba C_SYMBOL_NAME (_x):PLT @ \
76 bsr C_SYMBOL_NAME (_x):PLT @ \
82 lapc _GLOBAL_OFFSET_TABLE_,$r0
84 #define TEARDOWN_PIC move.d [$sp+],$r0
87 ba C_SYMBOL_NAME (_x) @ \
91 bsr C_SYMBOL_NAME (_x) @ \
101 #define PLTJUMP(_x) \
102 add.d C_SYMBOL_NAME (_x):PLT,$pc
104 #define PLTCALL(_x) \
105 jsr [$r0+C_SYMBOL_NAME (_x):GOTPLT16]
112 #define TEARDOWN_PIC pop $r0
114 #define PLTJUMP(_x) jump C_SYMBOL_NAME (_x)
115 #define PLTCALL(_x) jsr C_SYMBOL_NAME (_x)
120 #endif /* __arch_v32 */
122 /* Define an entry point visible from C. */
123 #define ENTRY(name) \
125 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (name) @ \
126 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME (name), function) @ \
127 .align ALIGNARG (2) @ \
132 ASM_SIZE_DIRECTIVE (C_SYMBOL_NAME (name))
134 #define PSEUDO(name, syscall_name, args) \
137 movu.w SYS_ify (syscall_name),$r9 @ \
139 cmps.w -4096,$r10 @ \
142 UNDOARGS_return_##args
144 #define PSEUDO_END(name) \
147 PLTJUMP (__syscall_error) @ \
150 #endif /* __ASSEMBLER__ */
151 #endif /* _SYSDEP_H_ */