|
Packit Service |
82fcde |
/* Assembler macros for x86-64.
|
|
Packit Service |
82fcde |
Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
|
Packit Service |
82fcde |
This file is part of the GNU C Library.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
82fcde |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License as published by the Free Software Foundation; either
|
|
Packit Service |
82fcde |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
82fcde |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
82fcde |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
82fcde |
Lesser General Public License for more details.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License along with the GNU C Library; if not, see
|
|
Packit Service |
82fcde |
<http://www.gnu.org/licenses/>. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#ifndef _X86_64_SYSDEP_H
|
|
Packit Service |
82fcde |
#define _X86_64_SYSDEP_H 1
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <sysdeps/x86/sysdep.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#ifdef __ASSEMBLER__
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Syntactic details of assembler. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* This macro is for setting proper CFI with DW_CFA_expression describing
|
|
Packit Service |
82fcde |
the register as saved relative to %rsp instead of relative to the CFA.
|
|
Packit Service |
82fcde |
Expression is DW_OP_drop, DW_OP_breg7 (%rsp is register 7), sleb128 offset
|
|
Packit Service |
82fcde |
from %rsp. */
|
|
Packit Service |
82fcde |
#define cfi_offset_rel_rsp(regn, off) .cfi_escape 0x10, regn, 0x4, 0x13, \
|
|
Packit Service |
82fcde |
0x77, off & 0x7F | 0x80, off >> 7
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* If compiled for profiling, call `mcount' at the start of each function. */
|
|
Packit Service |
82fcde |
#ifdef PROF
|
|
Packit Service |
82fcde |
/* The mcount code relies on a normal frame pointer being on the stack
|
|
Packit Service |
82fcde |
to locate our caller, so push one just for its benefit. */
|
|
Packit Service |
82fcde |
#define CALL_MCOUNT \
|
|
Packit Service |
82fcde |
pushq %rbp; \
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8); \
|
|
Packit Service |
82fcde |
movq %rsp, %rbp; \
|
|
Packit Service |
82fcde |
cfi_def_cfa_register(%rbp); \
|
|
Packit Service |
82fcde |
call JUMPTARGET(mcount); \
|
|
Packit Service |
82fcde |
popq %rbp; \
|
|
Packit Service |
82fcde |
cfi_def_cfa(rsp,8);
|
|
Packit Service |
82fcde |
#else
|
|
Packit Service |
82fcde |
#define CALL_MCOUNT /* Do nothing. */
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#define PSEUDO(name, syscall_name, args) \
|
|
Packit Service |
82fcde |
lose: \
|
|
Packit Service |
82fcde |
jmp JUMPTARGET(syscall_error) \
|
|
Packit Service |
82fcde |
.globl syscall_error; \
|
|
Packit Service |
82fcde |
ENTRY (name) \
|
|
Packit Service |
82fcde |
DO_CALL (syscall_name, args); \
|
|
Packit Service |
82fcde |
jb lose
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#undef JUMPTARGET
|
|
Packit Service |
82fcde |
#ifdef SHARED
|
|
Packit Service |
82fcde |
# ifdef BIND_NOW
|
|
Packit Service |
82fcde |
# define JUMPTARGET(name) *name##@GOTPCREL(%rip)
|
|
Packit Service |
82fcde |
# else
|
|
Packit Service |
82fcde |
# define JUMPTARGET(name) name##@PLT
|
|
Packit Service |
82fcde |
# endif
|
|
Packit Service |
82fcde |
#else
|
|
Packit Service |
82fcde |
/* For static archives, branch to target directly. */
|
|
Packit Service |
82fcde |
# define JUMPTARGET(name) name
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Long and pointer size in bytes. */
|
|
Packit Service |
82fcde |
#define LP_SIZE 8
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Instruction to operate on long and pointer. */
|
|
Packit Service |
82fcde |
#define LP_OP(insn) insn##q
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Assembler address directive. */
|
|
Packit Service |
82fcde |
#define ASM_ADDR .quad
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Registers to hold long and pointer. */
|
|
Packit Service |
82fcde |
#define RAX_LP rax
|
|
Packit Service |
82fcde |
#define RBP_LP rbp
|
|
Packit Service |
82fcde |
#define RBX_LP rbx
|
|
Packit Service |
82fcde |
#define RCX_LP rcx
|
|
Packit Service |
82fcde |
#define RDI_LP rdi
|
|
Packit Service |
82fcde |
#define RDX_LP rdx
|
|
Packit Service |
82fcde |
#define RSI_LP rsi
|
|
Packit Service |
82fcde |
#define RSP_LP rsp
|
|
Packit Service |
82fcde |
#define R8_LP r8
|
|
Packit Service |
82fcde |
#define R9_LP r9
|
|
Packit Service |
82fcde |
#define R10_LP r10
|
|
Packit Service |
82fcde |
#define R11_LP r11
|
|
Packit Service |
82fcde |
#define R12_LP r12
|
|
Packit Service |
82fcde |
#define R13_LP r13
|
|
Packit Service |
82fcde |
#define R14_LP r14
|
|
Packit Service |
82fcde |
#define R15_LP r15
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#else /* __ASSEMBLER__ */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Long and pointer size in bytes. */
|
|
Packit Service |
82fcde |
#define LP_SIZE "8"
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Instruction to operate on long and pointer. */
|
|
Packit Service |
82fcde |
#define LP_OP(insn) #insn "q"
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Assembler address directive. */
|
|
Packit Service |
82fcde |
#define ASM_ADDR ".quad"
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Registers to hold long and pointer. */
|
|
Packit Service |
82fcde |
#define RAX_LP "rax"
|
|
Packit Service |
82fcde |
#define RBP_LP "rbp"
|
|
Packit Service |
82fcde |
#define RBX_LP "rbx"
|
|
Packit Service |
82fcde |
#define RCX_LP "rcx"
|
|
Packit Service |
82fcde |
#define RDI_LP "rdi"
|
|
Packit Service |
82fcde |
#define RDX_LP "rdx"
|
|
Packit Service |
82fcde |
#define RSI_LP "rsi"
|
|
Packit Service |
82fcde |
#define RSP_LP "rsp"
|
|
Packit Service |
82fcde |
#define R8_LP "r8"
|
|
Packit Service |
82fcde |
#define R9_LP "r9"
|
|
Packit Service |
82fcde |
#define R10_LP "r10"
|
|
Packit Service |
82fcde |
#define R11_LP "r11"
|
|
Packit Service |
82fcde |
#define R12_LP "r12"
|
|
Packit Service |
82fcde |
#define R13_LP "r13"
|
|
Packit Service |
82fcde |
#define R14_LP "r14"
|
|
Packit Service |
82fcde |
#define R15_LP "r15"
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#endif /* __ASSEMBLER__ */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#endif /* _X86_64_SYSDEP_H */
|