]>
git.saurik.com Git - apple/dyld.git/blob - testing/kernel-cache-tests/auxkc-vtable-metaclass-patching/metaclass.h
6 #define APPLE_KEXT_OVERRIDE
8 #define OSDeclareCommonStructors(className, dispatch) \
10 static const OSMetaClass * const superClass; \
12 static const OSMetaClass * const metaClass; \
13 static class MetaClass : public OSMetaClass { \
16 virtual OSObject *alloc() const APPLE_KEXT_OVERRIDE;\
18 friend class className ::MetaClass; \
20 className (const OSMetaClass *); \
21 virtual ~ className () APPLE_KEXT_OVERRIDE;
23 #define _OSDeclareAbstractStructors(className, dispatch) \
24 OSDeclareCommonStructors(className, dispatch); \
26 className (void); /* Make primary constructor private in abstract */ \
29 #define OSDeclareAbstractStructorsWithDispatch(className) \
30 _OSDeclareAbstractStructors(className, dispatch)
32 #define OSMetaClassDefineReservedUsed(className, index)
33 #define OSMetaClassDefineReservedUnused(className, index) \
34 void className ::_RESERVED ## className ## index () { }
36 #define OSMetaClassDeclareReservedUsed(className, index)
37 #define OSMetaClassDeclareReservedUnused(className, index) \
39 virtual void _RESERVED ## className ## index ()
41 #define _OSDeclareDefaultStructors(className, dispatch) \
42 OSDeclareCommonStructors(className, dispatch); \
47 #define OSDeclareDefaultStructors(className) \
48 _OSDeclareDefaultStructors(className, )
50 #define OSDefineMetaClassWithInit(className, superclassName, init) \
51 /* Class global data */ \
52 className ::MetaClass className ::gMetaClass; \
53 const OSMetaClass * const className ::metaClass = \
54 & className ::gMetaClass; \
55 const OSMetaClass * const className ::superClass = \
56 & superclassName ::gMetaClass; \
57 /* Class member functions */ \
58 className :: className(const OSMetaClass *meta) \
59 : superclassName (meta) { } \
60 className ::~ className() { } \
61 /* The ::MetaClass constructor */ \
62 className ::MetaClass::MetaClass() { init; }
64 #define OSDefineDefaultStructors(className, superclassName) \
65 OSObject * className ::MetaClass::alloc() const { return new className; } \
66 className :: className () : superclassName (&gMetaClass) { }
68 #define OSDefineMetaClassAndStructorsWithInit(className, superclassName, init) \
69 OSDefineMetaClassWithInit(className, superclassName, init) \
70 OSDefineDefaultStructors(className, superclassName)
72 #define OSDefineMetaClassAndStructors(className, superclassName) \
73 OSDefineMetaClassAndStructorsWithInit(className, superclassName, )
79 virtual ~OSMetaClassBase();
81 // Add a placeholder we can find later
82 virtual void placeholder();
85 #ifdef METACLASS_BASE_USED
86 OSMetaClassDeclareReservedUsed(OSMetaClassBase
, 4);
87 virtual int metaclassBaseUsed4();
88 OSMetaClassDeclareReservedUsed(OSMetaClassBase
, 5);
89 virtual int metaclassBaseUsed5();
90 OSMetaClassDeclareReservedUsed(OSMetaClassBase
, 6);
91 virtual int metaclassBaseUsed6();
92 OSMetaClassDeclareReservedUsed(OSMetaClassBase
, 7);
93 virtual int metaclassBaseUsed7();
95 virtual void _RESERVEDOSMetaClassBase4();
96 virtual void _RESERVEDOSMetaClassBase5();
97 virtual void _RESERVEDOSMetaClassBase6();
98 virtual void _RESERVEDOSMetaClassBase7();
102 class OSMetaClass
: public OSMetaClassBase
{
104 virtual ~OSMetaClass();
105 // Virtual Padding functions for MetaClass's
106 OSMetaClassDeclareReservedUnused(OSMetaClass
, 0);
107 OSMetaClassDeclareReservedUnused(OSMetaClass
, 1);
108 OSMetaClassDeclareReservedUnused(OSMetaClass
, 2);
109 OSMetaClassDeclareReservedUnused(OSMetaClass
, 3);
110 OSMetaClassDeclareReservedUnused(OSMetaClass
, 4);
111 OSMetaClassDeclareReservedUnused(OSMetaClass
, 5);
112 OSMetaClassDeclareReservedUnused(OSMetaClass
, 6);
113 OSMetaClassDeclareReservedUnused(OSMetaClass
, 7);
116 #endif // METACLASS_H