1 /* Assembler macros for x86-64.
2 Copyright (C) 2001, 2002, 2003 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 Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the 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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #include_next <sysdep.h>
24 /* Syntactic details of assembler. */
26 #define cfi_startproc .cfi_startproc
27 #define cfi_endproc .cfi_endproc
28 #define cfi_def_cfa(reg, off) .cfi_def_cfa reg, off
29 #define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg
30 #define cfi_def_cfa_offset(off) .cfi_def_cfa_offset off
31 #define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
32 #define cfi_offset(reg, off) .cfi_offset reg, off
33 #define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off
34 #define cfi_register(r1, r2) .cfi_register r1, r2
35 #define cfi_return_column(reg) .cfi_return_column reg
36 #define cfi_restore(reg) .cfi_restore reg
37 #define cfi_same_value(reg) .cfi_same_value reg
38 #define cfi_undefined(reg) .cfi_undefined reg
39 #define cfi_remember_state .cfi_remember_state
40 #define cfi_restore_state .cfi_restore_state
41 #define cfi_window_save .cfi_window_save
45 /* ELF uses byte-counts for .align, most others use log2 of count of bytes. */
46 #define ALIGNARG(log2) 1<<log2
47 /* For ELF we need the `.type' directive to make shared libs work right. */
48 #define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg;
49 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name;
51 /* In ELF C symbols are asm symbols. */
53 #define NO_UNDERSCORES
57 #define ALIGNARG(log2) log2
58 #define ASM_TYPE_DIRECTIVE(name,type) /* Nothing is specified. */
59 #define ASM_SIZE_DIRECTIVE(name) /* Nothing is specified. */
64 /* Define an entry point visible from C. */
66 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
67 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
76 ASM_SIZE_DIRECTIVE(name)
78 /* If compiled for profiling, call `mcount' at the start of each function. */
80 /* The mcount code relies on a normal frame pointer being on the stack
81 to locate our caller, so push one just for its benefit. */
84 cfi_adjust_cfa_offset(8); \
86 cfi_def_cfa_register(%rbp); \
87 call JUMPTARGET(mcount); \
91 #define CALL_MCOUNT /* Do nothing. */
95 /* Since C identifiers are not normally prefixed with an underscore
96 on this system, the asm identifier `syscall_error' intrudes on the
97 C name space. Make sure we use an innocuous name. */
98 #define syscall_error __syscall_error
99 #define mcount _mcount
102 #define PSEUDO(name, syscall_name, args) \
104 jmp JUMPTARGET(syscall_error) \
105 .globl syscall_error; \
107 DO_CALL (syscall_name, args); \
111 #define PSEUDO_END(name) \
116 #define JUMPTARGET(name) name##@PLT
118 #define JUMPTARGET(name) name
121 /* Local label name for asm code. */
124 /* ELF-like local names start with `.L'. */
125 # define L(name) .L##name
127 # define L(name) name
131 #endif /* __ASSEMBLER__ */