aboutsummaryrefslogtreecommitdiff
path: root/include/xglIcd.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/xglIcd.h')
-rw-r--r--include/xglIcd.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/xglIcd.h b/include/xglIcd.h
new file mode 100644
index 00000000..3efffe6d
--- /dev/null
+++ b/include/xglIcd.h
@@ -0,0 +1,32 @@
+#ifndef XGLICD_H
+#define XGLICD_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "xglPlatform.h"
+
+/*
+ * The ICD must reserve space for a pointer for the loader's dispatch
+ * table, at the start of <each object>.
+ * The ICD must initialize this variable using the SET_LOADER_MAGIC_VALUE macro.
+ */
+
+#define ICD_LOADER_MAGIC 0x01CDC0DE
+
+typedef union _XGL_LOADER_DATA {
+ uint32_t loaderMagic;
+ void *loaderData;
+} XGL_LOADER_DATA;
+
+STATIC_INLINE void set_loader_magic_value(void *pNewObject) {
+ XGL_LOADER_DATA *loader_info = (XGL_LOADER_DATA *) pNewObject;
+ loader_info->loaderMagic = ICD_LOADER_MAGIC;
+}
+
+STATIC_INLINE bool valid_loader_magic_value(void *pNewObject) {
+ const XGL_LOADER_DATA *loader_info = (XGL_LOADER_DATA *) pNewObject;
+ return loader_info->loaderMagic == ICD_LOADER_MAGIC;
+}
+
+#endif // XGLICD_H
+