integrated Raymond Wiker's patches to port RUN-PROGRAM from CMU CL and
[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  *  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
46 #if defined(__FreeBSD__) || defined(__OpenBSD__)
47 #define READ_ONLY_SPACE_START   (0x10000000)
48 #define READ_ONLY_SPACE_SIZE    (0x0ffff000) /* 256MB - 1 page */
49
50 #define STATIC_SPACE_START      (0x30000000)
51 #define STATIC_SPACE_SIZE       (0x07fff000) /* 128M - 1 page */
52
53 #define BINDING_STACK_START     (0x38000000)
54 #define BINDING_STACK_SIZE      (0x07fff000) /* 128MB - 1 page */
55
56 #define CONTROL_STACK_START     (0x40000000)
57 #define CONTROL_STACK_SIZE      (0x08000000) /* 128MB */
58
59 #define DYNAMIC_0_SPACE_START   (0x48000000)
60 #ifdef GENCGC
61 #define DYNAMIC_SPACE_SIZE      (0x40000000) /* May be up to 2GB */
62 #else
63 #define DYNAMIC_SPACE_SIZE      (0x04000000) /* 64MB */
64 #endif
65 #endif
66
67 /* FIXME: It's gross to have numbers like 0x50000000 wired into the
68  * code in multiple places like this. (Not only does this file know
69  * about it, but Lisp code knows about it, because Lisp code is able
70  * to generate absolute addresses for all the static symbols even
71  * before it's read the map file.) I don't know whether I should
72  * actually *fix* this, but I should at least document it some with a
73  * KLUDGE marker. And it might even be fixable, by putting all this
74  * memory space arbitrariness into an architecture-dependent Lisp
75  * file. If so, perhaps I should write somewhere in a "design
76  * principles" or "coding principles" file that information like this
77  * always flows from Lisp code to C code, through sbcl.h. */
78 #ifdef __linux__
79 #define READ_ONLY_SPACE_START   (0x01000000)
80 #define READ_ONLY_SPACE_SIZE    (0x02800000) /* 40MB */
81
82 #define STATIC_SPACE_START      (0x05000000)
83 #define STATIC_SPACE_SIZE       (0x02fff000) /* 48MB - 1 page */
84
85 #define BINDING_STACK_START     (0x60000000)
86 #define BINDING_STACK_SIZE      (0x07fff000) /* 128MB - 1 page */
87
88 #define CONTROL_STACK_START     (0x50000000)
89 #define CONTROL_STACK_SIZE      (0x07fff000) /* 128MB - 1 page */
90
91 #define DYNAMIC_0_SPACE_START   (0x09000000)
92 #ifdef GENCGC
93 #define DYNAMIC_SPACE_SIZE      (0x20000000) /* 512MB */
94 #else
95 #define DYNAMIC_SPACE_SIZE      (0x04000000) /* 64MB */
96 #endif
97 #endif
98
99 #define CONTROL_STACK_END       (CONTROL_STACK_START + CONTROL_STACK_SIZE)
100
101 /* Note that GENCGC only uses dynamic_space 0. */
102 #define DYNAMIC_1_SPACE_START   (DYNAMIC_0_SPACE_START + DYNAMIC_SPACE_SIZE)