/[cmucl]/src/lisp/validate.c
ViewVC logotype

Contents of /src/lisp/validate.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.25 - (show annotations)
Mon Jul 9 16:04:12 2007 UTC (6 years, 9 months ago) by fgilham
Branch: MAIN
CVS Tags: sparc-tramp-assem-base, post-merge-intl-branch, merged-unicode-utf16-extfmt-2009-06-11, unicode-utf16-extfmt-2009-03-27, snapshot-2007-09, snapshot-2007-08, snapshot-2008-08, snapshot-2008-09, sse2-packed-2008-11-12, snapshot-2008-05, snapshot-2008-06, snapshot-2008-07, snapshot-2008-01, snapshot-2008-02, snapshot-2008-03, intl-branch-working-2010-02-19-1000, unicode-string-buffer-impl-base, sse2-base, release-20b-pre1, release-20b-pre2, unicode-string-buffer-base, sse2-packed-base, sparc-tramp-assem-2010-07-19, amd64-dd-start, release-19f-pre1, snapshot-2008-12, snapshot-2008-11, intl-2-branch-base, release-19e, GIT-CONVERSION, unicode-utf16-sync-2008-12, cross-sol-x86-merged, label-2009-03-16, release-19f-base, merge-sse2-packed, merge-with-19f, intl-branch-working-2010-02-11-1000, unicode-snapshot-2009-05, unicode-snapshot-2009-06, unicode-utf16-sync-2008-07, unicode-utf16-sync-2008-09, unicode-utf16-extfmts-sync-2008-12, RELEASE_20b, snapshot-2008-04, unicode-utf16-sync-label-2009-03-16, RELEASE_19f, release-20a-base, cross-sol-x86-base, unicode-utf16-char-support-2009-03-26, unicode-utf16-char-support-2009-03-25, unicode-utf16-extfmts-pre-sync-2008-11, snapshot-2008-10, snapshot-2010-12, snapshot-2010-11, unicode-utf16-sync-2008-11, snapshot-2011-09, snapshot-2011-06, snapshot-2011-07, snapshot-2011-04, snapshot-2011-02, snapshot-2011-03, snapshot-2011-01, pre-merge-intl-branch, release-19e-pre1, release-19e-pre2, snapshot-2010-05, snapshot-2010-04, snapshot-2010-07, snapshot-2010-06, snapshot-2010-01, snapshot-2010-03, snapshot-2010-02, snapshot-2010-08, label-2009-03-25, cross-sol-x86-2010-12-20, sse2-checkpoint-2008-10-01, intl-branch-2010-03-18-1300, sse2-merge-with-2008-11, sse2-merge-with-2008-10, RELEASE_20a, release-20a-pre1, snapshot-2009-11, snapshot-2009-12, unicode-utf16-extfmt-2009-06-11, portable-clx-import-2009-06-16, unicode-utf16-string-support, cross-sparc-branch-base, release-19e-base, intl-branch-base, unicode-utf16-base, portable-clx-base, snapshot-2009-08, snapshot-2007-12, snapshot-2007-10, snapshot-2007-11, snapshot-2009-02, snapshot-2009-01, snapshot-2009-07, snapshot-2009-05, snapshot-2009-04, pre-telent-clx, HEAD
Branch point for: RELEASE-19F-BRANCH, portable-clx-branch, cross-sparc-branch, RELEASE-20B-BRANCH, unicode-string-buffer-branch, sparc-tramp-assem-branch, sse2-packed-branch, RELEASE-20A-BRANCH, amd64-dd-branch, unicode-string-buffer-impl-branch, intl-branch, unicode-utf16-branch, cross-sol-x86-branch, release-19e-branch, sse2-branch, intl-2-branch, unicode-utf16-extfmt-branch
Changes since 1.24: +2 -2 lines
File MIME type: text/plain
Fix typos, portability stuff (e.g. get rid of __FUNCTION__ which SunOS doesn't have.)
1 /*
2 * $Header: /tiger/var/lib/cvsroots/cmucl/src/lisp/validate.c,v 1.25 2007/07/09 16:04:12 fgilham Rel $
3 *
4 * Memory Validation
5 */
6
7 #include <stdio.h>
8 #include <unistd.h>
9 #include <string.h>
10 #include <stdlib.h>
11 #ifdef sparc
12 #include <alloca.h>
13 #endif
14
15 #include "lisp.h"
16 #include "os.h"
17 #include "globals.h"
18 #include "validate.h"
19 #include "internals.h"
20
21 unsigned long read_only_space_size = READ_ONLY_SPACE_SIZE;
22 unsigned long binding_stack_size = BINDING_STACK_SIZE;
23 unsigned long static_space_size = STATIC_SPACE_SIZE;
24 unsigned long control_stack_size = CONTROL_STACK_SIZE;
25
26 #ifdef sparc
27 extern void make_holes(void);
28 #endif
29
30 static void
31 ensure_space(lispobj * start, size_t size)
32 {
33 if (os_validate((os_vm_address_t) start, size) == NULL) {
34 fprintf(stderr,
35 "ensure_space: Failed to validate %ld bytes at 0x%08lx\n",
36 (unsigned long) size, (unsigned long) start);
37 exit(1);
38 }
39 }
40
41
42 /* builtin_image_flag is used as a flag indicating that the lisp image is
43 built into the executable. The other variables are set to actual values
44 in elf.c when the core section is mapped. FMG
45 */
46 extern int builtin_image_flag;
47 long image_dynamic_space_size = 0;
48 long image_read_only_space_size = 0;
49 long image_static_space_size = 0;
50
51 void
52 validate(void)
53 {
54 /* void *dynamic_space_data = NULL; */
55
56 /* Read-Only Space */
57 read_only_space = (lispobj *) READ_ONLY_SPACE_START;
58 /* Note that if the lisp core is not built into the image,
59 the below expression will be equal to this:
60 ensure_space(read_only_space, READ_ONLY_SPACE_SIZE);
61 FMG
62 */
63 ensure_space((lispobj *)((int)read_only_space + image_read_only_space_size),
64 READ_ONLY_SPACE_SIZE - image_read_only_space_size);
65
66 /* Static Space */
67 static_space = (lispobj *) STATIC_SPACE_START;
68 /* Note that if the lisp core is not built into the image,
69 the below expression will be equal to this:
70 ensure_space(static_space, STATIC_SPACE_SIZE);
71 FMG
72 */
73 ensure_space((lispobj *)((int)static_space + image_static_space_size),
74 STATIC_SPACE_SIZE - image_static_space_size);
75
76 /* Dynamic-0 Space */
77 dynamic_0_space = (lispobj *) DYNAMIC_0_SPACE_START;
78 /* Note that if the lisp core is not built into the image,
79 the below expression will be equal to this:
80 ensure_space(dynamic_0_space, dynamic_space_size);
81 FMG
82 */
83 ensure_space((lispobj *)((int)dynamic_0_space + image_dynamic_space_size),
84 dynamic_space_size - image_dynamic_space_size);
85
86 current_dynamic_space = dynamic_0_space;
87
88 #ifndef GENCGC
89 /* Dynamic-1 Space */
90 dynamic_1_space = (lispobj *) DYNAMIC_1_SPACE_START;
91 ensure_space(dynamic_1_space, dynamic_space_size);
92 /* I'm not sure about the following, or if the lisp executable
93 stuff will work with a garbage collector other than gencgc.
94 FMG
95 */
96 /*
97 if (builtin_image_flag != 0)
98 dynamic_space_data = alloca((int) (&image_dynamic_space_size));
99 */
100 #endif
101
102 /* Control Stack */
103 control_stack = (lispobj *) CONTROL_STACK_START;
104 #if (defined(i386) || defined(__x86_64))
105 control_stack_end = (lispobj *) (CONTROL_STACK_START + CONTROL_STACK_SIZE);
106 #endif
107 ensure_space(control_stack, CONTROL_STACK_SIZE);
108
109 #ifdef SIGNAL_STACK_START
110 ensure_space((lispobj *) SIGNAL_STACK_START, SIGNAL_STACK_SIZE);
111 #endif
112
113 /* Binding Stack */
114 binding_stack = (lispobj *) BINDING_STACK_START;
115 ensure_space(binding_stack, BINDING_STACK_SIZE);
116 #ifdef LINKAGE_TABLE
117 ensure_space((lispobj *) FOREIGN_LINKAGE_SPACE_START,
118 FOREIGN_LINKAGE_SPACE_SIZE);
119 #endif
120 #ifdef sparc
121 make_holes();
122 #endif
123
124 #ifdef PRINTNOISE
125 printf(" done.\n");
126 #endif
127
128 #ifdef RED_ZONE_HIT
129 os_guard_control_stack(0, 1);
130 #endif
131 }

  ViewVC Help
Powered by ViewVC 1.1.5