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_DARWIN_STOP_WORLD_H
19 #define GC_DARWIN_STOP_WORLD_H
20 
21 #if !defined(GC_DARWIN_THREADS)
22 # error darwin_stop_world.h included without GC_DARWIN_THREADS defined
23 #endif
24 
25 #include <mach/mach.h>
26 #include <mach/thread_act.h>
27 
28 EXTERN_C_BEGIN
29 
30 struct thread_stop_info {
31   mach_port_t mach_thread;
32   ptr_t stack_ptr; /* Valid only when thread is in a "blocked" state.   */
33 };
34 
35 #ifndef DARWIN_DONT_PARSE_STACK
36   GC_INNER ptr_t GC_FindTopOfStack(unsigned long);
37 #endif
38 
39 #ifdef MPROTECT_VDB
40   GC_INNER void GC_mprotect_stop(void);
41   GC_INNER void GC_mprotect_resume(void);
42 # ifndef GC_NO_THREADS_DISCOVERY
43     GC_INNER void GC_darwin_register_mach_handler_thread(mach_port_t thread);
44 # endif
45 #endif
46 
47 #if defined(PARALLEL_MARK) && !defined(GC_NO_THREADS_DISCOVERY)
48   GC_INNER GC_bool GC_is_mach_marker(thread_act_t);
49 #endif
50 
51 EXTERN_C_END
52 
53 #endif
54