de4b61f0a33afde6d4cf70e7fd5cb718379bf6ef
[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
37 #ifdef LISP_FEATURE_WIN32
38 #define ENVIRON _environ
39 #else
40 #define ENVIRON environ
41 #endif
42 extern char **ENVIRON;
43
44 #if defined(LISP_FEATURE_SB_THREAD)
45 extern pthread_key_t specials;
46 #endif
47
48 extern lispobj *current_control_stack_pointer;
49 extern lispobj *current_control_frame_pointer;
50 # if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64)
51 extern lispobj *current_binding_stack_pointer;
52 # endif
53
54 #if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64)
55 /* This is unused on X86 and X86_64, but is used as the global
56  *  allocation pointer by the cheney GC, and, in some instances, as
57  *  the global allocation pointer on PPC/GENCGC. This should probably
58  *  be cleaned up such that it only needs to exist on cheney. At the
59  *  moment, it is also used by the GENCGC, to hold the pseudo_atomic
60  *  bits, and is tightly coupled to reg_ALLOC by the assembly
61  *  routines. */
62 extern lispobj *dynamic_space_free_pointer;
63 #endif
64
65 # ifndef LISP_FEATURE_GENCGC
66 extern lispobj *current_auto_gc_trigger;
67 # endif
68
69 extern lispobj *current_dynamic_space;
70
71 extern void globals_init(void);
72
73 #else /* LANGUAGE_ASSEMBLY */
74
75 # ifdef LISP_FEATURE_MIPS
76 #  ifdef __linux__
77 #   define EXTERN(name,bytes) .globl name
78 #  else
79 #   define EXTERN(name,bytes) .extern name bytes
80 #  endif
81 # endif
82 /**/
83 # ifdef LISP_FEATURE_SPARC
84 #  ifdef SVR4
85 #   define EXTERN(name,bytes) .global name
86 #  else
87 #   define EXTERN(name,bytes) .global _ ## name
88 #  endif
89 # endif
90 /**/
91 # ifdef LISP_FEATURE_ALPHA
92 #  ifdef __linux__
93 #   define EXTERN(name,bytes) .globl name
94 #  endif
95 # endif
96 /**/
97 # ifdef LISP_FEATURE_PPC
98 #  ifdef LISP_FEATURE_DARWIN
99 #   define EXTERN(name,bytes) .globl _/**/name
100 #  else
101 #   define EXTERN(name,bytes) .globl name
102 #  endif
103 # endif
104 /**/
105 # if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
106 #  define EXTERN(name,bytes) .global name
107 # endif
108
109 # if defined(LISP_FEATURE_ALPHA) || defined(LISP_FEATURE_X86_64)
110 #  define POINTERSIZE 8
111 # else
112 #  define POINTERSIZE 4
113 # endif
114
115 #ifdef FOREIGN_FUNCTION_CALL_FLAG
116 EXTERN(foreign_function_call_active, 4)
117 #endif
118
119 EXTERN(current_control_stack_pointer, POINTERSIZE)
120 EXTERN(current_control_frame_pointer, POINTERSIZE)
121 # if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64)
122 EXTERN(current_binding_stack_pointer, POINTERSIZE)
123 # endif
124 # ifndef LISP_FEATURE_GENCGC
125 EXTERN(dynamic_space_free_pointer, POINTERSIZE)
126 # endif
127
128 #endif /* LANGUAGE_ASSEMBLY */
129
130 #endif /* _INCLUDED_GLOBALS_H_ */