Take pointer, not word count, as upper limit in verify_space()
[sbcl.git] / src / runtime / globals.h
blobd87306ab9a88ff7a5d004b6f4e0955247a7658a0
1 /*
2 * This software is part of the SBCL system. See the README file for
3 * more information.
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.
12 #ifndef _INCLUDED_GLOBALS_H_
13 #define _INCLUDED_GLOBALS_H_
15 #ifndef LANGUAGE_ASSEMBLY
16 # include <sys/types.h>
17 # include <unistd.h>
18 # include "runtime.h"
19 # include "runtime-options.h"
20 #endif
22 #include "sbcl.h"
24 #ifndef LANGUAGE_ASSEMBLY
26 #ifdef LISP_FEATURE_SB_THREAD
27 #define foreign_function_call_active_p(thread) \
28 (thread->foreign_function_call_active)
29 #else
30 extern int foreign_function_call_active;
31 #define foreign_function_call_active_p(thread) \
32 foreign_function_call_active
33 #endif
35 extern os_vm_size_t dynamic_space_size;
36 extern os_vm_size_t thread_control_stack_size;
38 extern struct runtime_options *runtime_options;
40 #ifdef LISP_FEATURE_WIN32
41 #define ENVIRON _environ
42 #else
43 #define ENVIRON environ
44 #endif
45 extern char **ENVIRON;
47 #if defined(LISP_FEATURE_SB_THREAD) && !defined(LISP_FEATURE_GCC_TLS)
48 extern pthread_key_t specials;
49 #endif
51 #if !defined(LISP_FEATURE_SB_THREAD)
52 extern lispobj *current_control_stack_pointer;
53 #endif
54 #if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64) || !defined(LISP_FEATURE_SB_THREAD)
55 extern lispobj *current_control_frame_pointer;
56 #endif
57 #if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64) && !defined(LISP_FEATURE_SB_THREAD)
58 extern lispobj *current_binding_stack_pointer;
59 #endif
61 #if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64)
62 /* This is unused on X86 and X86_64, but is used as the global
63 * allocation pointer by the cheney GC, and, in some instances, as
64 * the global allocation pointer on PPC/GENCGC. This should probably
65 * be cleaned up such that it only needs to exist on cheney. At the
66 * moment, it is also used by the GENCGC, to hold the pseudo_atomic
67 * bits, and is tightly coupled to reg_ALLOC by the assembly
68 * routines. */
69 extern lispobj *dynamic_space_free_pointer;
70 #endif
72 # ifndef LISP_FEATURE_GENCGC
73 extern lispobj *current_auto_gc_trigger;
74 # endif
76 extern lispobj *current_dynamic_space;
78 extern void globals_init(void);
80 #else /* LANGUAGE_ASSEMBLY */
82 # ifdef LISP_FEATURE_MIPS
83 # ifdef __linux__
84 # define EXTERN(name,bytes) .globl name
85 # else
86 # define EXTERN(name,bytes) .extern name bytes
87 # endif
88 # endif
89 /**/
90 # ifdef LISP_FEATURE_SPARC
91 # ifdef SVR4
92 # define EXTERN(name,bytes) .global name
93 # else
94 # define EXTERN(name,bytes) .global _ ## name
95 # endif
96 # endif
97 /**/
98 # ifdef LISP_FEATURE_ALPHA
99 # ifdef __linux__
100 # define EXTERN(name,bytes) .globl name
101 # endif
102 # endif
103 /**/
104 # ifdef LISP_FEATURE_PPC
105 # ifdef LISP_FEATURE_DARWIN
106 # define EXTERN(name,bytes) .globl _ ## name
107 # else
108 # define EXTERN(name,bytes) .globl name
109 # endif
110 # endif
111 /**/
112 # if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
113 # define EXTERN(name,bytes) .global name
114 # endif
115 /**/
116 # if defined(LISP_FEATURE_ARM) || defined(LISP_FEATURE_ARM64)
117 # define EXTERN(name,bytes) .global name
118 # endif
120 # if defined(LISP_FEATURE_ALPHA) || defined(LISP_FEATURE_X86_64)
121 # define POINTERSIZE 8
122 # else
123 # define POINTERSIZE 4
124 # endif
126 #ifndef LISP_FEATURE_SB_THREAD
127 EXTERN(foreign_function_call_active, 4)
128 #endif
130 #if !defined(LISP_FEATURE_SB_THREAD) && !defined(LISP_FEATURE_C_STACK_IS_CONTROL_STACK)
131 EXTERN(current_control_stack_pointer, POINTERSIZE)
132 #endif
133 EXTERN(current_control_frame_pointer, POINTERSIZE)
134 # if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64)
135 EXTERN(current_binding_stack_pointer, POINTERSIZE)
136 # endif
137 # ifndef LISP_FEATURE_GENCGC
138 EXTERN(dynamic_space_free_pointer, POINTERSIZE)
139 # endif
141 #endif /* LANGUAGE_ASSEMBLY */
143 #endif /* _INCLUDED_GLOBALS_H_ */