diff options
author | Zoltan Varga <vargaz@gmail.com> | 2012-05-22 03:02:05 +0400 |
---|---|---|
committer | Zoltan Varga <vargaz@gmail.com> | 2012-05-22 03:02:27 +0400 |
commit | e7f3bbad80fe04bea1a055e870d856a22003d34d (patch) | |
tree | 47331d7dc31f24c64a92516004cb249b4a2e85df /libgc/include | |
parent | 9755d7fdb23c5bae33a85835083834fef57748ff (diff) |
Fix altstack support in libgc by registering the bounds of the normal stack and the altstack with it.
Diffstat (limited to 'libgc/include')
-rw-r--r-- | libgc/include/gc.h | 6 | ||||
-rw-r--r-- | libgc/include/private/pthread_support.h | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/libgc/include/gc.h b/libgc/include/gc.h index d77de303e0d..7e5fd2ed840 100644 --- a/libgc/include/gc.h +++ b/libgc/include/gc.h @@ -841,6 +841,12 @@ GC_API GC_PTR GC_is_valid_displacement GC_PROTO((GC_PTR p)); /* Returns 1 if the calling thread is registered with the GC, 0 otherwise */ GC_API int GC_thread_is_registered GC_PROTO((void)); +/* Notify the collector about the stack and the altstack of the current thread */ +/* STACK/STACK_SIZE is used to determine the stack dimensions when a thread is + * suspended while it is on an altstack. + */ +GC_API void GC_register_altstack GC_PROTO((void *stack, int stack_size, void *altstack, int altstack_size)); + /* Safer, but slow, pointer addition. Probably useful mainly with */ /* a preprocessor. Useful only for heap pointers. */ #ifdef GC_DEBUG diff --git a/libgc/include/private/pthread_support.h b/libgc/include/private/pthread_support.h index 076a6d26ff9..4046a2666b8 100644 --- a/libgc/include/private/pthread_support.h +++ b/libgc/include/private/pthread_support.h @@ -47,6 +47,10 @@ typedef struct GC_Thread_Rep { /* not need to be sent a signal to stop */ /* it. */ ptr_t stack_end; /* Cold end of the stack. */ + ptr_t altstack; /* The start of the altstack if there is one, NULL otherwise */ + int altstack_size; /* The size of the altstack if there is one */ + ptr_t stack; /* The start of the normal stack */ + int stack_size; /* The size of the normal stack */ # ifdef IA64 ptr_t backing_store_end; ptr_t backing_store_ptr; |