1.0.41.20: runtime: Straighten out access to binding stack pointers.
[sbcl.git] / src / runtime / globals.c
1 /*
2  * variables everybody needs to look at or frob on
3  */
4
5 /*
6  * This software is part of the SBCL system. See the README file for
7  * more information.
8  *
9  * This software is derived from the CMU CL system, which was
10  * written at Carnegie Mellon University and released into the
11  * public domain. The software is in the public domain and is
12  * provided with absolutely no warranty. See the COPYING and CREDITS
13  * files for more information.
14  */
15
16 #include <stdio.h>
17 #include <sys/types.h>
18 #include <unistd.h>
19
20 #include "sbcl.h"
21 #include "runtime.h"
22 #include "globals.h"
23 #include "validate.h"
24
25 #ifndef LISP_FEATURE_SB_THREAD
26 int foreign_function_call_active;
27 #endif
28
29 lispobj *current_control_stack_pointer;
30 lispobj *current_control_frame_pointer;
31 #if !defined(BINDING_STACK_POINTER) && !defined(LISP_FEATURE_SB_THREAD)
32 lispobj *current_binding_stack_pointer;
33 #endif
34
35 /* ALLOCATION_POINTER is x86 or RT.  Anyone want to do an RT port?   */
36
37 # if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64)
38 /* The Object Formerly Known As current_dynamic_space_free_pointer */
39 lispobj *dynamic_space_free_pointer;
40 #endif
41
42 #ifndef LISP_FEATURE_GENCGC /* GENCGC has its own way to record trigger */
43 lispobj *current_auto_gc_trigger;
44 #endif
45
46 /* For copying GCs, this points to the start of the dynamic space
47  * currently in use (that will become the from_space when the next GC
48  * is done).  For the GENCGC, it always points to DYNAMIC_SPACE_START. */
49 lispobj *current_dynamic_space;
50
51 #if defined(LISP_FEATURE_SB_THREAD) && !defined(LISP_FEATURE_GCC_TLS)
52 pthread_key_t specials=0;
53 #endif
54
55 void globals_init(void)
56 {
57     /* Space, stack, and free pointer vars are initialized by
58      * validate() and coreparse(). */
59     current_control_frame_pointer = (lispobj *)0;
60
61 #ifndef LISP_FEATURE_GENCGC
62     /* no GC trigger yet */
63     current_auto_gc_trigger = NULL;
64 #endif
65
66 #ifndef LISP_FEATURE_SB_THREAD
67 #if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
68     /* KLUDGE: x86oids always think they're in lisp code.  See the
69      * comment at the bottom of
70      * interrupt.c/fake_foreign_function_call() and the lack of any
71      * access to foreign_function_call_active or the corresponding
72      * thread slot in x86{,-64}-assem.S. */
73     foreign_function_call_active = 0;
74 #else
75     foreign_function_call_active = 1;
76 #endif
77 #endif
78
79 #if defined(LISP_FEATURE_SB_THREAD) && !defined(LISP_FEATURE_GCC_TLS)
80     pthread_key_create(&specials,0);
81 #endif
82 }