]> git.saurik.com Git - apple/libplatform.git/blame - src/introspection/introspection_internal.h
libplatform-177.250.1.tar.gz
[apple/libplatform.git] / src / introspection / introspection_internal.h
CommitLineData
ada7c492
A
1#ifndef __PLATFORM_INTROSPECTION_INTERNAL_H__
2#define __PLATFORM_INTROSPECTION_INTERNAL_H__
3
4
5// Task Allocations (with 4K vm_page_size)
6//
7// Page 1 Page 2
8// +----------------+ <---- Head ----- +----------------+
9// | Header | ----- Next ----> | Header | ----- Next ----> ...
10// +----------------+ +----------------+
11// | Meta Data | | Thread[126] |
12// +----------------+ +----------------+
13// | Thread[0] | | Thread[127] |
14// +----------------+ +----------------+
15// ~ ... ~ ~ ... ~
16// +----------------+ +----------------+
17// | Thread[125] | | Thread[252] |
18// +----------------+ +----------------+
19//
20
21// 32 bytes
22struct platform_task_header_s {
23 // Linkage to other platform task pages.
24 platform_task_t head;
25 platform_task_t next;
26#ifdef __LP64__
27 uint64_t _reserved[2];
28#else
29 uint32_t _reserved[6];
30#endif
31};
32
33// 32 bytes
34struct platform_task_metadata_s {
35 platform_thread_t cursor;
36 task_t port;
37 uint32_t gen;
38 uint32_t is_64_bit:1, unused_flags:31;
39#ifdef __LP64__
40 uint32_t _reserved[3];
41#else
42 uint32_t _reserved[4];
43#endif
44};
45
46// 32 bytes
47struct platform_thread_s {
48 int32_t refcnt;
49 uint32_t gen;
50 platform_thread_id_t unique_id;
51 mach_vm_address_t pthread_addr;
52 thread_act_t act;
53 uint32_t _reserved;
54};
55
56struct platform_task_s {
57 struct platform_task_header_s header;
58 union {
59 struct platform_task_metadata_s metadata;
60 struct platform_thread_s threads[127];
61 };
62};
63
64#endif // __PLATFORM_INTROSPECTION_INTERNAL_H__