Replace FSF snail mail address with URLs.
[glibc.git] / sysdeps / s390 / s390-64 / sysdep.h
blobd5465b37e2e89fadc6765db8ad4429383a06b9e3
1 /* Assembler macros for 64 bit S/390.
2 Copyright (C) 2001, 2003, 2012 Free Software Foundation, Inc.
3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
20 #include <sysdeps/generic/sysdep.h>
22 #ifdef __ASSEMBLER__
24 /* Syntactic details of assembler. */
26 /* ELF uses byte-counts for .align, most others use log2 of count of bytes. */
27 #define ALIGNARG(log2) 1<<log2
28 /* For ELF we need the `.type' directive to make shared libs work right. */
29 #define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg;
30 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name;
33 /* Define an entry point visible from C. */
34 #define ENTRY(name) \
35 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
36 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
37 .align ALIGNARG(2); \
38 C_LABEL(name) \
39 cfi_startproc; \
40 CALL_MCOUNT
42 #undef END
43 #define END(name) \
44 cfi_endproc; \
45 ASM_SIZE_DIRECTIVE(name) \
47 /* If compiled for profiling, call `mcount' at the start of each function. */
48 #ifdef PROF
49 #ifdef PIC
50 #define CALL_MCOUNT \
51 lgr 0,14 ; larl 1,0f ; brasl 14,_mcount@PLT ; lgr 14,0 ; \
52 .data ; .align 4 ; 0: .long 0 ; .text ;
53 #else
54 #define CALL_MCOUNT \
55 lgr 0,14 ; larl 1,0f ; brasl 14,_mcount ; lgr 14,0 ; \
56 .data ; .align 4 ; 0: .long 0 ; .text ;
57 #endif
58 #else
59 #define CALL_MCOUNT /* Do nothing. */
60 #endif
62 /* Since C identifiers are not normally prefixed with an underscore
63 on this system, the asm identifier `syscall_error' intrudes on the
64 C name space. Make sure we use an innocuous name. */
65 #define syscall_error __syscall_error
66 #define mcount _mcount
68 #define PSEUDO(name, syscall_name, args) \
69 lose: SYSCALL_PIC_SETUP \
70 jg JUMPTARGET(syscall_error); \
71 .globl syscall_error; \
72 ENTRY (name) \
73 DO_CALL (syscall_name, args); \
74 jm lose
76 #undef PSEUDO_END
77 #define PSEUDO_END(name) \
78 END (name)
80 #undef JUMPTARGET
81 #ifdef PIC
82 #define JUMPTARGET(name) name##@PLT
83 #define SYSCALL_PIC_SETUP \
84 larl %r12,_GLOBAL_OFFSET_TABLE_
85 #else
86 #define JUMPTARGET(name) name
87 #define SYSCALL_PIC_SETUP /* Nothing. */
88 #endif
90 /* Local label name for asm code. */
91 #ifndef L
92 #define L(name) .L##name
93 #endif
95 #endif /* __ASSEMBLER__ */