glibc/ports/sysdeps/aarch64/sysdep.h

88 lines
2.6 KiB
C
Raw Normal View History

/* Copyright (C) 1997-2013 Free Software Foundation, Inc.
2012-11-10 01:53:51 +08:00
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <sysdeps/generic/sysdep.h>
#ifdef __ASSEMBLER__
/* Syntactic details of assembler. */
#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
/* Define an entry point visible from C. */
2013-01-16 20:53:34 +08:00
#define ENTRY(name) \
.globl C_SYMBOL_NAME(name); \
.type C_SYMBOL_NAME(name),%function; \
.align 4; \
C_LABEL(name) \
cfi_startproc; \
2012-11-10 01:53:51 +08:00
CALL_MCOUNT
2013-01-16 20:58:40 +08:00
/* Define an entry point visible from C. */
#define ENTRY_ALIGN(name, align) \
.globl C_SYMBOL_NAME(name); \
.type C_SYMBOL_NAME(name),%function; \
.p2align align; \
C_LABEL(name) \
cfi_startproc; \
CALL_MCOUNT
/* Define an entry point visible from C with a specified alignment and
pre-padding with NOPs. This can be used to ensure that a critical
loop within a function is cache line aligned. Note this version
does not adjust the padding if CALL_MCOUNT is defined. */
#define ENTRY_ALIGN_AND_PAD(name, align, padding) \
.globl C_SYMBOL_NAME(name); \
.type C_SYMBOL_NAME(name),%function; \
.p2align align; \
.rep padding; \
nop; \
.endr; \
C_LABEL(name) \
cfi_startproc; \
CALL_MCOUNT
2012-11-10 01:53:51 +08:00
#undef END
2013-01-16 20:53:34 +08:00
#define END(name) \
cfi_endproc; \
2012-11-10 01:53:51 +08:00
ASM_SIZE_DIRECTIVE(name)
/* If compiled for profiling, call `mcount' at the start of each function. */
#ifdef PROF
2013-01-16 20:53:34 +08:00
# define CALL_MCOUNT \
str x30, [sp, #-16]!; \
bl mcount; \
2012-11-10 01:53:51 +08:00
ldr x30, [sp], #16 ;
#else
# define CALL_MCOUNT /* Do nothing. */
#endif
/* Local label name for asm code. */
#ifndef L
# define L(name) .L##name
#endif
/* Since C identifiers are not normally prefixed with an underscore
on this system, the asm identifier `syscall_error' intrudes on the
C name space. Make sure we use an innocuous name. */
#define syscall_error __syscall_error
#define mcount _mcount
#endif /* __ASSEMBLER__ */