3 * This code was written as part of the CMU Common Lisp project at
4 * Carnegie Mellon University, and has been placed in the public domain.
8 #ifndef _X86_VALIDATE_H_
9 #define _X86_VALIDATE_H_
12 * Also look in compiler/x86/parms.lisp for some of the parameters.
17 * 0x00000000->0x0E000000 224M C program and memory allocation.
18 * 0x0E000000->0x10000000 32M Foreign segment.
19 * 0x10000000->0x20000000 256M Read-Only Space.
20 * 0x20000000->0x28000000 128M Reserved for shared libraries.
21 * 0x28000000->0x38000000 256M Static Space.
22 * 0x38000000->0x40000000 128M Binding stack growing up.
23 * 0x40000000->0x48000000 128M Control stack growing down.
24 * 0x48000000->0xB0000000 1664M Dynamic Space.
25 * 0xB0000000->0xB1000000 Foreign Linkage Table
26 * 0xE0000000-> 256M C stack - Alien stack.
29 * 0x00000000->0x0E000000 224M C program and memory allocation.
30 * 0x0E000000->0x10000000 32M Foreign segment.
31 * 0x10000000->0x20000000 256M Read-Only Space.
32 * 0x20000000->0x28000000 128M Binding stack growing up.
33 * 0x28000000->0x38000000 256M Static Space.
34 * 0x38000000->0x40000000 128M Control stack growing down.
35 * 0x40000000->0x48000000 128M Reserved for shared libraries.
36 * 0x48000000->0xB0000000 1664M Dynamic Space.
37 * 0xB0000000->0xB1000000 16M Foreign Linkage Table
38 * 0xE0000000-> 256M C stack - Alien stack.
41 * 0x00000000->0x0E000000 224M C program and memory allocation.
42 * 0x0E000000->0x10000000 32M Foreign segment.
43 * 0x10000000->0x20000000 256M Read-Only Space.
44 * 0x28000000->0x38000000 256M Static Space.
45 * 0x38000000->0x40000000 128M Binding stack growing up.
46 * 0x40000000->0x48000000 128M Control stack growing down.
47 * 0x48800000->0xB0000000 1656M Dynamic Space.
48 * 0xB0000000->0xB1000000 16M Foreign Linkage Table
49 * 0xE0000000-> 256M C stack - Alien stack.
52 * 0x00000000->0x08000000 128M Unused.
53 * 0x08000000->0x10000000 128M C program and memory allocation.
54 * 0x10000000->0x20000000 256M Read-Only Space.
55 * 0x20000000->0x28000000 128M Binding stack growing up.
56 * 0x28000000->0x38000000 256M Static Space.
57 * 0x38000000->0x40000000 128M Control stack growing down.
58 * 0x40000000->0x48000000 128M Reserved for shared libraries.
59 * 0x58000000->0x58100000 16M Foreign Linkage Table
60 * 0x58100000->0xBE000000 1631M Dynamic Space.
61 * 0xBFFF0000->0xC0000000 Unknown Linux mapping
63 * (Note: 0x58000000 allows us to run on a Linux system on an AMD
64 * x86-64. Hence we have a gap of unused memory starting at
69 #define READ_ONLY_SPACE_START (0x10000000)
70 #define READ_ONLY_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
72 #define STATIC_SPACE_START (0x28f00000)
73 #define STATIC_SPACE_SIZE (0x0f0ff000) /* 241MB - 1 page */
75 #define BINDING_STACK_START (0x38000000)
76 #define BINDING_STACK_SIZE (0x07fff000) /* 128MB - 1 page */
78 #define CONTROL_STACK_START 0x40000000
79 #define CONTROL_STACK_SIZE 0x07fd8000 /* 128MB - SIGSTKSZ */
80 #define SIGNAL_STACK_START 0x47fd8000
81 #define SIGNAL_STACK_SIZE SIGSTKSZ
83 #define DYNAMIC_0_SPACE_START (0x48000000UL)
85 #define DYNAMIC_SPACE_SIZE (0x78000000UL) /* May be up to 1.7 GB */
87 #define DYNAMIC_SPACE_SIZE (0x04000000UL) /* 64MB */
89 #define DEFAULT_DYNAMIC_SPACE_SIZE (0x20000000UL) /* 512MB */
91 #define FOREIGN_LINKAGE_SPACE_START ((unsigned long) LinkageSpaceStart)
92 #define FOREIGN_LINKAGE_SPACE_SIZE (0x100000UL) /* 1MB */
94 #endif /* __FreeBSD__ */
98 #define READ_ONLY_SPACE_START (0x10000000)
99 #define READ_ONLY_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
101 #define STATIC_SPACE_START (0x28000000)
102 #define STATIC_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
104 #define BINDING_STACK_START (0x38000000)
105 #define BINDING_STACK_SIZE (0x07fff000) /* 128MB - 1 page */
107 #define CONTROL_STACK_START (0x40000000)
108 #define CONTROL_STACK_SIZE (0x07fd8000) /* 128MB - SIGSTKSZ */
110 #define SIGNAL_STACK_START (0x47fd8000)
111 #define SIGNAL_STACK_SIZE SIGSTKSZ
113 #define DYNAMIC_0_SPACE_START (0x48000000)
115 #define DYNAMIC_SPACE_SIZE (0x68000000) /* 1.625GB */
117 #define DYNAMIC_SPACE_SIZE (0x04000000) /* 64MB */
119 #define DEFAULT_DYNAMIC_SPACE_SIZE (0x20000000) /* 512MB */
122 #if defined(__NetBSD__) || defined(DARWIN)
123 #define READ_ONLY_SPACE_START (SpaceStart_TargetReadOnly)
124 #define READ_ONLY_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
126 #define STATIC_SPACE_START (SpaceStart_TargetStatic)
127 #define STATIC_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
129 #define BINDING_STACK_START (0x38000000)
130 #define BINDING_STACK_SIZE (0x07fff000) /* 128MB - 1 page */
132 #define CONTROL_STACK_START (0x40000000)
135 * According to /usr/include/sys/signal.h, MINSIGSTKSZ is 32K and
136 * SIGSTKSZ is 128K. We should account for that appropriately.
138 #define CONTROL_STACK_SIZE (0x07fdf000) /* 128MB - SIGSTKSZ - 1 page */
140 #define SIGNAL_STACK_START (0x47fe0000) /* One page past the end of the control stack */
141 #define SIGNAL_STACK_SIZE SIGSTKSZ
143 #define CONTROL_STACK_SIZE (0x07fd8000) /* 128MB - SIGSTKSZ */
145 #define SIGNAL_STACK_START (0x47fd8000)
146 #define SIGNAL_STACK_SIZE SIGSTKSZ
149 #define DYNAMIC_0_SPACE_START (SpaceStart_TargetDynamic)
153 * On Darwin, /usr/lib/dyld appears to always be loaded at address
154 * #x8fe2e000. Hence, the maximum dynamic space size is 1206050816
155 * bytes, or just over 1.150 GB. Set the limit to 1.150 GB.
157 #define DYNAMIC_SPACE_SIZE (0x47E00000U) /* 1.150GB */
159 #define DYNAMIC_SPACE_SIZE (0x67800000U) /* 1.656GB */
162 #define DYNAMIC_SPACE_SIZE (0x04000000U) /* 64MB */
164 #define DEFAULT_DYNAMIC_SPACE_SIZE (0x20000000U) /* 512MB */
166 #define FOREIGN_LINKAGE_SPACE_START (LinkageSpaceStart)
167 #define FOREIGN_LINKAGE_SPACE_SIZE (0x100000) /* 1MB */
169 #endif /* __NetBSD__ || DARWIN */
172 #define READ_ONLY_SPACE_START (SpaceStart_TargetReadOnly)
173 #define READ_ONLY_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
175 #define STATIC_SPACE_START (SpaceStart_TargetStatic)
176 #define STATIC_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
178 #define BINDING_STACK_START (0x20000000)
179 #define BINDING_STACK_SIZE (0x07fff000) /* 128MB - 1 page */
181 #define CONTROL_STACK_START 0x38000000
182 #define CONTROL_STACK_SIZE (0x07fff000 - 8192)
184 #define SIGNAL_STACK_START CONTROL_STACK_END
185 #define SIGNAL_STACK_SIZE SIGSTKSZ
187 #define DYNAMIC_0_SPACE_START (SpaceStart_TargetDynamic)
190 #define DYNAMIC_SPACE_SIZE (0x66000000) /* 1.632GB */
192 #define DYNAMIC_SPACE_SIZE (0x04000000) /* 64MB */
194 #define DEFAULT_DYNAMIC_SPACE_SIZE (0x20000000) /* 512MB */
196 #define FOREIGN_LINKAGE_SPACE_START (LinkageSpaceStart)
197 #define FOREIGN_LINKAGE_SPACE_SIZE (0x100000) /* 1MB */
203 * The memory map for Solaris/x86 looks roughly like
205 * 0x08045000->0x08050000 C stack?
206 * 0x08050000-> Code + C heap
207 * 0x10000000->0x20000000 256 MB read-only space
208 * 0x20000000->0x28000000 128M Binding stack growing up.
209 * 0x28000000->0x30000000 256M Static Space.
210 * 0x30000000->0x31000000 16M Foreign linkage table
211 * 0x38000000->0x40000000 128M Control stack growing down.
212 * 0x40000000->0xD0000000 2304M Dynamic Space.
214 * Starting at 0xd0ce0000 there is some mapped anon memory. libc
215 * seems to start at 0xd0d40000 and other places. Looks like memory
216 * above 0xd0ffe000 or so is not mapped.
219 #define READ_ONLY_SPACE_START (SpaceStart_TargetReadOnly)
220 #define READ_ONLY_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
222 #define STATIC_SPACE_START (SpaceStart_TargetStatic)
223 #define STATIC_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
225 #define BINDING_STACK_START (0x20000000)
226 #define BINDING_STACK_SIZE (0x07fff000) /* 128MB - 1 page */
228 #define CONTROL_STACK_START 0x38000000
229 #define CONTROL_STACK_SIZE (0x07fff000 - 8192)
230 #define SIGNAL_STACK_START CONTROL_STACK_END
231 #define SIGNAL_STACK_SIZE SIGSTKSZ
233 #define DYNAMIC_0_SPACE_START (SpaceStart_TargetDynamic)
236 #define DYNAMIC_SPACE_SIZE (0x90000000) /* 2.304GB */
238 #define DYNAMIC_SPACE_SIZE (0x04000000) /* 64MB */
240 #define DEFAULT_DYNAMIC_SPACE_SIZE (0x20000000) /* 512MB */
242 #define FOREIGN_LINKAGE_SPACE_START (LinkageSpaceStart)
243 #define FOREIGN_LINKAGE_SPACE_SIZE (0x100000) /* 1MB */
247 #define CONTROL_STACK_END (CONTROL_STACK_START + control_stack_size)
249 /* Note that GENCGC only uses dynamic_space 0. */
250 #define DYNAMIC_1_SPACE_START (DYNAMIC_0_SPACE_START + DYNAMIC_SPACE_SIZE)
252 #endif /* _X86_VALIDATE_H_ */