Raymond Toy pushed to branch rtoy-mmap-anon-control-and-binding-stacks at cmucl / cmucl
Commits:
-
cf1990dc
by Raymond Toy
at 2015-10-04T12:42:34Z
Don't define a SIGNAL_STACK mapped region. Use altstack, like on
other platforms.
-
b2dc0b2c
by Raymond Toy
at 2015-10-04T12:42:55Z
Don't define a SIGNAL_STACK mapped region. Use altstack, like on
other platforms.
-
316d2279
by Raymond Toy
at 2015-10-04T12:43:26Z
Use control_stack, not CONTROL_STACK_START.
-
bdb299d3
by Raymond Toy
at 2015-10-04T12:44:04Z
Put -O2 on it's own line to make switching this off and on slightly
easier.
-
9de8cd88
by Raymond Toy
at 2015-10-04T12:47:42Z
Remove definitions of BINDING_STACK_START and CONTROL_STACK_START.
-
e4553e8a
by Raymond Toy
at 2015-10-04T12:54:25Z
Replace BINDING_STACK_START and CONTROL_STACK_START appropriately.
9 changed files:
Changes:
src/lisp/Config.x86_common
--- a/src/lisp/Config.x86_common
+++ b/src/lisp/Config.x86_common
@@ -43,7 +43,8 @@ CPP_INCLUDE_OPTIONS := -I. -I$(PATH1) -I-
endif
CPPFLAGS := $(CPP_DEFINE_OPTIONS) $(CPP_INCLUDE_OPTIONS)
-CFLAGS += -Wstrict-prototypes -Wall -O2 -g -fno-omit-frame-pointer
+CFLAGS += -Wstrict-prototypes -Wall -g -fno-omit-frame-pointer
+CFLAGS += -O2
ASFLAGS = -g
ASSEM_SRC = x86-assem.S
src/lisp/Darwin-os.c
--- a/src/lisp/Darwin-os.c
+++ b/src/lisp/Darwin-os.c
@@ -464,8 +464,8 @@ valid_addr(os_vm_address_t addr)
#ifndef GENCGC
|| in_range_p(addr, DYNAMIC_1_SPACE_START, dynamic_space_size)
#endif
- || in_range_p(addr, CONTROL_STACK_START, control_stack_size)
- || in_range_p(addr, BINDING_STACK_START, binding_stack_size))
+ || in_range_p(addr, (lispobj)control_stack, control_stack_size)
+ || in_range_p(addr, (lispobj)binding_stack, binding_stack_size))
return TRUE;
return FALSE;
}
src/lisp/gencgc.c
--- a/src/lisp/gencgc.c
+++ b/src/lisp/gencgc.c
@@ -166,7 +166,7 @@ check_escaped_stack_object(lispobj * where, lispobj obj)
if (Pointerp(obj)
&& (p = (void *) PTR(obj),
- (p >= (void *) CONTROL_STACK_START
+ (p >= (void *) control_stack
&& p < (void *) control_stack_end))) {
char *space;
@@ -195,7 +195,7 @@ check_escaped_stack_object(lispobj * where, lispobj obj)
lose("Escaped stack-allocated object 0x%08lx at %p in %s\n",
(unsigned long) obj, where, space);
#ifndef i386
- else if ((where >= (lispobj *) CONTROL_STACK_START
+ else if ((where >= (lispobj *) control_stack
&& where < (lispobj *) (control_stack_end))
|| (space == NULL)) {
/* Do nothing if it the reference is from the control stack,
@@ -2136,17 +2136,19 @@ read_only_space_p(lispobj obj)
static inline boolean
control_stack_space_p(lispobj obj)
{
- lispobj end = CONTROL_STACK_START + control_stack_size;
+ char *object = (char *) obj;
+ char *end = (char *)control_stack + control_stack_size;
- return (obj >= CONTROL_STACK_START) && (obj < end);
+ return (object >= (char *) control_stack) && (object < end);
}
static inline boolean
binding_stack_space_p(lispobj obj)
{
- lispobj end = BINDING_STACK_START + binding_stack_size;
+ char *object = (char *) obj;
+ char *end = (char *)binding_stack + binding_stack_size;
- return (obj >= BINDING_STACK_START) && (obj < end);
+ return (object >= (char *) binding_stack) && (object < end);
}
static inline boolean
@@ -2157,7 +2159,12 @@ signal_space_p(lispobj obj)
return (obj >= SIGNAL_STACK_START) && (obj < end);
#else
- return FALSE;
+ extern char altstack[];
+
+ char* object = (char*) obj;
+ char* end = altstack + SIGNAL_STACK_SIZE;
+
+ return (object >= altstack && object < end);
#endif
}
@@ -7322,11 +7329,11 @@ verify_gc(void)
int static_space_size = (lispobj *) SymbolValue(STATIC_SPACE_FREE_POINTER)
- (lispobj *) static_space;
int binding_stack_size = (lispobj *) get_binding_stack_pointer()
- - (lispobj *) BINDING_STACK_START;
+ - (lispobj *) binding_stack;
verify_space((lispobj *) READ_ONLY_SPACE_START, read_only_space_size);
verify_space((lispobj *) static_space, static_space_size);
- verify_space((lispobj *) BINDING_STACK_START, binding_stack_size);
+ verify_space((lispobj *) binding_stack, binding_stack_size);
verify_space((lispobj *) (void *) &scavenger_hooks, 1);
}
@@ -7523,7 +7530,7 @@ garbage_collect_generation(int generation, int raise)
#ifdef GC_ASSERTIONS
#if defined(i386) || defined(__x86_64)
- invalid_stack_start = (void *) CONTROL_STACK_START;
+ invalid_stack_start = (void *) control_stack;
invalid_stack_end = (void *) &raise;
#else /* not i386 */
invalid_stack_start = (void *) &raise;
src/lisp/interrupt.c
--- a/src/lisp/interrupt.c
+++ b/src/lisp/interrupt.c
@@ -408,10 +408,10 @@ interrupt_maybe_gc(HANDLER_ARGS)
* Noise to install handlers. *
\****************************************************************/
-#if !(defined(i386) || defined(__x86_64))
-#define SIGNAL_STACK_SIZE SIGSTKSZ
-static char altstack[SIGNAL_STACK_SIZE];
-#endif
+//#if !(defined(i386) || defined(__x86_64))
+//#define SIGNAL_STACK_SIZE SIGSTKSZ
+char altstack[SIGNAL_STACK_SIZE];
+//#endif
void
interrupt_install_low_level_handler(int signal, void handler(HANDLER_ARGS))
@@ -434,7 +434,7 @@ interrupt_install_low_level_handler(int signal, void handler(HANDLER_ARGS))
if (signal == PROTECTION_VIOLATION_SIGNAL) {
stack_t sigstack;
-#if (defined( i386 ) || defined(__x86_64))
+#if defined(SIGNAL_STACK_START)
sigstack.ss_sp = (void *) SIGNAL_STACK_START;
#else
sigstack.ss_sp = (void *) altstack;
src/lisp/ppc-validate.h
--- a/src/lisp/ppc-validate.h
+++ b/src/lisp/ppc-validate.h
@@ -41,11 +41,17 @@
#define STATIC_SPACE_START (0x10000000)
#define STATIC_SPACE_SIZE (0x07ff8000) /* 128 MB, almost */
+#if 0
#define CONTROL_STACK_START (0x30000000)
+#endif
#define CONTROL_STACK_SIZE (0x07ff8000) /* 128 MB, almost */
+#if 0
#define CONTROL_STACK_END (CONTROL_STACK_START + control_stack_size)
+#endif
+#if 0
#define BINDING_STACK_START (0x38000000)
+#endif
#define BINDING_STACK_SIZE (0x07ff8000) /* 128 MB, almost */
#if 0
src/lisp/sparc-validate.h
--- a/src/lisp/sparc-validate.h
+++ b/src/lisp/sparc-validate.h
@@ -92,15 +92,22 @@
#define READ_ONLY_SPACE_START (SpaceStart_TargetReadOnly)
#define READ_ONLY_SPACE_SIZE ((2*MB_128) - SPARSE_BLOCK_SIZE) /* 256 MB - 32 KB, 256 MB max */
+#if 0
#define BINDING_STACK_START (0x20000000)
+#endif
+
#define BINDING_STACK_SIZE (MB_128 - SPARSE_BLOCK_SIZE) /* 128 MB - 32 KB, 128 MB max */
#define STATIC_SPACE_START (SpaceStart_TargetStatic)
#define STATIC_SPACE_SIZE ((2*MB_128) - SPARSE_BLOCK_SIZE) /* 256 MB - 32 KB, 256 MB max */
+#if 0
#define CONTROL_STACK_START (0x38000000)
+#endif
#define CONTROL_STACK_SIZE (MB_128 - SPARSE_BLOCK_SIZE) /* 128 MB - 32 KB, 128 MB max */
+#if 0
#define CONTROL_STACK_END (CONTROL_STACK_START + control_stack_size)
+#endif
#define DYNAMIC_0_SPACE_START (SpaceStart_TargetDynamic)
src/lisp/x86-assem.S
--- a/src/lisp/x86-assem.S
+++ b/src/lisp/x86-assem.S
@@ -143,7 +143,8 @@ FUNCDEF(call_into_lisp)
movl %eax, GNAME(foreign_function_call_active)
movl %esp,%ebx # remember current stack
- cmpl $CONTROL_STACK_START,%esp
+ cmpl GNAME(control_stack), %esp
+
jbe ChangeToLispStack
cmpl GNAME(control_stack_end), %esp
jbe OnLispStack
src/lisp/x86-validate-darwin.h
--- a/src/lisp/x86-validate-darwin.h
+++ b/src/lisp/x86-validate-darwin.h
@@ -18,10 +18,14 @@
#define STATIC_SPACE_START (SpaceStart_TargetStatic)
#define STATIC_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
+#if 0
#define BINDING_STACK_START (0x38000000)
+#endif
#define BINDING_STACK_SIZE (0x07fff000) /* 128MB - 1 page */
+#if 0
#define CONTROL_STACK_START (0x40000000)
+#endif
/*
* According to /usr/include/sys/signal.h, MINSIGSTKSZ is 32K and
@@ -29,7 +33,9 @@
*/
#define CONTROL_STACK_SIZE (0x07fdf000) /* 128MB - SIGSTKSZ - 1 page */
+#if 0
#define SIGNAL_STACK_START (0x47fe0000) /* One page past the end of the control stack */
+#endif
#define SIGNAL_STACK_SIZE SIGSTKSZ
#define DYNAMIC_0_SPACE_START (SpaceStart_TargetDynamic)
src/lisp/x86-validate-linux.h
--- a/src/lisp/x86-validate-linux.h
+++ b/src/lisp/x86-validate-linux.h
@@ -36,13 +36,19 @@
#define STATIC_SPACE_START (SpaceStart_TargetStatic)
#define STATIC_SPACE_SIZE (0x0ffff000) /* 256MB - 1 page */
+#if 0
#define BINDING_STACK_START (0x20000000)
+#endif
#define BINDING_STACK_SIZE (0x07fff000) /* 128MB - 1 page */
+#if 0
#define CONTROL_STACK_START 0x38000000
+#endif
#define CONTROL_STACK_SIZE (0x07fff000 - 8192)
+#if 0
#define SIGNAL_STACK_START CONTROL_STACK_END
+#endif
#define SIGNAL_STACK_SIZE SIGSTKSZ
#define DYNAMIC_0_SPACE_START (SpaceStart_TargetDynamic)