2002-10-18 Roland McGrath <roland@redhat.com>
[kopensolaris-gnu/glibc.git] / sysdeps / unix / alpha / sysdep.h
1 /* Copyright (C) 1992, 1995, 1996, 2000 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Brendan Kehoe (brendan@zen.org).
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
7    License as published by the Free Software Foundation; either
8    version 2.1 of the 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, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
19
20 #include <sysdeps/unix/sysdep.h>
21
22 #ifdef __ASSEMBLER__
23
24 #ifdef __linux__
25 # include <alpha/regdef.h>
26 #else
27 # include <regdef.h>
28 #endif
29
30 #ifdef __STDC__
31 #define __LABEL(x)      x##:
32 #else
33 #define __LABEL(x)      x/**/:
34 #endif
35
36 #define LEAF(name, framesize)                   \
37   .globl name;                                  \
38   .align 3;                                     \
39   .ent name, 0;                                 \
40   __LABEL(name)                                 \
41   .frame sp, framesize, ra
42
43 #define ENTRY(name)                             \
44   .globl name;                                  \
45   .align 3;                                     \
46   .ent name, 0;                                 \
47   __LABEL(name)                                 \
48   .frame sp, 0, ra
49
50 /* Mark the end of function SYM.  */
51 #undef END
52 #define END(sym)        .end sym
53
54 /* Note that PSEUDO/PSEUDO_END use label number 1996---do not use a
55    label of that number between those two macros!  */
56
57 #ifdef PROF
58 #define PSEUDO(name, syscall_name, args)        \
59     .globl name;                                \
60     .align 3;                                   \
61     .ent name,0;                                \
62 __LABEL(name)                                   \
63     .frame sp, 0, ra;                           \
64     ldgp gp,0(pv);                              \
65     .set noat;                                  \
66     lda AT,_mcount;                             \
67     jsr AT,(AT),_mcount;                        \
68     .set at;                                    \
69     .prologue 1;                                \
70     ldiq        v0, SYS_ify(syscall_name);      \
71     .set noat;                                  \
72     call_pal    PAL_callsys;                    \
73     .set at;                                    \
74     bne         a3, 1996f;                      \
75 3:
76 #else
77 #define PSEUDO(name, syscall_name, args)        \
78     .globl name;                                \
79     .align 3;                                   \
80     .ent name,0;                                \
81 __LABEL(name)                                   \
82     .frame sp, 0, ra                            \
83     .prologue 0;                                \
84     ldiq        v0, SYS_ify(syscall_name);      \
85     .set noat;                                  \
86     call_pal    PAL_callsys;                    \
87     .set at;                                    \
88     bne         a3, 1996f;                      \
89 3:
90 #endif
91
92 #undef PSEUDO_END
93 #ifdef PROF
94 #define PSEUDO_END(sym)                         \
95 1996:                                           \
96     jmp         zero, __syscall_error;          \
97     END(sym)
98 #else
99 #define PSEUDO_END(sym)                         \
100 1996:                                           \
101     br          gp, 2f;                         \
102 2:  ldgp        gp, 0(gp);                      \
103     jmp         zero, __syscall_error;          \
104     END(sym)
105 #endif
106
107 #define r0      v0
108 #define r1      a4
109
110 #define MOVE(x,y)       mov x,y
111
112 #endif /* ASSEMBLER */