6 * This software is part of the SBCL system. See the README file for
9 * This software is derived from the CMU CL system, which was
10 * written at Carnegie Mellon University and released into the
11 * public domain. The software is in the public domain and is
12 * provided with absolutely no warranty. See the COPYING and CREDITS
13 * files for more information.
27 ensure_space(lispobj
*start
, unsigned long size
)
29 if (os_validate((os_vm_address_t
)start
,(os_vm_size_t
)size
)==NULL
) {
31 "ensure_space: failed to validate %ld bytes at 0x%08lx\n",
33 (unsigned long)start
);
35 "(hint: Try \"ulimit -a\"; maybe you should increase memory limits.)\n");
40 os_vm_address_t undefined_alien_address
= 0;
43 ensure_undefined_alien(void) {
44 os_vm_address_t start
= os_validate(NULL
, os_vm_page_size
);
46 os_protect(start
, os_vm_page_size
, OS_VM_PROT_NONE
);
47 undefined_alien_address
= start
;
49 lose("could not allocate guard page for undefined alien");
57 printf("validating memory ...");
61 ensure_space( (lispobj
*)READ_ONLY_SPACE_START
, READ_ONLY_SPACE_SIZE
);
62 ensure_space( (lispobj
*)STATIC_SPACE_START
, STATIC_SPACE_SIZE
);
63 #ifdef LISP_FEATURE_GENCGC
64 ensure_space( (lispobj
*)DYNAMIC_SPACE_START
, DYNAMIC_SPACE_SIZE
);
66 ensure_space( (lispobj
*)DYNAMIC_0_SPACE_START
, DYNAMIC_SPACE_SIZE
);
67 ensure_space( (lispobj
*)DYNAMIC_1_SPACE_START
, DYNAMIC_SPACE_SIZE
);
70 #ifdef LISP_FEATURE_LINKAGE_TABLE
71 ensure_space( (lispobj
*)LINKAGE_TABLE_SPACE_START
, LINKAGE_TABLE_SPACE_SIZE
);
74 #ifdef LISP_FEATURE_OS_PROVIDES_DLOPEN
75 ensure_undefined_alien();
84 protect_control_stack_guard_page(int protect_p
) {
85 struct thread
*th
= arch_os_get_current_thread();
86 os_protect(CONTROL_STACK_GUARD_PAGE(th
),
87 os_vm_page_size
,protect_p
?
88 (OS_VM_PROT_READ
|OS_VM_PROT_EXECUTE
) : OS_VM_PROT_ALL
);
92 protect_control_stack_return_guard_page(int protect_p
) {
93 struct thread
*th
= arch_os_get_current_thread();
94 os_protect(CONTROL_STACK_RETURN_GUARD_PAGE(th
),
95 os_vm_page_size
,protect_p
?
96 (OS_VM_PROT_READ
|OS_VM_PROT_EXECUTE
) : OS_VM_PROT_ALL
);