CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
76 lines
2.3 KiB
C
76 lines
2.3 KiB
C
#ifndef _OS_BASE_H
|
|
#define _OS_BASE_H
|
|
|
|
#define OS_CONSUME __attribute__((os_consumed))
|
|
#define OS_RETURNS_RETAINED __attribute__((os_returns_retained))
|
|
#define OS_RETURNS_RETAINED_ON_ZERO __attribute__((os_returns_retained_on_zero))
|
|
#define OS_RETURNS_RETAINED_ON_NONZERO __attribute__((os_returns_retained_on_non_zero))
|
|
#define OS_RETURNS_NOT_RETAINED __attribute__((os_returns_not_retained))
|
|
#define OS_CONSUMES_THIS __attribute__((os_consumes_this))
|
|
|
|
#define OSTypeID(type) (type::metaClass)
|
|
|
|
#define OSDynamicCast(type, inst) \
|
|
((type *) OSMetaClassBase::safeMetaCast((inst), OSTypeID(type)))
|
|
#define OSRequiredCast(type, inst) \
|
|
((type *) OSMetaClassBase::requiredMetaCast((inst), OSTypeID(type)))
|
|
|
|
#define OSTypeAlloc(type) ((type *) ((type::metaClass)->alloc()))
|
|
|
|
using size_t = decltype(sizeof(int));
|
|
|
|
typedef int kern_return_t;
|
|
struct IORPC {};
|
|
|
|
struct OSMetaClass;
|
|
|
|
struct OSMetaClassBase {
|
|
static OSMetaClassBase *safeMetaCast(const OSMetaClassBase *inst,
|
|
const OSMetaClass *meta);
|
|
static OSMetaClassBase *requiredMetaCast(const OSMetaClassBase *inst,
|
|
const OSMetaClass *meta);
|
|
|
|
OSMetaClassBase *metaCast(const char *toMeta);
|
|
|
|
virtual void retain() const;
|
|
virtual void release() const;
|
|
|
|
virtual void taggedRetain(const void * tag = nullptr) const;
|
|
virtual void taggedRelease(const void * tag = nullptr) const;
|
|
|
|
virtual void free();
|
|
virtual ~OSMetaClassBase(){};
|
|
|
|
kern_return_t Invoke(IORPC invoke);
|
|
};
|
|
|
|
typedef kern_return_t (*OSDispatchMethod)(OSMetaClassBase *self,
|
|
const IORPC rpc);
|
|
|
|
struct OSObject : public OSMetaClassBase {
|
|
virtual ~OSObject(){}
|
|
|
|
unsigned int foo() { return 42; }
|
|
|
|
virtual OS_RETURNS_NOT_RETAINED OSObject *identity();
|
|
|
|
static OSObject *generateObject(int);
|
|
|
|
static OSObject *getObject();
|
|
static OSObject *GetObject();
|
|
|
|
static void * operator new(size_t size);
|
|
|
|
static const OSMetaClass * const metaClass;
|
|
};
|
|
|
|
struct OSMetaClass : public OSMetaClassBase {
|
|
virtual OSObject * alloc() const;
|
|
static OSObject * allocClassWithName(const char * name);
|
|
static const OSMetaClass *copyMetaClassWithName(const char *name);
|
|
void releaseMetaClass() const;
|
|
virtual ~OSMetaClass(){}
|
|
};
|
|
|
|
#endif /* _OS_BASE_H */
|