-#ifdef __APPLE_API_PRIVATE
-
-typedef kmod_info_t *kmod_info_array_t;
-
-#endif /* __APPLE_API_PRIVATE */
-
-#define KMOD_INFO_NAME kmod_info
-#define KMOD_INFO_VERSION 1
-
-#define KMOD_DECL(name, version) \
- static kmod_start_func_t name ## _module_start; \
- static kmod_stop_func_t name ## _module_stop; \
- kmod_info_t KMOD_INFO_NAME = { 0, KMOD_INFO_VERSION, -1, \
- { #name }, { version }, -1, 0, 0, 0, 0, \
- name ## _module_start, \
- name ## _module_stop };
-
-#define KMOD_EXPLICIT_DECL(name, version, start, stop) \
- kmod_info_t KMOD_INFO_NAME = { 0, KMOD_INFO_VERSION, -1, \
- { #name }, { version }, -1, 0, 0, 0, 0, \
- start, stop };
-
-// the following is useful for libaries that don't need their own start and stop functions
-#define KMOD_LIB_DECL(name, version) \
- kmod_info_t KMOD_INFO_NAME = { 0, KMOD_INFO_VERSION, -1, \
- { #name }, { version }, -1, 0, 0, 0, 0, \
- kmod_default_start, \
- kmod_default_stop };
-
-
-// *************************************************************************************
-// kmod kernel to user commands
-// *************************************************************************************
-
-#ifdef __APPLE_API_PRIVATE
-
-#define KMOD_LOAD_EXTENSION_PACKET 1
-#define KMOD_LOAD_WITH_DEPENDENCIES_PACKET 2
-
-// for generic packets
-#define KMOD_IOKIT_START_RANGE_PACKET 0x1000
-#define KMOD_IOKIT_END_RANGE_PACKET 0x1fff
-
-typedef struct kmod_load_extension_cmd {
- int type;
- char name[KMOD_MAX_NAME];
-} kmod_load_extension_cmd_t;
-
-typedef struct kmod_load_with_dependencies_cmd {
- int type;
- char name[KMOD_MAX_NAME];
- char dependencies[1][KMOD_MAX_NAME];
-} kmod_load_with_dependencies_cmd_t;
-
-typedef struct kmod_generic_cmd {
- int type;
- char data[1];
-} kmod_generic_cmd_t;
-
-#ifdef KERNEL_PRIVATE
-
-extern void kmod_init();
-
-extern kern_return_t kmod_create_fake(const char *name, const char *version);
-
-extern kmod_info_t *kmod_lookupbyname(const char * name);
-extern kmod_info_t *kmod_lookupbyid(kmod_t id);
-
-extern kmod_info_t *kmod_lookupbyname_locked(const char * name);
-extern kmod_info_t *kmod_lookupbyid_locked(kmod_t id);
-
-extern kern_return_t kmod_load_extension(char *name);
-extern kern_return_t kmod_load_extension_with_dependencies(char *name, char **dependencies);
-extern kern_return_t kmod_send_generic(int type, void *data, int size);
-
-extern kmod_start_func_t kmod_default_start;
-extern kmod_stop_func_t kmod_default_stop;
-
-extern kern_return_t kmod_initialize_cpp(kmod_info_t *info);
-extern kern_return_t kmod_finalize_cpp(kmod_info_t *info);
+/* A compatibility definition of kmod_info_t for 32-bit kexts.
+ */
+typedef struct kmod_info_32_v1 {
+ uint32_t next_addr;
+ int32_t info_version;
+ uint32_t id;
+ uint8_t name[KMOD_MAX_NAME];
+ uint8_t version[KMOD_MAX_NAME];
+ int32_t reference_count;
+ uint32_t reference_list_addr;
+ uint32_t address;
+ uint32_t size;
+ uint32_t hdr_size;
+ uint32_t start_addr;
+ uint32_t stop_addr;
+} kmod_info_32_v1_t;
+
+/* A compatibility definition of kmod_info_t for 64-bit kexts.
+ */
+typedef struct kmod_info_64_v1 {
+ uint64_t next_addr;
+ int32_t info_version;
+ uint32_t id;
+ uint8_t name[KMOD_MAX_NAME];
+ uint8_t version[KMOD_MAX_NAME];
+ int32_t reference_count;
+ uint64_t reference_list_addr;
+ uint64_t address;
+ uint64_t size;
+ uint64_t hdr_size;
+ uint64_t start_addr;
+ uint64_t stop_addr;
+} kmod_info_64_v1_t;
+
+#pragma pack()
+
+#if PRAGMA_MARK
+#pragma mark Kmod structure declaration macros
+#endif
+/***********************************************************************
+* Kmod structure declaration macros
+***********************************************************************/
+#define KMOD_INFO_NAME kmod_info
+#define KMOD_INFO_VERSION 1
+
+#define KMOD_DECL(name, version) \
+ static kmod_start_func_t name ## _module_start; \
+ static kmod_stop_func_t name ## _module_stop; \
+ kmod_info_t KMOD_INFO_NAME = { 0, KMOD_INFO_VERSION, -1U, \
+ { #name }, { version }, -1, 0, 0, 0, 0, \
+ name ## _module_start, \
+ name ## _module_stop };
+
+#define KMOD_EXPLICIT_DECL(name, version, start, stop) \
+ kmod_info_t KMOD_INFO_NAME = { 0, KMOD_INFO_VERSION, -1U, \
+ { #name }, { version }, -1, 0, 0, 0, 0, \
+ start, stop };
+
+#if PRAGMA_MARK
+#pragma mark Kernel private declarations
+#endif
+/***********************************************************************
+* Kernel private declarations.
+***********************************************************************/
+#ifdef KERNEL_PRIVATE
+
+/* Implementation now in libkern/OSKextLib.cpp. */
+extern void kmod_panic_dump(vm_offset_t * addr, unsigned int dump_cnt);
+
+#if CONFIG_DTRACE
+/*
+ * DTrace can take a flag indicating whether it should instrument
+ * probes immediately based on kernel symbols. This per kext
+ * flag overrides system mode in dtrace_modload().
+ */
+#define KMOD_DTRACE_FORCE_INIT 0x01
+#endif /* CONFIG_DTRACE */