manual/probes.texi: Use "triggered" instead of "hit"
[jlayton/glibc.git] / sysdeps / aarch64 / sysdep.h
1 /* Copyright (C) 1997-2014 Free Software Foundation, Inc.
2
3    This file is part of the GNU C Library.
4
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 License as
7    published by the Free Software Foundation; either version 2.1 of the
8    License, or (at your option) any later version.
9
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.
14
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/>.  */
18
19 #include <sysdeps/generic/sysdep.h>
20
21 #ifdef  __ASSEMBLER__
22
23 /* Syntactic details of assembler.  */
24
25 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name
26
27 /* Define an entry point visible from C.  */
28 #define ENTRY(name)                                             \
29   .globl C_SYMBOL_NAME(name);                                   \
30   .type C_SYMBOL_NAME(name),%function;                          \
31   .align 4;                                                     \
32   C_LABEL(name)                                                 \
33   cfi_startproc;                                                \
34   CALL_MCOUNT
35
36 /* Define an entry point visible from C.  */
37 #define ENTRY_ALIGN(name, align)                                \
38   .globl C_SYMBOL_NAME(name);                                   \
39   .type C_SYMBOL_NAME(name),%function;                          \
40   .p2align align;                                               \
41   C_LABEL(name)                                                 \
42   cfi_startproc;                                                \
43   CALL_MCOUNT
44
45 /* Define an entry point visible from C with a specified alignment and
46    pre-padding with NOPs.  This can be used to ensure that a critical
47    loop within a function is cache line aligned.  Note this version
48    does not adjust the padding if CALL_MCOUNT is defined. */
49
50 #define ENTRY_ALIGN_AND_PAD(name, align, padding)               \
51   .globl C_SYMBOL_NAME(name);                                   \
52   .type C_SYMBOL_NAME(name),%function;                          \
53   .p2align align;                                               \
54   .rep padding;                                                 \
55   nop;                                                          \
56   .endr;                                                        \
57   C_LABEL(name)                                                 \
58   cfi_startproc;                                                \
59   CALL_MCOUNT
60
61 #undef  END
62 #define END(name)                                               \
63   cfi_endproc;                                                  \
64   ASM_SIZE_DIRECTIVE(name)
65
66 /* If compiled for profiling, call `mcount' at the start of each function.  */
67 #ifdef  PROF
68 # define CALL_MCOUNT                                            \
69         str     x30, [sp, #-16]!;                               \
70         bl      mcount;                                         \
71         ldr     x30, [sp], #16  ;
72 #else
73 # define CALL_MCOUNT            /* Do nothing.  */
74 #endif
75
76 /* Local label name for asm code.  */
77 #ifndef L
78 # define L(name)         .L##name
79 #endif
80
81 /* Load or store to/from a pc-relative EXPR into/from R, using T.  */
82 #define LDST_PCREL(OP, R, T, EXPR)  \
83         adrp    T, EXPR;            \
84         OP      R, [T, #:lo12:EXPR];\
85
86 /* Load or store to/from a got-relative EXPR into/from R, using T.  */
87 #define LDST_GLOBAL(OP, R, T, EXPR)     \
88         adrp    T, :got:EXPR;           \
89         ldr     T, [T, #:got_lo12:EXPR];\
90         OP      R, [T];
91
92 /* Since C identifiers are not normally prefixed with an underscore
93    on this system, the asm identifier `syscall_error' intrudes on the
94    C name space.  Make sure we use an innocuous name.  */
95 #define syscall_error   __syscall_error
96 #define mcount          _mcount
97
98 #endif  /* __ASSEMBLER__ */