* sysdeps/powerpc/sysdep.h: Remove powerpc32 specific macros.
[glibc.git] / sysdeps / powerpc / powerpc32 / sysdep.h
blob917974679054e76cb695126239edfb275bf4af5d
1 /* Assembly macros for 32-bit PowerPC.
2 Copyright (C) 1999, 2001, 2002 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifdef __ASSEMBLER__
22 #include <sysdeps/powerpc/sysdep.h>
24 #ifdef __ELF__
26 /* If compiled for profiling, call `_mcount' at the start of each
27 function. */
28 #ifdef PROF
29 /* The mcount code relies on a the return address being on the stack
30 to locate our caller and so it can restore it; so store one just
31 for its benefit. */
32 #ifdef PIC
33 #define CALL_MCOUNT \
34 .pushsection; \
35 .section ".data"; \
36 .align ALIGNARG(2); \
37 0:.long 0; \
38 .previous; \
39 mflr r0; \
40 stw r0,4(r1); \
41 bl _GLOBAL_OFFSET_TABLE_@local-4; \
42 mflr r11; \
43 lwz r0,0b@got(r11); \
44 bl JUMPTARGET(_mcount);
45 #else /* PIC */
46 #define CALL_MCOUNT \
47 .section ".data"; \
48 .align ALIGNARG(2); \
49 0:.long 0; \
50 .previous; \
51 mflr r0; \
52 lis r11,0b@ha; \
53 stw r0,4(r1); \
54 addi r0,r11,0b@l; \
55 bl JUMPTARGET(_mcount);
56 #endif /* PIC */
57 #else /* PROF */
58 #define CALL_MCOUNT /* Do nothing. */
59 #endif /* PROF */
61 #define ENTRY(name) \
62 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
63 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
64 .align ALIGNARG(2); \
65 C_LABEL(name) \
66 CALL_MCOUNT
68 #define EALIGN_W_0 /* No words to insert. */
69 #define EALIGN_W_1 nop
70 #define EALIGN_W_2 nop;nop
71 #define EALIGN_W_3 nop;nop;nop
72 #define EALIGN_W_4 EALIGN_W_3;nop
73 #define EALIGN_W_5 EALIGN_W_4;nop
74 #define EALIGN_W_6 EALIGN_W_5;nop
75 #define EALIGN_W_7 EALIGN_W_6;nop
77 /* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes
78 past a 2^align boundary. */
79 #ifdef PROF
80 #define EALIGN(name, alignt, words) \
81 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
82 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
83 .align ALIGNARG(2); \
84 C_LABEL(name) \
85 CALL_MCOUNT \
86 b 0f; \
87 .align ALIGNARG(alignt); \
88 EALIGN_W_##words; \
90 #else /* PROF */
91 #define EALIGN(name, alignt, words) \
92 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
93 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
94 .align ALIGNARG(alignt); \
95 EALIGN_W_##words; \
96 C_LABEL(name)
97 #endif
99 #undef END
100 #define END(name) \
101 ASM_SIZE_DIRECTIVE(name)
103 #define DO_CALL(syscall) \
104 li 0,syscall; \
107 #ifdef PIC
108 #define JUMPTARGET(name) name##@plt
109 #else
110 #define JUMPTARGET(name) name
111 #endif
113 #define PSEUDO(name, syscall_name, args) \
114 .section ".text"; \
115 ENTRY (name) \
116 DO_CALL (SYS_ify (syscall_name));
118 #define PSEUDO_RET \
119 bnslr; \
120 b JUMPTARGET(__syscall_error)
121 #define ret PSEUDO_RET
123 #undef PSEUDO_END
124 #define PSEUDO_END(name) \
125 END (name)
127 /* Local labels stripped out by the linker. */
128 #undef L
129 #define L(x) .L##x
131 /* Label in text section. */
132 #define C_TEXT(name) name
134 #endif /* __ELF__ */
136 #endif /* __ASSEMBLER__ */