2 * This software is part of the SBCL system. See the README file for
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>
19 # include "runtime-options.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)
30 extern int foreign_function_call_active;
31 #define foreign_function_call_active_p(thread) \
32 foreign_function_call_active
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
43 #define ENVIRON environ
45 extern char **ENVIRON;
47 #if defined(LISP_FEATURE_SB_THREAD) && !defined(LISP_FEATURE_GCC_TLS)
48 extern pthread_key_t specials;
51 #if !defined(LISP_FEATURE_SB_THREAD)
52 extern lispobj *current_control_stack_pointer;
54 #if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64) || !defined(LISP_FEATURE_SB_THREAD)
55 extern lispobj *current_control_frame_pointer;
57 #if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64) && !defined(LISP_FEATURE_SB_THREAD)
58 extern lispobj *current_binding_stack_pointer;
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
69 extern lispobj *dynamic_space_free_pointer;
72 # ifndef LISP_FEATURE_GENCGC
73 extern lispobj *current_auto_gc_trigger;
76 extern lispobj *current_dynamic_space;
78 extern void globals_init(void);
80 #ifdef LISP_FEATURE_SB_SAFEPOINT
81 # define GC_SAFEPOINT_PAGE_ADDR ((lispobj) gc_safepoint_page)
82 extern char gc_safepoint_page[];
85 #else /* LANGUAGE_ASSEMBLY */
87 # ifdef LISP_FEATURE_MIPS
89 # define EXTERN(name,bytes) .globl name
91 # define EXTERN(name,bytes) .extern name bytes
95 # ifdef LISP_FEATURE_SPARC
97 # define EXTERN(name,bytes) .global name
99 # define EXTERN(name,bytes) .global _ ## name
103 # ifdef LISP_FEATURE_ALPHA
105 # define EXTERN(name,bytes) .globl name
109 # ifdef LISP_FEATURE_PPC
110 # ifdef LISP_FEATURE_DARWIN
111 # define EXTERN(name,bytes) .globl _ ## name
113 # define EXTERN(name,bytes) .globl name
117 # if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
118 # define EXTERN(name,bytes) .global name
121 # if defined(LISP_FEATURE_ALPHA) || defined(LISP_FEATURE_X86_64)
122 # define POINTERSIZE 8
124 # define POINTERSIZE 4
127 #ifndef LISP_FEATURE_SB_THREAD
128 EXTERN(foreign_function_call_active, 4)
131 #if !defined(LISP_FEATURE_SB_THREAD) && !defined(LISP_FEATURE_C_STACK_IS_CONTROL_STACK)
132 EXTERN(current_control_stack_pointer, POINTERSIZE)
134 EXTERN(current_control_frame_pointer, POINTERSIZE)
135 # if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64)
136 EXTERN(current_binding_stack_pointer, POINTERSIZE)
138 # ifndef LISP_FEATURE_GENCGC
139 EXTERN(dynamic_space_free_pointer, POINTERSIZE)
142 #endif /* LANGUAGE_ASSEMBLY */
144 #endif /* _INCLUDED_GLOBALS_H_ */