| 1 |
/* |
| 2 |
* Copyright (c) 1994 by Xerox Corporation. All rights reserved. |
| 3 |
* Copyright (c) 1996 by Silicon Graphics. All rights reserved. |
| 4 |
* Copyright (c) 1998 by Fergus Henderson. All rights reserved. |
| 5 |
* Copyright (c) 2000-2009 by Hewlett-Packard Development Company. |
| 6 |
* All rights reserved. |
| 7 |
* |
| 8 |
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED |
| 9 |
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK. |
| 10 |
* |
| 11 |
* Permission is hereby granted to use or copy this program |
| 12 |
* for any purpose, provided the above notices are retained on all copies. |
| 13 |
* Permission to modify the code and to distribute modified code is granted, |
| 14 |
* provided the above notices are retained, and a notice that the code was |
| 15 |
* modified is included with the above copyright notice. |
| 16 |
*/ |
| 17 |
|
| 18 |
#ifndef GC_PTHREAD_STOP_WORLD_H |
| 19 |
#define GC_PTHREAD_STOP_WORLD_H |
| 20 |
|
| 21 |
EXTERN_C_BEGIN |
| 22 |
|
| 23 |
struct thread_stop_info { |
| 24 |
# if !defined(GC_OPENBSD_UTHREADS) && !defined(NACL) \ |
| 25 |
&& !defined(PLATFORM_STOP_WORLD) && !defined(SN_TARGET_PSP2) |
| 26 |
volatile AO_t last_stop_count; |
| 27 |
/* The value of GC_stop_count when the thread */ |
| 28 |
/* last successfully handled a suspend signal. */ |
| 29 |
# ifdef GC_ENABLE_SUSPEND_THREAD |
| 30 |
volatile AO_t ext_suspend_cnt; |
| 31 |
/* An odd value means thread was suspended */ |
| 32 |
/* externally. Incremented on every call of */ |
| 33 |
/* GC_suspend_thread() and GC_resume_thread(). */ |
| 34 |
/* Updated with the GC lock held, but could be */ |
| 35 |
/* read from a signal handler. */ |
| 36 |
# endif |
| 37 |
# endif |
| 38 |
|
| 39 |
ptr_t stack_ptr; /* Valid only when stopped. */ |
| 40 |
|
| 41 |
# ifdef NACL |
| 42 |
/* Grab NACL_GC_REG_STORAGE_SIZE pointers off the stack when */ |
| 43 |
/* going into a syscall. 20 is more than we need, but it's an */ |
| 44 |
/* overestimate in case the instrumented function uses any callee */ |
| 45 |
/* saved registers, they may be pushed to the stack much earlier. */ |
| 46 |
/* Also, on x64 'push' puts 8 bytes on the stack even though */ |
| 47 |
/* our pointers are 4 bytes. */ |
| 48 |
# ifdef ARM32 |
| 49 |
/* Space for r4-r8, r10-r12, r14. */ |
| 50 |
# define NACL_GC_REG_STORAGE_SIZE 9 |
| 51 |
# else |
| 52 |
# define NACL_GC_REG_STORAGE_SIZE 20 |
| 53 |
# endif |
| 54 |
ptr_t reg_storage[NACL_GC_REG_STORAGE_SIZE]; |
| 55 |
# elif defined(PLATFORM_HAVE_GC_REG_STORAGE_SIZE) |
| 56 |
word registers[PLATFORM_GC_REG_STORAGE_SIZE]; /* used externally */ |
| 57 |
# endif |
| 58 |
}; |
| 59 |
|
| 60 |
GC_INNER void GC_stop_init(void); |
| 61 |
|
| 62 |
EXTERN_C_END |
| 63 |
|
| 64 |
#endif |