Fix grammar in lossage message
[sbcl.git] / src / runtime / validate.h
blobb56b4c4a3da6d7e4aec7ff03c44dc1ff823ab328
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 #if !defined(_INCLUDE_VALIDATE_H_)
13 #define _INCLUDE_VALIDATE_H_
15 #ifndef LISP_FEATURE_GENCGC
16 /* FIXME: genesis/constants.h also defines this with a constant value */
17 #define DYNAMIC_SPACE_START current_dynamic_space
18 #endif
20 #define BINDING_STACK_SIZE (1024*1024) /* chosen at random */
21 #define ALIEN_STACK_SIZE (1024*1024) /* chosen at random */
23 /* eventually choosable per-thread: */
24 #define DEFAULT_CONTROL_STACK_SIZE (2*1024*1024)
26 /* constants derived from the fundamental constants in passed by GENESIS */
27 #ifdef LISP_FEATURE_GENCGC
28 #define DEFAULT_DYNAMIC_SPACE_SIZE (DYNAMIC_SPACE_END - DYNAMIC_SPACE_START)
29 #else
30 #define DEFAULT_DYNAMIC_SPACE_SIZE (DYNAMIC_0_SPACE_END - DYNAMIC_0_SPACE_START)
31 #endif
32 #define READ_ONLY_SPACE_SIZE (READ_ONLY_SPACE_END - READ_ONLY_SPACE_START)
33 #define STATIC_SPACE_SIZE (STATIC_SPACE_END - STATIC_SPACE_START)
34 #define IMMOBILE_SPACE_SIZE (IMMOBILE_SPACE_END - IMMOBILE_SPACE_START)
35 #ifdef LISP_FEATURE_LINKAGE_TABLE
36 #define LINKAGE_TABLE_SPACE_SIZE \
37 (LINKAGE_TABLE_SPACE_END - LINKAGE_TABLE_SPACE_START)
38 #endif
40 #if !defined(LANGUAGE_ASSEMBLY)
41 #include "thread.h"
43 #ifdef LISP_FEATURE_STACK_GROWS_DOWNWARD_NOT_UPWARD
45 #define CONTROL_STACK_HARD_GUARD_PAGE(th) \
46 ((os_vm_address_t)(th->control_stack_start))
47 #define CONTROL_STACK_GUARD_PAGE(th) \
48 (CONTROL_STACK_HARD_GUARD_PAGE(th) + os_vm_page_size)
49 #define CONTROL_STACK_RETURN_GUARD_PAGE(th) \
50 (CONTROL_STACK_GUARD_PAGE(th) + os_vm_page_size)
51 #else
53 #define CONTROL_STACK_HARD_GUARD_PAGE(th) \
54 (((os_vm_address_t)(th->control_stack_end)) - os_vm_page_size)
55 #define CONTROL_STACK_GUARD_PAGE(th) \
56 (CONTROL_STACK_HARD_GUARD_PAGE(th) - os_vm_page_size)
57 #define CONTROL_STACK_RETURN_GUARD_PAGE(th) \
58 (CONTROL_STACK_GUARD_PAGE(th) - os_vm_page_size)
60 #endif
62 #ifdef ALIEN_STACK_GROWS_DOWNWARD
64 #define ALIEN_STACK_HARD_GUARD_PAGE(th) \
65 ((os_vm_address_t)(th->alien_stack_start))
66 #define ALIEN_STACK_GUARD_PAGE(th) \
67 (ALIEN_STACK_HARD_GUARD_PAGE(th) + os_vm_page_size)
68 #define ALIEN_STACK_RETURN_GUARD_PAGE(th) \
69 (ALIEN_STACK_GUARD_PAGE(th) + os_vm_page_size)
71 #elif defined(ALIEN_STACK_GROWS_UPWARD)
73 #define ALIEN_STACK_HARD_GUARD_PAGE(th) \
74 (((os_vm_address_t)th->alien_stack_start) + ALIEN_STACK_SIZE - \
75 os_vm_page_size)
76 #define ALIEN_STACK_GUARD_PAGE(th) \
77 (ALIEN_STACK_HARD_GUARD_PAGE(th) - os_vm_page_size)
78 #define ALIEN_STACK_RETURN_GUARD_PAGE(th) \
79 (ALIEN_STACK_GUARD_PAGE(th) - os_vm_page_size)
81 #else
82 #error ALIEN_STACK_GROWS_DOWNWARD or ALIEN_STACK_GROWS_UPWARD has to be defined
83 #endif
85 #define BINDING_STACK_HARD_GUARD_PAGE(th) \
86 (((os_vm_address_t)th->binding_stack_start) + BINDING_STACK_SIZE - \
87 os_vm_page_size)
88 #define BINDING_STACK_GUARD_PAGE(th) \
89 (BINDING_STACK_HARD_GUARD_PAGE(th) - os_vm_page_size)
90 #define BINDING_STACK_RETURN_GUARD_PAGE(th) \
91 (BINDING_STACK_GUARD_PAGE(th) - os_vm_page_size)
93 extern void validate(void);
95 extern void
96 protect_control_stack_hard_guard_page(int protect_p, struct thread *thread);
97 extern void
98 protect_control_stack_guard_page(int protect_p, struct thread *thread);
99 extern void
100 protect_control_stack_return_guard_page(int protect_p, struct thread *thread);
101 extern void
102 protect_binding_stack_hard_guard_page(int protect_p, struct thread *thread);
103 extern void
104 protect_binding_stack_guard_page(int protect_p, struct thread *thread);
105 extern void
106 protect_binding_stack_return_guard_page(int protect_p, struct thread *thread);
107 extern void
108 protect_alien_stack_hard_guard_page(int protect_p, struct thread *thread);
109 extern void
110 protect_alien_stack_guard_page(int protect_p, struct thread *thread);
111 extern void
112 protect_alien_stack_return_guard_page(int protect_p, struct thread *thread);
113 extern os_vm_address_t undefined_alien_address;
114 #endif
116 /* note for anyone trying to port an architecture's support files
117 * from CMU CL to SBCL:
119 * CMU CL had architecture-dependent header files included here to
120 * define memory map data:
121 * #ifdef LISP_FEATURE_X86
122 * #include "x86-validate.h"
123 * #endif
124 * and so forth. In SBCL, the memory map data are defined at the Lisp
125 * level (compiler/target/parms.lisp) and stuffed into the sbcl.h file
126 * created by GENESIS, so there's no longer a need for an
127 * architecture-dependent header file of memory map data.
130 #endif