8a52f201e12960cc36f6bde81c111a8d663d24e4
[kopensolaris-gnu/glibc.git] / sysdeps / unix / alpha / sysdep.h
1 /* Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc.
2    Contributed by Brendan Kehoe (brendan@zen.org).
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB.  If
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA.  */
18
19 #include <sysdeps/unix/sysdep.h>
20
21 #ifdef ASSEMBLER
22
23 #ifdef __linux__
24 # include <alpha/regdef.h>
25 #else
26 # include <regdef.h>
27 #endif
28
29 #ifdef __STDC__
30 #define LEAF(name, framesize)                   \
31   .globl name;                                  \
32   .align 3;                                     \
33   .ent name, 0;                                 \
34   name##:                                       \
35   .frame sp, framesize, ra
36 #else
37 #define LEAF(name, framesize)                   \
38   .globl name;                                  \
39   .align 3;                                     \
40   .ent name, 0;                                 \
41   name/**/:                                     \
42   .frame sp, framesize, ra
43 #endif
44
45 #ifdef __STDC__
46 #define ENTRY(name)                             \
47   .globl name;                                  \
48   .align 3;                                     \
49   .ent name, 0;                                 \
50   name##:                                       \
51   .frame sp, 0, ra
52 #else
53 #define ENTRY(name)                             \
54   .globl name;                                  \
55   .align 3;                                     \
56   .ent name, 0;                                 \
57   name/**/:                                     \
58   .frame sp, 0, ra
59 #endif
60
61 /* Note that while it's better structurally, going back to set errno
62    can make things confusing if you're debugging---it looks like it's jumping
63    backwards into the previous fn.  */
64 #ifdef __STDC__
65 #define PSEUDO(name, syscall_name, args)        \
66     .globl name;                                \
67     .align 3;                                   \
68     .ent name,0;                                \
69                                                 \
70 1:  br          gp, 2f;                         \
71 2:  ldgp        gp, 0(gp);                      \
72     jmp         zero, syscall_error;            \
73                                                 \
74 name##:                                         \
75     ldi         v0, SYS_ify(syscall_name);      \
76     .set noat;                                  \
77     call_pal    PAL_callsys;                    \
78     .set at;                                    \
79     bne         a3, 1b;                         \
80 3:
81 #else
82 #define PSEUDO(name, syscall_name, args)        \
83     .globl name;                                \
84     .align 3;                                   \
85     .ent name,0;                                \
86                                                 \
87 1:  br          gp, 2f;                         \
88 2:  ldgp        gp, 0(gp);                      \
89     jmp         zero, syscall_error;            \
90                                                 \
91 name/**/:                                       \
92     ldi         v0, SYS_ify(syscall_name);      \
93     .set noat;                                  \
94     call_pal    PAL_callsys;                    \
95     .set at;                                    \
96     bne         a3, 1b;                         \
97 3:
98 #endif
99
100 #define ret     ret     zero,(ra),1
101 #define r0      v0
102 #define r1      a4
103
104 #define MOVE(x,y)       mov x,y
105
106 #endif