-
Notifications
You must be signed in to change notification settings - Fork 517
/
Copy pathclass-structures.h
92 lines (76 loc) · 2.03 KB
/
class-structures.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Structures to help us define fake classes in tests.
#include <ptrauth.h>
struct ObjCClass {
struct ObjCClass * __ptrauth_objc_isa_pointer isa;
struct ObjCClass * __ptrauth_objc_super_pointer superclass;
void *cachePtr;
uintptr_t zero;
void *__ptrauth_objc_class_ro data;
};
struct ObjCClass_ro {
uint32_t flags;
uint32_t instanceStart;
uint32_t instanceSize;
#ifdef __LP64__
uint32_t reserved;
#endif
union {
const uint8_t * ivarLayout;
struct ObjCClass * nonMetaClass;
};
const char * name;
struct ObjCMethodList * __ptrauth_objc_method_list_pointer baseMethodList;
struct protocol_list_t * baseProtocols;
const struct ivar_list_t * ivars;
const uint8_t * weakIvarLayout;
struct property_list_t *baseProperties;
};
struct ObjCMethod {
char *name;
char *type;
IMP imp;
};
struct ObjCMethodList {
uint32_t sizeAndFlags;
uint32_t count;
struct ObjCMethod methods[];
};
struct ObjCMethodSmall {
int32_t nameOffset;
int32_t typeOffset;
int32_t impOffset;
};
struct ObjCMethodListSmall {
uint32_t sizeAndFlags;
uint32_t count;
struct ObjCMethodSmall methods[];
};
extern struct ObjCClass OBJC_METACLASS_$_NSObject;
extern struct ObjCClass OBJC_CLASS_$_NSObject;
#define RO_META (1<<0)
#if __LP64__
#define PTR ".quad "
#else
#define PTR ".long "
#endif
#define SELREF(name) \
asm(".section __TEXT,__cstring\n" \
"_" #name "Selector:\n" \
".asciz \"" #name "\"\n" \
".section __DATA,__objc_selrefs,literal_pointers,no_dead_strip\n" \
"_" #name "Ref:\n" \
PTR "_" #name "Selector\n" \
);
#define SMALL_METHOD_LIST(name, count, methods) \
extern struct ObjCMethodListSmall name; \
asm(".text\n" \
".p2align 2\n" \
"_" #name ":\n" \
" .long 12 | 0x80000000" \
"\n .long " #count "\n" \
methods \
);
#define SMALL_METHOD(name, types, imp) \
".long _" #name "Ref - .\n" \
".long _" #types " - .\n" \
".long _" #imp " - .\n"