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_
11 #if defined(__linux__)
12 #include "x86-validate-linux.h"
16 #include "x86-validate-darwin.h"
20 * Also look in compiler/x86/parms.lisp for some of the parameters.
25 * 0x00000000->0x0E000000 224M C program and memory allocation.
26 * 0x0E000000->0x10000000 32M Foreign segment.
27 * 0x10000000->0x20000000 256M Read-Only Space.
28 * 0x20000000->0x28000000 128M Reserved for shared libraries.
29 * 0x28000000->0x38000000 256M Static Space.
30 * 0x38000000->0x40000000 128M Binding stack growing up.
31 * 0x40000000->0x48000000 128M Control stack growing down.
32 * 0x48000000->0xB0000000 1664M Dynamic Space.
33 * 0xB0000000->0xB1000000 Foreign Linkage Table
34 * 0xE0000000-> 256M C stack - Alien stack.
37 * 0x00000000->0x0E000000 224M C program and memory allocation.
38 * 0x0E000000->0x10000000 32M Foreign segment.
39 * 0x10000000->0x20000000 256M Read-Only Space.
40 * 0x20000000->0x28000000 128M Binding stack growing up.
41 * 0x28000000->0x38000000 256M Static Space.
42 * 0x38000000->0x40000000 128M Control stack growing down.
43 * 0x40000000->0x48000000 128M Reserved for shared libraries.
44 * 0x48000000->0xB0000000 1664M Dynamic Space.
45 * 0xB0000000->0xB1000000 16M Foreign Linkage Table
46 * 0xE0000000-> 256M C stack - Alien stack.
49 * 0x00000000->0x0E000000 224M C program and memory allocation.
50 * 0x0E000000->0x10000000 32M Foreign segment.
51 * 0x10000000->0x20000000 256M Read-Only Space.
52 * 0x28000000->0x38000000 256M Static Space.
53 * 0x38000000->0x40000000 128M Binding stack growing up.
54 * 0x40000000->0x48000000 128M Control stack growing down.
55 * 0x48800000->0xB0000000 1656M Dynamic Space.
56 * 0xB0000000->0xB1000000 16M Foreign Linkage Table
57 * 0xE0000000-> 256M C stack - Alien stack.
60 * 0x00000000->0x08000000 128M Unused.
61 * 0x08000000->0x10000000 128M C program and memory allocation.
62 * 0x10000000->0x20000000 256M Read-Only Space.
63 * 0x20000000->0x28000000 128M Binding stack growing up.
64 * 0x28000000->0x38000000 256M Static Space.
65 * 0x38000000->0x40000000 128M Control stack growing down.
66 * 0x40000000->0x48000000 128M Reserved for shared libraries.
67 * 0x58000000->0x58100000 16M Foreign Linkage Table
68 * 0x58100000->0xBE000000 1631M Dynamic Space.
69 * 0xBFFF0000->0xC0000000 Unknown Linux mapping
71 * (Note: 0x58000000 allows us to run on a Linux system on an AMD
72 * x86-64. Hence we have a gap of unused memory starting at
77 #define READ_ONLY_SPACE_START (0x10000000)
78 #define READ_ONLY_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
80 #define STATIC_SPACE_START (0x28f00000)
81 #define STATIC_SPACE_SIZE (0x0f0ff000) /* 241MB - 1 page */
83 #define BINDING_STACK_START (0x38000000)
84 #define BINDING_STACK_SIZE (0x07fff000) /* 128MB - 1 page */
86 #define CONTROL_STACK_START 0x40000000
87 #define CONTROL_STACK_SIZE 0x07fd8000 /* 128MB - SIGSTKSZ */
88 #define SIGNAL_STACK_START 0x47fd8000
89 #define SIGNAL_STACK_SIZE SIGSTKSZ
91 #define DYNAMIC_0_SPACE_START (0x48000000UL)
93 #define DYNAMIC_SPACE_SIZE (0x78000000UL) /* May be up to 1.7 GB */
95 #define DYNAMIC_SPACE_SIZE (0x04000000UL) /* 64MB */
97 #define DEFAULT_DYNAMIC_SPACE_SIZE (0x20000000UL) /* 512MB */
99 #define FOREIGN_LINKAGE_SPACE_START ((unsigned long) LinkageSpaceStart)
100 #define FOREIGN_LINKAGE_SPACE_SIZE (0x100000UL) /* 1MB */
102 #endif /* __FreeBSD__ */
106 #define READ_ONLY_SPACE_START (0x10000000)
107 #define READ_ONLY_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
109 #define STATIC_SPACE_START (0x28000000)
110 #define STATIC_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
112 #define BINDING_STACK_START (0x38000000)
113 #define BINDING_STACK_SIZE (0x07fff000) /* 128MB - 1 page */
115 #define CONTROL_STACK_START (0x40000000)
116 #define CONTROL_STACK_SIZE (0x07fd8000) /* 128MB - SIGSTKSZ */
118 #define SIGNAL_STACK_START (0x47fd8000)
119 #define SIGNAL_STACK_SIZE SIGSTKSZ
121 #define DYNAMIC_0_SPACE_START (0x48000000)
123 #define DYNAMIC_SPACE_SIZE (0x68000000) /* 1.625GB */
125 #define DYNAMIC_SPACE_SIZE (0x04000000) /* 64MB */
127 #define DEFAULT_DYNAMIC_SPACE_SIZE (0x20000000) /* 512MB */
130 #if defined(__NetBSD__)
131 #define READ_ONLY_SPACE_START (SpaceStart_TargetReadOnly)
132 #define READ_ONLY_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
134 #define STATIC_SPACE_START (SpaceStart_TargetStatic)
135 #define STATIC_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
137 #define BINDING_STACK_START (0x38000000)
138 #define BINDING_STACK_SIZE (0x07fff000) /* 128MB - 1 page */
140 #define CONTROL_STACK_START (0x40000000)
142 #define CONTROL_STACK_SIZE (0x07fd8000) /* 128MB - SIGSTKSZ */
144 #define SIGNAL_STACK_START (0x47fd8000)
145 #define SIGNAL_STACK_SIZE SIGSTKSZ
147 #define DYNAMIC_0_SPACE_START (SpaceStart_TargetDynamic)
149 #define DYNAMIC_SPACE_SIZE (0x67800000U) /* 1.656GB */
151 #define DYNAMIC_SPACE_SIZE (0x04000000U) /* 64MB */
154 #define DEFAULT_DYNAMIC_SPACE_SIZE (0x20000000U) /* 512MB */
156 #define FOREIGN_LINKAGE_SPACE_START (LinkageSpaceStart)
157 #define FOREIGN_LINKAGE_SPACE_SIZE (0x100000) /* 1MB */
160 #endif /* __NetBSD__ || DARWIN */
164 * The memory map for Solaris/x86 looks roughly like
166 * 0x08045000->0x08050000 C stack?
167 * 0x08050000-> Code + C heap
168 * 0x10000000->0x20000000 256 MB read-only space
169 * 0x20000000->0x28000000 128M Binding stack growing up.
170 * 0x28000000->0x30000000 256M Static Space.
171 * 0x30000000->0x31000000 16M Foreign linkage table
172 * 0x38000000->0x40000000 128M Control stack growing down.
173 * 0x40000000->0xD0000000 2304M Dynamic Space.
175 * Starting at 0xd0ce0000 there is some mapped anon memory. libc
176 * seems to start at 0xd0d40000 and other places. Looks like memory
177 * above 0xd0ffe000 or so is not mapped.
180 #define READ_ONLY_SPACE_START (SpaceStart_TargetReadOnly)
181 #define READ_ONLY_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
183 #define STATIC_SPACE_START (SpaceStart_TargetStatic)
184 #define STATIC_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
186 #define BINDING_STACK_START (0x20000000)
187 #define BINDING_STACK_SIZE (0x07fff000) /* 128MB - 1 page */
189 #define CONTROL_STACK_START 0x38000000
190 #define CONTROL_STACK_SIZE (0x07fff000 - 8192)
191 #define SIGNAL_STACK_START CONTROL_STACK_END
192 #define SIGNAL_STACK_SIZE SIGSTKSZ
194 #define DYNAMIC_0_SPACE_START (SpaceStart_TargetDynamic)
197 #define DYNAMIC_SPACE_SIZE (0x90000000) /* 2.304GB */
199 #define DYNAMIC_SPACE_SIZE (0x04000000) /* 64MB */
201 #define DEFAULT_DYNAMIC_SPACE_SIZE (0x20000000) /* 512MB */
203 #define FOREIGN_LINKAGE_SPACE_START (LinkageSpaceStart)
204 #define FOREIGN_LINKAGE_SPACE_SIZE (0x100000) /* 1MB */
208 #define CONTROL_STACK_END (CONTROL_STACK_START + control_stack_size)
210 /* Note that GENCGC only uses dynamic_space 0. */
211 #define DYNAMIC_1_SPACE_START (DYNAMIC_0_SPACE_START + DYNAMIC_SPACE_SIZE)
213 #endif /* _X86_VALIDATE_H_ */