1.0.21.24: saving runtime options in executables
[sbcl.git] / src / runtime / globals.h
1 /*
2  * This software is part of the SBCL system. See the README file for
3  * more information.
4  *
5  * This software is derived from the CMU CL system, which was
6  * written at Carnegie Mellon University and released into the
7  * public domain. The software is in the public domain and is
8  * provided with absolutely no warranty. See the COPYING and CREDITS
9  * files for more information.
10  */
11
12 #ifndef _INCLUDED_GLOBALS_H_
13 #define _INCLUDED_GLOBALS_H_
14
15 #ifndef LANGUAGE_ASSEMBLY
16 # include <sys/types.h>
17 # include <unistd.h>
18 # include "runtime.h"
19 #endif
20
21 #include "sbcl.h"
22
23 /* Currently threads live only on x86oid platforms, but this thing
24  * cannot ever work with threads, so... */
25 #if !defined(LISP_FEATURE_SB_THREAD) && !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64)
26 #define FOREIGN_FUNCTION_CALL_FLAG
27 #endif
28
29 #ifndef LANGUAGE_ASSEMBLY
30
31 #ifdef FOREIGN_FUNCTION_CALL_FLAG
32 extern int foreign_function_call_active;
33 #endif
34
35 extern size_t dynamic_space_size;
36 extern size_t thread_control_stack_size;
37
38 extern struct runtime_options *runtime_options;
39
40 #ifdef LISP_FEATURE_WIN32
41 #define ENVIRON _environ
42 #else
43 #define ENVIRON environ
44 #endif
45 extern char **ENVIRON;
46
47 #if defined(LISP_FEATURE_SB_THREAD) && !defined(LISP_FEATURE_GCC_TLS)
48 extern pthread_key_t specials;
49 #endif
50
51 extern lispobj *current_control_stack_pointer;
52 extern lispobj *current_control_frame_pointer;
53 # if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64)
54 extern lispobj *current_binding_stack_pointer;
55 # endif
56
57 #if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64)
58 /* This is unused on X86 and X86_64, but is used as the global
59  *  allocation pointer by the cheney GC, and, in some instances, as
60  *  the global allocation pointer on PPC/GENCGC. This should probably
61  *  be cleaned up such that it only needs to exist on cheney. At the
62  *  moment, it is also used by the GENCGC, to hold the pseudo_atomic
63  *  bits, and is tightly coupled to reg_ALLOC by the assembly
64  *  routines. */
65 extern lispobj *dynamic_space_free_pointer;
66 #endif
67
68 # ifndef LISP_FEATURE_GENCGC
69 extern lispobj *current_auto_gc_trigger;
70 # endif
71
72 extern lispobj *current_dynamic_space;
73
74 extern void globals_init(void);
75
76 #else /* LANGUAGE_ASSEMBLY */
77
78 # ifdef LISP_FEATURE_MIPS
79 #  ifdef __linux__
80 #   define EXTERN(name,bytes) .globl name
81 #  else
82 #   define EXTERN(name,bytes) .extern name bytes
83 #  endif
84 # endif
85 /**/
86 # ifdef LISP_FEATURE_SPARC
87 #  ifdef SVR4
88 #   define EXTERN(name,bytes) .global name
89 #  else
90 #   define EXTERN(name,bytes) .global _ ## name
91 #  endif
92 # endif
93 /**/
94 # ifdef LISP_FEATURE_ALPHA
95 #  ifdef __linux__
96 #   define EXTERN(name,bytes) .globl name
97 #  endif
98 # endif
99 /**/
100 # ifdef LISP_FEATURE_PPC
101 #  ifdef LISP_FEATURE_DARWIN
102 #   define EXTERN(name,bytes) .globl _/**/name
103 #  else
104 #   define EXTERN(name,bytes) .globl name
105 #  endif
106 # endif
107 /**/
108 # if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
109 #  define EXTERN(name,bytes) .global name
110 # endif
111
112 # if defined(LISP_FEATURE_ALPHA) || defined(LISP_FEATURE_X86_64)
113 #  define POINTERSIZE 8
114 # else
115 #  define POINTERSIZE 4
116 # endif
117
118 #ifdef FOREIGN_FUNCTION_CALL_FLAG
119 EXTERN(foreign_function_call_active, 4)
120 #endif
121
122 EXTERN(current_control_stack_pointer, POINTERSIZE)
123 EXTERN(current_control_frame_pointer, POINTERSIZE)
124 # if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64)
125 EXTERN(current_binding_stack_pointer, POINTERSIZE)
126 # endif
127 # ifndef LISP_FEATURE_GENCGC
128 EXTERN(dynamic_space_free_pointer, POINTERSIZE)
129 # endif
130
131 #endif /* LANGUAGE_ASSEMBLY */
132
133 #endif /* _INCLUDED_GLOBALS_H_ */