entered into RCS
[kopensolaris-gnu/glibc.git] / sysdeps / mach / mips / sysdep.h
1 /* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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 #define MOVE(x,y)       move y , x
20
21 #if 0
22 #define LOSE asm volatile ("1: b 1b")
23 #endif
24
25 #define SNARF_ARGS(argc, argv, envp)                                          \
26   do                                                                          \
27     {                                                                         \
28       int *entry_sp;                                                          \
29       register char **p;                                                      \
30                                                                               \
31       asm ("addu %0,$30,4" : "=r" (entry_sp));                                \
32                                                                               \
33       argc = *entry_sp;                                                       \
34       argv = (char **) (entry_sp + 1);                                        \
35       p = argv;                                                               \
36       while (*p++ != NULL)                                                    \
37         ;                                                                     \
38       if (p >= (char **) argv[0])                                             \
39         --p;                                                                  \
40       envp = p;                                                       \
41     } while (0)
42
43 #define CALL_WITH_SP(fn, sp) \
44   ({ register int __fn = fn, __sp = (int) sp; \
45      asm volatile ("move $sp,%0; j %1" : : "r" (__sp), "r" (__fn));})
46
47 #define STACK_GROWTH_DOWN
48
49 #ifdef P40
50 #include <syscall.h>
51
52 #define SYSCALL(name, args)     \
53   .globl syscall_error; \
54   kernel_trap(name,SYS_##name,args);    \
55   beq $1,$0,1f; \
56   j syscall_error;      \
57 1:
58
59 #define SYSCALL__(name, args)   \
60   .globl syscall_error; \
61   kernel_trap(__##name,SYS_##name,args);        \
62   beq $1,$0,1f; \
63   j syscall_error;      \
64 1:
65
66 #define ret     j ra; nop
67 #endif
68
69 #include_next <sysdep.h>