1 /* Assembler macros for x86-64.
2 Copyright (C) 2001-2013 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, see
17 <http://www.gnu.org/licenses/>. */
19 #ifndef _X86_64_SYSDEP_H
20 #define _X86_64_SYSDEP_H 1
22 #include <sysdeps/generic/sysdep.h>
26 /* Syntactic details of assembler. */
28 /* ELF uses byte-counts for .align, most others use log2 of count of bytes. */
29 #define ALIGNARG(log2) 1<<log2
30 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name;
33 /* Define an entry point visible from C. */
35 .globl C_SYMBOL_NAME(name); \
36 .type C_SYMBOL_NAME(name),@function; \
45 ASM_SIZE_DIRECTIVE(name)
47 #define ENTRY_CHK(name) ENTRY (name)
48 #define END_CHK(name) END (name)
50 /* If compiled for profiling, call `mcount' at the start of each function. */
52 /* The mcount code relies on a normal frame pointer being on the stack
53 to locate our caller, so push one just for its benefit. */
56 cfi_adjust_cfa_offset(8); \
58 cfi_def_cfa_register(%rbp); \
59 call JUMPTARGET(mcount); \
63 #define CALL_MCOUNT /* Do nothing. */
66 /* Since C identifiers are not normally prefixed with an underscore
67 on this system, the asm identifier `syscall_error' intrudes on the
68 C name space. Make sure we use an innocuous name. */
69 #define syscall_error __syscall_error
70 #define mcount _mcount
72 #define PSEUDO(name, syscall_name, args) \
74 jmp JUMPTARGET(syscall_error) \
75 .globl syscall_error; \
77 DO_CALL (syscall_name, args); \
81 #define PSEUDO_END(name) \
86 #define JUMPTARGET(name) name##@PLT
88 #define JUMPTARGET(name) name
91 /* Local label name for asm code. */
93 /* ELF-like local names start with `.L'. */
94 # define L(name) .L##name
97 #define atom_text_section .section ".text.atom", "ax"
99 /* Long and pointer size in bytes. */
102 /* Instruction to operate on long and pointer. */
103 #define LP_OP(insn) insn##q
105 /* Assembler address directive. */
106 #define ASM_ADDR .quad
108 /* Registers to hold long and pointer. */
126 #else /* __ASSEMBLER__ */
128 /* Long and pointer size in bytes. */
131 /* Instruction to operate on long and pointer. */
132 #define LP_OP(insn) #insn "q"
134 /* Assembler address directive. */
135 #define ASM_ADDR ".quad"
137 /* Registers to hold long and pointer. */
155 #endif /* __ASSEMBLER__ */
157 #endif /* _X86_64_SYSDEP_H */