comparison druntime/import/core/sys/osx/mach/thread_act.d @ 1458:e0b2d67cfe7c

Added druntime (this should be removed once it works).
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 02 Jun 2009 17:43:06 +0100
parents
children
comparison
equal deleted inserted replaced
1456:7b218ec1044f 1458:e0b2d67cfe7c
1 /**
2 * D header file for OSX.
3 *
4 * Copyright: Copyright Sean Kelly 2008 - 2009.
5 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a>.
6 * Authors: Sean Kelly
7 *
8 * Copyright Sean Kelly 2008 - 2009.
9 * Distributed under the Boost Software License, Version 1.0.
10 * (See accompanying file LICENSE_1_0.txt or copy at
11 * http://www.boost.org/LICENSE_1_0.txt)
12 */
13 module core.sys.osx.mach.thread_act;
14
15 public import core.sys.osx.mach.kern_return;
16 public import core.sys.osx.mach.port;
17
18 extern (C):
19
20 version( X86 )
21 version = i386;
22 version( X86_64 )
23 version = i386;
24 version( i386 )
25 {
26 alias mach_port_t thread_act_t;
27 alias void thread_state_t;
28 alias int thread_state_flavor_t;
29 alias natural_t mach_msg_type_number_t;
30
31 enum
32 {
33 x86_THREAD_STATE32 = 1,
34 x86_FLOAT_STATE32 = 2,
35 x86_EXCEPTION_STATE32 = 3,
36 x86_THREAD_STATE64 = 4,
37 x86_FLOAT_STATE64 = 5,
38 x86_EXCEPTION_STATE64 = 6,
39 x86_THREAD_STATE = 7,
40 x86_FLOAT_STATE = 8,
41 x86_EXCEPTION_STATE = 9,
42 x86_DEBUG_STATE32 = 10,
43 x86_DEBUG_STATE64 = 11,
44 x86_DEBUG_STATE = 12,
45 THREAD_STATE_NONE = 13,
46 }
47
48 struct x86_thread_state32_t
49 {
50 uint eax;
51 uint ebx;
52 uint ecx;
53 uint edx;
54 uint edi;
55 uint esi;
56 uint ebp;
57 uint esp;
58 uint ss;
59 uint eflags;
60 uint eip;
61 uint cs;
62 uint ds;
63 uint es;
64 uint fs;
65 uint gs;
66 }
67
68 struct x86_thread_state64_t
69 {
70 ulong rax;
71 ulong rbx;
72 ulong rcx;
73 ulong rdx;
74 ulong rdi;
75 ulong rsi;
76 ulong rbp;
77 ulong rsp;
78 ulong r8;
79 ulong r9;
80 ulong r10;
81 ulong r11;
82 ulong r12;
83 ulong r13;
84 ulong r14;
85 ulong r15;
86 ulong rip;
87 ulong rflags;
88 ulong cs;
89 ulong fs;
90 ulong gs;
91 }
92
93 struct x86_state_hdr_t
94 {
95 int flavor;
96 int count;
97 }
98
99 struct x86_thread_state_t
100 {
101 x86_state_hdr_t tsh;
102 union _uts
103 {
104 x86_thread_state32_t ts32;
105 x86_thread_state64_t ts64;
106 }
107 _uts uts;
108 }
109
110 enum : mach_msg_type_number_t
111 {
112 x86_THREAD_STATE32_COUNT = cast(mach_msg_type_number_t)( x86_thread_state32_t.sizeof / int.sizeof ),
113 x86_THREAD_STATE64_COUNT = cast(mach_msg_type_number_t)( x86_thread_state64_t.sizeof / int.sizeof ),
114 x86_THREAD_STATE_COUNT = cast(mach_msg_type_number_t)( x86_thread_state_t.sizeof / int.sizeof ),
115 }
116
117 alias x86_THREAD_STATE MACHINE_THREAD_STATE;
118 alias x86_THREAD_STATE_COUNT MACHINE_THREAD_STATE_COUNT;
119
120 mach_port_t mach_thread_self();
121 kern_return_t thread_suspend(thread_act_t);
122 kern_return_t thread_resume(thread_act_t);
123 kern_return_t thread_get_state(thread_act_t, thread_state_flavor_t, thread_state_t*, mach_msg_type_number_t*);
124 }