/*
- * Copyright (c) 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2008-2016 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
extern "C" {
#include <libkern/OSKextLibPrivate.h>
#include <libkern/mkext.h>
-
-#include <mach/host_special_ports.h>
-#include <kextd/kextd_mach.h>
-#include <kern/host.h>
};
#include <libkern/c++/OSContainers.h>
return OSKext::loadKextWithIdentifier(bundle_id);
}
+uint32_t OSKextGetLoadTagForIdentifier(const char * kextIdentifier);
/*********************************************************************
*********************************************************************/
uint32_t
#if PRAGMA_MARK
#pragma mark MIG Functions & Wrappers
#endif
-/*********************************************************************
-* This function is for use only by OSKextLib.cpp and OSKext.cpp.
-*
-* xxx - can we cache the kextd port or do we have to get it each time
-* xxx - in case it relaunches?
-*********************************************************************/
-extern void ipc_port_release_send(ipc_port_t);
-
-kern_return_t OSKextPingKextd(void)
-{
- kern_return_t result = KERN_FAILURE;
- mach_port_t kextd_port = IPC_PORT_NULL;
-
- result = host_get_kextd_port(host_priv_self(), &kextd_port);
- if (result != KERN_SUCCESS || !IPC_PORT_VALID(kextd_port)) {
- OSKextLog(/* kext */ NULL,
- kOSKextLogErrorLevel |
- kOSKextLogIPCFlag,
- "Can't get kextd port.");
- goto finish;
- }
-
- result = kextd_ping(kextd_port);
- if (result != KERN_SUCCESS) {
- OSKextLog(/* kext */ NULL,
- kOSKextLogErrorLevel |
- kOSKextLogIPCFlag,
- "kextd ping failed (0x%x).", (int)result);
- goto finish;
- }
-
-finish:
- if (IPC_PORT_VALID(kextd_port)) {
- ipc_port_release_send(kextd_port);
- }
-
- return result;
-}
-
/*********************************************************************
* IMPORTANT: Once we have done the vm_map_copyout(), we *must* return
* KERN_SUCCESS or the kernel map gets messed up (reason as yet
(void)vm_deallocate(kernel_map, (vm_offset_t)request, requestLengthIn);
}
if (response) {
- kmem_free(kernel_map, (vm_offset_t)response, responseLength);
+ /* 11981737 - clear uninitialized data in last page */
+ kmem_free(kernel_map, (vm_offset_t)response, round_page(responseLength));
}
if (logData) {
- kmem_free(kernel_map, (vm_offset_t)logData, logDataLength);
+ /* 11981737 - clear uninitialized data in last page */
+ kmem_free(kernel_map, (vm_offset_t)logData, round_page(logDataLength));
}
return result;
/*********************************************************************
* Gets the vm_map for the current kext
*********************************************************************/
-extern vm_offset_t sectPRELINKB;
-extern int sectSizePRELINK;
+extern vm_offset_t segPRELINKTEXTB;
+extern unsigned long segSizePRELINKTEXT;
extern int kth_started;
extern vm_map_t g_kext_map;
vm_map_t kext_map = NULL;
/* Set the vm map */
- if ((info->address >= sectPRELINKB) &&
- (info->address < (sectPRELINKB + sectSizePRELINK)))
+ if ((info->address >= segPRELINKTEXTB) &&
+ (info->address < (segPRELINKTEXTB + segSizePRELINKTEXT)))
{
kext_map = kernel_map;
} else {
return;
}
+#if CONFIG_DTRACE
+/*********************************************************************
+*********************************************************************/
+void OSKextRegisterKextsWithDTrace(void)
+{
+ OSKext::registerKextsWithDTrace();
+ return;
+}
+#endif /* CONFIG_DTRACE */
+
/*********************************************************************
*********************************************************************/
void kext_dump_panic_lists(int (*printf_func)(const char * fmt, ...))
void
kmod_panic_dump(vm_offset_t * addr, unsigned int cnt)
{
- extern int kdb_printf(const char *format, ...) __printflike(1,2);
+ extern int paniclog_append_noflush(const char *format, ...) __printflike(1,2);
+
+ OSKext::printKextsInBacktrace(addr, cnt, &paniclog_append_noflush, 0);
- OSKext::printKextsInBacktrace(addr, cnt, &kdb_printf,
- /* takeLock? */ false);
return;
}
/********************************************************************/
-void kmod_dump_log(vm_offset_t *addr, unsigned int cnt);
+void kmod_dump_log(vm_offset_t *addr, unsigned int cnt, boolean_t doUnslide);
void
kmod_dump_log(
vm_offset_t * addr,
- unsigned int cnt)
+ unsigned int cnt,
+ boolean_t doUnslide)
{
- OSKext::printKextsInBacktrace(addr, cnt, &printf, /* lock? */ true);
+ uint32_t flags = OSKext::kPrintKextsLock;
+ if (doUnslide) flags |= OSKext::kPrintKextsUnslide;
+ OSKext::printKextsInBacktrace(addr, cnt, &printf, flags);
}
+void *
+OSKextKextForAddress(const void *addr)
+{
+ return OSKext::kextForAddress(addr);
+}
+
+
/*********************************************************************
* Compatibility implementation for kmod_get_info() host_priv routine.
* Only supported on old 32-bit architectures.
*********************************************************************/
-#if __ppc__ || __i386__
-kern_return_t
-kext_get_kmod_info(
- kmod_info_array_t * kmod_list,
- mach_msg_type_number_t * kmodCount)
+
+#if PRAGMA_MARK
+#pragma mark Loaded Kext Summary
+#endif
+
+void
+OSKextLoadedKextSummariesUpdated(void)
{
- return OSKext::getKmodInfo(kmod_list, kmodCount);
+ // Do nothing.
}
-#endif /* __ppc__ || __i386__ */
};