0.6.7.13: dynamic-space simplification (only one dynamic space now)
[sbcl.git] / src / runtime / x86-validate.h
1 /*
2  * This software is part of the SBCL system. See the README file for
3  * more information.
4  *
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.
10  */
11
12 /*
13  * $Header$
14  */
15 \f
16 /*
17  * address map:
18  *
19  *  FreeBSD:
20  *      0x00000000->0x0E000000 224M C program and memory allocation.
21  *      0x0E000000->0x10000000  32M Foreign segment.
22  *      0x10000000->0x20000000 256M Read-Only Space.
23  *      0x20000000->0x30000000 256M Reserved for shared libraries.
24  *      0x30000000->0x38000000 128M Static Space.
25  *      0x38000000->0x40000000 128M Binding stack growing up.
26  *      0x40000000->0x48000000 128M Control stack growing down.
27  *      0x48000000->0xC8000000 2GB  Dynamic Space.
28  *      0xE0000000->           256M C stack - Alien stack.
29  *
30  *  OpenBSD:
31  *      almost the same as FreeBSD
32  *
33  *  Linux: Note that this map has some problems and requires some further
34  *         development so is not implemented below.
35  *      0x00000000->0x08000000 128M Unused.
36  *      0x08000000->0x10000000 128M C program and memory allocation.
37  *      0x10000000->0x20000000 256M Read-Only Space.
38  *      0x20000000->0x28000000 128M Binding stack growing up.
39  *      0x28000000->0x38000000 256M Static Space.
40  *      0x38000000->0x40000000 128M Control stack growing down.
41  *      0x40000000->0x48000000 128M Reserved for shared libraries.
42  *      0x48000000->0xB8000000 1.75G Dynamic Space.
43  *
44  * FIXME: There's something wrong with addressing maps which are so
45  * brittle that they can be commented as fixed addresses. Try to
46  * parameterize these so they can be set at build time.
47  */
48
49 #if defined(__FreeBSD__) || defined(__OpenBSD__)
50 #define READ_ONLY_SPACE_SIZE    (0x0ffff000) /* 256MB - 1 page */
51
52 #if defined __FreeBSD__
53 #define STATIC_SPACE_SIZE       (0x07fff000) /* 128M - 1 page */
54 #elif defined __OpenBSD__
55 #define STATIC_SPACE_SIZE       (0x0ffff000) /* 256M - 1 page */
56 #else
57 #error unsupported BSD variant
58 #endif
59
60
61 #define BINDING_STACK_START     (0x38000000)
62 #define BINDING_STACK_SIZE      (0x07fff000) /* 128MB - 1 page */
63
64 #define CONTROL_STACK_START     (0x40000000)
65 #define CONTROL_STACK_SIZE      (0x08000000) /* 128MB */
66
67 #define DYNAMIC_SPACE_SIZE      (0x40000000) /* may be up to 2GB */
68 #endif
69
70 /* FIXME: It's gross to have numbers like 0x50000000 wired into the
71  * code in multiple places like this. (Not only does this file know
72  * about it, but Lisp code knows about it, because Lisp code is able
73  * to generate absolute addresses for all the static symbols even
74  * before it's read the map file.) I don't know whether I should
75  * actually *fix* this, but I should at least document it some with a
76  * KLUDGE marker. And it might even be fixable, by putting all this
77  * memory space arbitrariness into an architecture-dependent Lisp
78  * file. If so, perhaps I should write somewhere in a "design
79  * principles" or "coding principles" file that information like this
80  * always flows from Lisp code to C code, through sbcl.h. */
81 #ifdef __linux__
82 #define READ_ONLY_SPACE_SIZE    (0x02800000) /* 40MB */
83
84 #define STATIC_SPACE_SIZE       (0x02fff000) /* 48MB - 1 page */
85
86 #define BINDING_STACK_START     (0x60000000)
87 #define BINDING_STACK_SIZE      (0x07fff000) /* 128MB - 1 page */
88
89 #define CONTROL_STACK_START     (0x50000000)
90 #define CONTROL_STACK_SIZE      (0x07fff000) /* 128MB - 1 page */
91
92 #define DYNAMIC_SPACE_SIZE      (0x20000000) /* 512MB */
93 #endif
94
95 #define CONTROL_STACK_END       (CONTROL_STACK_START + CONTROL_STACK_SIZE)