/[cmucl]/src/lisp/x86-validate.h
ViewVC logotype

Contents of /src/lisp/x86-validate.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (hide annotations)
Sun Mar 23 21:23:41 2003 UTC (11 years, 1 month ago) by gerd
Branch: MAIN
CVS Tags: snapshot-2003-10, remove_negative_zero_not_zero, dynamic-extent-base, sparc_gencgc_merge, snapshot-2003-11, sparc_gencgc, snapshot-2003-12, lisp-executable-base
Branch point for: sparc_gencgc_branch, dynamic-extent, lisp-executable
Changes since 1.16: +9 -5 lines
File MIME type: text/plain
	Optional control stack checking.  This is controlled by the
	feature :stack-checking because it's not implemented for other
	systems/architectures yet.  It is currently known to work on
	FreeBSD 4.8-RC/x86 and Debian 2.2.20/x86.

	* bootfiles/18e/boot3.lisp: New boot file, well, only a
	description of the boot procedure since no boot file is needed.

	* lisp/x86-validate.h (SIGNAL_STACK_START, SIGNAL_STACK_SIZE)
	[__FreeBSD__, __linux__]: New defines.
	(CONTROL_STACK_SIZE) {__FreeBSD__, __linux__]:
	Adjust for signal stack.

	* lisp/validate.c (validate) [RED_ZONE_HIT]: Call
	os_guard_control_stack.  Some cleanup.

	* lisp/os.h (BOTH_ZONES, YELLOW_ZONE, RED_ZONE): New enums.
	Add function prototypes.

	* lisp/interrupt.c (interrupt_install_low_level_handler)
	[RED_ZONE_HIT]: Deliver protection violations on a dedicated
	signal stack.

	* lisp/os-common.c (os_stack_grows_down_1, os_stack_grows_down):
	New functions.
	(guard_zones, control_stack_zone, os_guard_control_stack)
	(os_control_stack_overflow) [RED_ZONE_HIT]: New functions.
	(os_control_stack_overflow) [!RED_ZONE_HIT]: Dummy function.

	* lisp/Linux-os.c (sigsegv_handler) [RED_ZONE_HIT]: Handle control
	stack overflows.

	* lisp/FreeBSD-os.c: General cleansing.
	(sigbus_handler) [RED_ZONE_HIT]: Handle control stack overflows.

	* lisp/FreeBSD-os.h (PROTECTION_VIOLATION_SIGNAL): New define.

	* lisp/Linux-os.h (PROTECTION_VIOLATION_SIGNAL): New define.

	* compiler/x86/system.lisp (lisp::%scrub-control-stack): Change
	defknown from sys:scrub-control-stack.
	(%scrub-control-stack): Rename VOP.

	* code/lispinit.lisp (os-guard-control-stack) [#+stack-checking]:
	Define alien os_guard_control_stack.
	(%scrub-control-stack) [#+x86]: New function.
	(scrub-control-stack) [#+x86]: Call %scrub-control-stack,
	call os-guard-control-stack if #+stack-checking.

	* code/interr.lisp (yellow-zone-hit,
	red-zone-hit) [#+stack-checking]: New functions.

	* code/error.lisp (stack-overflow) [#+stack-checking]: New
	condition.

	* compiler/generic/new-genesis.lisp (finish-symbols)
	[#+stack-checking]: Add symbols for control stack checking.

	* compiler/x86/parms.lisp (static-symbols): Likewise.
1 ram 1.1 /*
2 dtc 1.7 *
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.
5     *
6 gerd 1.17 * $Header: /tiger/var/lib/cvsroots/cmucl/src/lisp/x86-validate.h,v 1.17 2003/03/23 21:23:41 gerd Exp $
7 dtc 1.7 *
8     */
9    
10     /*
11     * Address map:
12     *
13     * FreeBSD:
14     * 0x00000000->0x0E000000 224M C program and memory allocation.
15     * 0x0E000000->0x10000000 32M Foreign segment.
16     * 0x10000000->0x20000000 256M Read-Only Space.
17     * 0x20000000->0x28000000 128M Reserved for shared libraries.
18     * 0x28000000->0x38000000 256M Static Space.
19     * 0x38000000->0x40000000 128M Binding stack growing up.
20     * 0x40000000->0x48000000 128M Control stack growing down.
21     * 0x48000000->0xC8000000 2GB Dynamic Space.
22     * 0xE0000000-> 256M C stack - Alien stack.
23 dtc 1.9 *
24 pmai 1.14 * OpenBSD and NetBSD:
25 pmai 1.13 * 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 Binding stack growing up.
29     * 0x28000000->0x38000000 256M Static Space.
30     * 0x38000000->0x40000000 128M Control stack growing down.
31     * 0x40000000->0x48000000 128M Reserved for shared libraries.
32     * 0x48000000->0xB8000000 1.75GB Dynamic Space.
33     * 0xE0000000-> 256M C stack - Alien stack.
34     *
35 dtc 1.11 * Linux:
36 dtc 1.7 * 0x00000000->0x08000000 128M Unused.
37     * 0x08000000->0x10000000 128M C program and memory allocation.
38     * 0x10000000->0x20000000 256M Read-Only Space.
39     * 0x20000000->0x28000000 128M Binding stack growing up.
40     * 0x28000000->0x38000000 256M Static Space.
41     * 0x38000000->0x40000000 128M Control stack growing down.
42     * 0x40000000->0x48000000 128M Reserved for shared libraries.
43     * 0x48000000->0xB8000000 1.75G Dynamic Space.
44     *
45     */
46    
47 dtc 1.9 #ifdef __FreeBSD__
48 dtc 1.7 #define READ_ONLY_SPACE_START (0x10000000)
49     #define READ_ONLY_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
50    
51 moore 1.15 #define STATIC_SPACE_START (0x28f00000)
52     #define STATIC_SPACE_SIZE (0x0f0ff000) /* 241MB - 1 page */
53 dtc 1.7
54     #define BINDING_STACK_START (0x38000000)
55     #define BINDING_STACK_SIZE (0x07fff000) /* 128MB - 1 page */
56 dtc 1.9
57 gerd 1.17 #define CONTROL_STACK_START 0x40000000
58     #define CONTROL_STACK_SIZE 0x07fd8000 /* 128MB - SIGSTKSZ */
59     #define SIGNAL_STACK_START 0x47fd8000
60     #define SIGNAL_STACK_SIZE SIGSTKSZ
61 dtc 1.9
62     #define DYNAMIC_0_SPACE_START (0x48000000)
63     #ifdef GENCGC
64     #define DYNAMIC_SPACE_SIZE (0x40000000) /* May be up to 2GB */
65 pmai 1.13 #else
66     #define DYNAMIC_SPACE_SIZE (0x04000000) /* 64MB */
67     #endif
68     #define DEFAULT_DYNAMIC_SPACE_SIZE (0x20000000) /* 512MB */
69 moore 1.16 #ifdef LINKAGE_TABLE
70     #define FOREIGN_LINKAGE_SPACE_START (0xb0000000)
71     #define FOREIGN_LINKAGE_SPACE_SIZE (0x100000) /* 1MB */
72 pmai 1.13 #endif
73 moore 1.16 #endif /* __FreeBSD__ */
74 pmai 1.13
75    
76 pmai 1.14 #if defined(__OpenBSD__) || defined(__NetBSD__)
77 pmai 1.13 #define READ_ONLY_SPACE_START (0x10000000)
78     #define READ_ONLY_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
79    
80     #define STATIC_SPACE_START (0x28000000)
81     #define STATIC_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
82    
83     #define BINDING_STACK_START (0x20000000)
84     #define BINDING_STACK_SIZE (0x07fff000) /* 128MB - 1 page */
85    
86     #define CONTROL_STACK_START (0x38000000)
87     #define CONTROL_STACK_SIZE (0x07fff000) /* 128MB - 1 page */
88    
89     #define DYNAMIC_0_SPACE_START (0x48000000)
90     #ifdef GENCGC
91     #define DYNAMIC_SPACE_SIZE (0x68000000) /* 1.625GB */
92 dtc 1.9 #else
93     #define DYNAMIC_SPACE_SIZE (0x04000000) /* 64MB */
94 dtc 1.7 #endif
95 dtc 1.12 #define DEFAULT_DYNAMIC_SPACE_SIZE (0x20000000) /* 512MB */
96 dtc 1.9 #endif
97    
98 ram 1.1
99 dtc 1.7 #ifdef __linux__
100 dtc 1.11 #define READ_ONLY_SPACE_START (0x10000000)
101     #define READ_ONLY_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
102 dtc 1.9
103 dtc 1.11 #define STATIC_SPACE_START (0x28000000)
104     #define STATIC_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
105 dtc 1.9
106 dtc 1.10 #define BINDING_STACK_START (0x20000000)
107 dtc 1.7 #define BINDING_STACK_SIZE (0x07fff000) /* 128MB - 1 page */
108 dtc 1.9
109 gerd 1.17 #define CONTROL_STACK_START 0x38000000
110     #define CONTROL_STACK_SIZE (0x07fff000 - 8192)
111     #define SIGNAL_STACK_START CONTROL_STACK_END
112     #define SIGNAL_STACK_SIZE 8192
113 ram 1.1
114 dtc 1.10 #define DYNAMIC_0_SPACE_START (0x48000000)
115 dtc 1.4 #ifdef GENCGC
116 dtc 1.12 #define DYNAMIC_SPACE_SIZE (0x68000000) /* 1.625GB */
117 dtc 1.3 #else
118 dtc 1.4 #define DYNAMIC_SPACE_SIZE (0x04000000) /* 64MB */
119 dtc 1.3 #endif
120 dtc 1.12 #define DEFAULT_DYNAMIC_SPACE_SIZE (0x20000000) /* 512MB */
121 moore 1.16 #ifdef LINKAGE_TABLE
122     #define FOREIGN_LINKAGE_SPACE_START (0xb0000000)
123     #define FOREIGN_LINKAGE_SPACE_SIZE (0x100000) /* 1MB */
124     #endif
125 dtc 1.9 #endif
126 dtc 1.10
127 ram 1.1
128 dtc 1.9 #define CONTROL_STACK_END (CONTROL_STACK_START + CONTROL_STACK_SIZE)
129    
130     /* Note that GENCGC only uses dynamic_space 0. */
131 dtc 1.7 #define DYNAMIC_1_SPACE_START (DYNAMIC_0_SPACE_START + DYNAMIC_SPACE_SIZE)

  ViewVC Help
Powered by ViewVC 1.1.5