2.9
[glibc/nacl-glibc.git] / sysdeps / mach / alpha / sysdep.h
blob84e21c8d5db802b98cfd018ca229116d86f4ca6d
1 /* Copyright (C) 1994,97,2002 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
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 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
19 #define MOVE(x,y) mov x, y
21 #define LOSE asm volatile ("call_pal 0") /* halt */
23 #define START_MACHDEP \
24 asm ("_start: mov $30, $16\n" /* Put initial SP in a0. */ \
25 " br $27, 1f\n" /* Load GP from PC. */ \
26 "1: ldgp $29, 0($27)\n" \
27 " jmp $26, _start0"); /* Jump to _start0; don't return. */
28 #define START_ARGS char **sparg
29 #define SNARF_ARGS(argc, argv, envp) \
30 (envp = &(argv = &sparg[1])[(argc = *(int *) sparg) + 1])
32 #define CALL_WITH_SP(fn, sp) \
33 ({ register long int __fn = (long int) fn, __sp = (long int) sp; \
34 asm volatile ("mov %0,$30; jmp $31, (%1); ldgp $29, 0(%1)" \
35 : : "r" (__sp), "r" (__fn)); })
37 #define STACK_GROWTH_DOWN
39 #define RETURN_TO(sp, pc, retval) \
40 asm volatile ("mov %0,$30; jmp $31, (%1); mov %2,$0" \
41 : : "r" (sp), "r" (pc), "r" ((long int) (retval)));
43 #define ALIGN 3
44 #include <sysdeps/mach/sysdep.h>
46 /* Alpha needs the .ent and .frame magic that the generic version lacks. */
47 #undef ENTRY
48 #define ENTRY(name) \
49 .globl name; \
50 .align 3; \
51 .ent name, 0; \
52 name##: \
53 .frame sp, 0, ra
55 #include <mach/alpha/asm.h>
56 #undef at
57 #define at 28
58 #define AT $28
59 #define fp s6