]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/mach/sysdep.h
305bb347eec32dd87708547a4ef37e276477128a
[thirdparty/glibc.git] / sysdeps / mach / sysdep.h
1 /* Copyright (C) 1994, 1995, 1997, 2012 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 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.
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 Lesser General Public License for more details.
13
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. */
18
19 #ifdef __ASSEMBLER__
20
21 /* Get the Mach definitions of ENTRY and kernel_trap. */
22 #include <mach/machine/syscall_sw.h>
23
24 /* The Mach definitions assume underscores should be prepended to
25 symbol names. Redefine them to do so only when appropriate. */
26 #undef EXT
27 #undef LEXT
28 #define EXT(x) C_SYMBOL_NAME(x)
29 #define LEXT(x) C_SYMBOL_NAME(x##:)
30
31 /* For ELF we need to add the `.type' directive to make shared libraries
32 work right. */
33 #undef ENTRY
34 #define ENTRY(name) \
35 ASM_GLOBAL_DIRECTIVE name; \
36 .align ALIGN; \
37 .type name,@function; \
38 name:
39
40 #endif
41
42 /* This is invoked by things run when there is random lossage, before they
43 try to do anything else. Just to be safe, deallocate the reply port so
44 bogons arriving on it don't foul up future RPCs. */
45
46 #ifndef __ASSEMBLER__
47 #define FATAL_PREPARE_INCLUDE <mach/mig_support.h>
48 #define FATAL_PREPARE __mig_dealloc_reply_port (MACH_PORT_NULL)
49 #endif
50
51 /* sysdeps/mach/MACHINE/sysdep.h should define the following macros. */
52
53 /* Produce a text assembler label for the C global symbol NAME. */
54 #ifndef ENTRY
55 #define ENTRY(name) .error ENTRY not defined by sysdeps/mach/MACHINE/sysdep.h
56 /* This is not used on all machines. */
57 #endif
58
59 /* Set variables ARGC, ARGV, and ENVP for the arguments
60 left on the stack by the microkernel. */
61 #ifndef SNARF_ARGS
62 #define SNARF_ARGS(argc, argv, envp)
63 #error SNARF_ARGS not defined by sysdeps/mach/MACHINE/sysdep.h
64 #endif
65
66 /* Call the C function FN with no arguments,
67 on a stack starting at SP (as returned by *_cthread_init_routine).
68 You don't need to deal with FN returning; it shouldn't. */
69 #ifndef CALL_WITH_SP
70 #define CALL_WITH_SP(fn, sp)
71 #error CALL_WITH_SP not defined by sysdeps/mach/MACHINE/sysdep.h
72 #endif
73
74 /* LOSE can be defined as the `halt' instruction or something
75 similar which will cause the process to die in a characteristic
76 way suggesting a bug. */
77 #ifndef LOSE
78 #define LOSE ({ volatile int zero = 0; zero / zero; })
79 #endif
80
81 /* One of these should be defined to specify the stack direction. */
82 #if !defined (STACK_GROWTH_UP) && !defined (STACK_GROWTH_DOWN)
83 #error stack direction unspecified
84 #endif
85
86 /* Used by some assembly code. */
87 #define C_SYMBOL_NAME(name) name