X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fvalidate.c;h=be8ad272ae421744730c2af62622556de7053bfc;hb=d68f3f83e6c5b9bed9789279cbae346f240488cc;hp=5f31b203a65a9ba8c5dc81ec142418d6fcd75708;hpb=5f338d314224411587a7cac218ea320bc982f19f;p=sbcl.git diff --git a/src/runtime/validate.c b/src/runtime/validate.c index 5f31b20..be8ad27 100644 --- a/src/runtime/validate.c +++ b/src/runtime/validate.c @@ -13,22 +13,21 @@ * files for more information. */ -/* - * $Header$ - */ - #include +#include + #include "runtime.h" #include "os.h" #include "globals.h" #include "sbcl.h" #include "validate.h" -static void ensure_space(lispobj *start, unsigned long size) +static void +ensure_space(lispobj *start, unsigned long size) { if (os_validate((os_vm_address_t)start,(os_vm_size_t)size)==NULL) { fprintf(stderr, - "ensure_space: failed to validate %ld bytes at 0x%08X\n", + "ensure_space: failed to validate %ld bytes at 0x%08lx\n", size, (unsigned long)start); exit(1); @@ -39,7 +38,8 @@ static void ensure_space(lispobj *start, unsigned long size) static os_vm_address_t holes[] = HOLES; -static void make_holes(void) +static void +make_holes(void) { int i; @@ -56,24 +56,41 @@ static void make_holes(void) } #endif -void validate(void) +void +validate(void) { #ifdef PRINTNOISE - printf("validating memory ..."); - fflush(stdout); + printf("validating memory ..."); + fflush(stdout); +#endif + + ensure_space( (lispobj *)READ_ONLY_SPACE_START, READ_ONLY_SPACE_SIZE); + ensure_space( (lispobj *)STATIC_SPACE_START , STATIC_SPACE_SIZE); +#ifdef LISP_FEATURE_GENCGC + ensure_space( (lispobj *)DYNAMIC_SPACE_START , DYNAMIC_SPACE_SIZE); +#else + ensure_space( (lispobj *)DYNAMIC_0_SPACE_START , DYNAMIC_SPACE_SIZE); + ensure_space( (lispobj *)DYNAMIC_1_SPACE_START , DYNAMIC_SPACE_SIZE); +#endif + ensure_space( (lispobj *)CONTROL_STACK_START , CONTROL_STACK_SIZE); + ensure_space( (lispobj *)BINDING_STACK_START , BINDING_STACK_SIZE); +#ifdef LISP_FEATURE_C_STACK_IS_CONTROL_STACK + ensure_space( (lispobj *) ALTERNATE_SIGNAL_STACK_START, SIGSTKSZ); #endif - - ensure_space(READ_ONLY_SPACE_START, READ_ONLY_SPACE_SIZE); - ensure_space(STATIC_SPACE_START , STATIC_SPACE_SIZE); - ensure_space(DYNAMIC_SPACE_START , DYNAMIC_SPACE_SIZE); - ensure_space(CONTROL_STACK_START , CONTROL_STACK_SIZE); - ensure_space(BINDING_STACK_START , BINDING_STACK_SIZE); #ifdef HOLES - make_holes(); + make_holes(); #endif - + #ifdef PRINTNOISE - printf(" done.\n"); + printf(" done.\n"); #endif + protect_control_stack_guard_page(1); } + +void protect_control_stack_guard_page(int protect_p) { + os_protect(CONTROL_STACK_GUARD_PAGE, + os_vm_page_size,protect_p ? + (OS_VM_PROT_READ|OS_VM_PROT_EXECUTE) : OS_VM_PROT_ALL); +} +