Initial revision
[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->0x28000000 128M Reserved for shared libraries.
24  *      0x28000000->0x38000000 256M 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  *  Linux: Note that this map has some problems and requires some further
31  *         development so is not implemented below.
32  *      0x00000000->0x08000000 128M Unused.
33  *      0x08000000->0x10000000 128M C program and memory allocation.
34  *      0x10000000->0x20000000 256M Read-Only Space.
35  *      0x20000000->0x28000000 128M Binding stack growing up.
36  *      0x28000000->0x38000000 256M Static Space.
37  *      0x38000000->0x40000000 128M Control stack growing down.
38  *      0x40000000->0x48000000 128M Reserved for shared libraries.
39  *      0x48000000->0xB8000000 1.75G Dynamic Space.
40  *
41  * FIXME: There's something wrong with addressing maps which are so
42  * brittle that they can be commented as fixed addresses. Try to
43  * parameterize these so they can be set at build time. */
44
45 #if defined(__FreeBSD__) || defined(__OpenBSD__)
46 #define READ_ONLY_SPACE_START   (0x10000000)
47 #define READ_ONLY_SPACE_SIZE    (0x0ffff000) /* 256MB - 1 page */
48
49 #define STATIC_SPACE_START      (0x28000000)
50 #define STATIC_SPACE_SIZE       (0x0ffff000) /* 256MB - 1 page */
51
52 #define BINDING_STACK_START     (0x38000000)
53 #define BINDING_STACK_SIZE      (0x07fff000) /* 128MB - 1 page */
54
55 #define CONTROL_STACK_START     (0x40000000)
56 #define CONTROL_STACK_SIZE      (0x08000000) /* 128MB */
57
58 #define DYNAMIC_0_SPACE_START   (0x48000000)
59 #ifdef GENCGC
60 #define DYNAMIC_SPACE_SIZE      (0x40000000) /* May be up to 2GB */
61 #else
62 #define DYNAMIC_SPACE_SIZE      (0x04000000) /* 64MB */
63 #endif
64 #endif
65
66 /* FIXME: It's gross to have numbers like 0x50000000 wired into the
67  * code in multiple places like this. (Not only does this file know
68  * about it, but Lisp code knows about it, because Lisp code is able
69  * to generate absolute addresses for all the static symbols even
70  * before it's read the map file.) I don't know whether I should
71  * actually *fix* this, but I should at least document it some with a
72  * KLUDGE marker. And it might even be fixable, by putting all this
73  * memory space arbitrariness into an architecture-dependent Lisp
74  * file. If so, perhaps I should write somewhere in a "design
75  * principles" or "coding principles" file that information like this
76  * always flows from Lisp code to C code, through sbcl.h. */
77 #ifdef __linux__
78 #define READ_ONLY_SPACE_START   (0x01000000)
79 #define READ_ONLY_SPACE_SIZE    (0x02800000) /* 40MB */
80
81 #define STATIC_SPACE_START      (0x05000000)
82 #define STATIC_SPACE_SIZE       (0x02fff000) /* 48MB - 1 page */
83
84 #define BINDING_STACK_START     (0x60000000)
85 #define BINDING_STACK_SIZE      (0x07fff000) /* 128MB - 1 page */
86
87 #define CONTROL_STACK_START     (0x50000000)
88 #define CONTROL_STACK_SIZE      (0x07fff000) /* 128MB - 1 page */
89
90 #define DYNAMIC_0_SPACE_START   (0x09000000)
91 #ifdef GENCGC
92 #define DYNAMIC_SPACE_SIZE      (0x20000000) /* 512MB */
93 #else
94 #define DYNAMIC_SPACE_SIZE      (0x04000000) /* 64MB */
95 #endif
96 #endif
97
98 #define CONTROL_STACK_END       (CONTROL_STACK_START + CONTROL_STACK_SIZE)
99
100 /* Note that GENCGC only uses dynamic_space 0. */
101 #define DYNAMIC_1_SPACE_START   (DYNAMIC_0_SPACE_START + DYNAMIC_SPACE_SIZE)