6152e258d2bab91ba9c2be2e535e0b91d4ce7496
[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 "runtime.h"
21 #include "sbcl.h"
22 #include "globals.h"
23 #include "validate.h"
24
25 int foreign_function_call_active;
26
27 lispobj *current_control_stack_pointer;
28 lispobj *current_control_frame_pointer;
29 #ifndef BINDING_STACK_POINTER
30 lispobj *current_binding_stack_pointer;
31 #endif
32
33 /* ALLOCATION_POINTER is x86 or RT.  Anyone want to do an RT port?   */
34
35 #ifndef ALLOCATION_POINTER
36 /* The Object Formerly Known As current_dynamic_space_free_pointer */
37 lispobj *dynamic_space_free_pointer;
38 #endif
39
40 #ifndef LISP_FEATURE_GENCGC /* GENCGC has its own way to record trigger */
41 lispobj *current_auto_gc_trigger;
42 #endif
43
44 /* For copying GCs, this points to the start of the dynamic space
45  * currently in use (that will become the from_space when the next GC
46  * is done).  For the GENCGC, it always points to DYNAMIC_SPACE_START. */
47 lispobj *current_dynamic_space;
48
49 void globals_init(void)
50 {
51     /* Space, stack, and free pointer vars are initialized by
52      * validate() and coreparse(). */
53     current_control_frame_pointer = (lispobj *)0;
54
55 #ifndef LISP_FEATURE_GENCGC 
56     /* no GC trigger yet */
57     current_auto_gc_trigger = NULL;
58 #endif
59
60     /* Set foreign function call active. */
61     foreign_function_call_active = 1;
62
63     /* Initialize the current Lisp state. */
64 #ifdef LISP_FEATURE_STACK_GROWS_DOWNWARD_NOT_UPWARD
65     current_control_stack_pointer = (lispobj *)CONTROL_STACK_END;
66 #else
67     current_control_stack_pointer = (lispobj *)CONTROL_STACK_START;
68 #endif
69
70     current_control_frame_pointer = (lispobj *)0;
71 #ifndef BINDING_STACK_POINTER
72     current_binding_stack_pointer = native_pointer(BINDING_STACK_START);
73 #endif
74 }