Lines Matching refs:kmod_info
266 /* Set up a fake kmod_info struct for the kernel.
271 * We don't do much else with the kerne's kmod_info; we never
274 * For that matter, we don't do much with kmod_info structs
527 #define notifyKextLoadObservers(kext, kmod_info) \
529 IOStatistics::onKextLoad(kext, kmod_info); \
549 #define notifyKextLoadObservers(kext, kmod_info)
664 sKernelKext->kmod_info = &g_kernel_kmod_info;
697 * the kernel kext doesn't have a kmod_info struct. copyInfo()
733 notifyKextLoadObservers(sKernelKext, sKernelKext->kmod_info);
1496 "Kext %s can't find prelinked kext kmod_info address.",
1502 kmod_info = (kmod_info_t *) (intptr_t) (addressNum->unsigned64BitValue() + vm_kernel_slide);
1503 kmod_info->address += vm_kernel_slide;
1505 IOLog("kaslr: unslid 0x%lx slid 0x%lx - kmod_info \n",
1506 (unsigned long)VM_KERNEL_UNSLIDE(kmod_info),
1507 (unsigned long)kmod_info);
1508 IOLog("kaslr: unslid 0x%lx slid 0x%lx - kmod_info->address \n",
1509 (unsigned long)VM_KERNEL_UNSLIDE(kmod_info->address),
1510 (unsigned long)kmod_info->address);
2250 if (isInterface() && kmod_info) {
2251 kfree(kmod_info, sizeof(kmod_info_t));
3961 /* If we have a kmod_info struct, calculated the wired size
3964 if (kmod_info) {
3965 *wiredSize = *loadSize - kmod_info->hdr_size;
4470 /* Add the kext to the list of loaded kexts and update the kmod_info
4484 kmod_info->next = lastLoadedKext->kmod_info;
4487 notifyKextLoadObservers(this, kmod_info);
4494 * (The OSKext object representing the kernel doesn't even have a kmod_info
4498 kmod = kmod_info;
4759 new_kextsize = round_page(kmod_info->size - reloc_size);
4761 if ((kmod_info->size - new_kextsize) > PAGE_SIZE) {
4762 vm_offset_t endofkext = kmod_info->address + kmod_info->size;
4763 vm_offset_t new_endofkext = kmod_info->address + new_kextsize;
4792 new_osdata = OSData::withBytesNoCopy((void *)kmod_info->address, new_kextsize);
4796 kmod_info->size = new_kextsize;
5005 kxldHeaderPtr, &kmod_info);
5015 (u_char **)kxldHeaderPtr, (kxld_addr_t *)&kmod_info);
5033 flush_dcache(kmod_info->address, kmod_info->size, false);
5034 invalidate_icache(kmod_info->address, kmod_info->size, false);
5040 /* Whip up a fake kmod_info entry for the interface kext.
5042 kmod_info = (kmod_info_t *)kalloc(sizeof(kmod_info_t));
5043 if (!kmod_info) {
5048 /* A pseudokext has almost nothing in its kmod_info struct.
5050 bzero(kmod_info, sizeof(kmod_info_t));
5052 kmod_info->info_version = KMOD_INFO_VERSION;
5061 kmod_info->id = loadTag = sNextLoadTag++;
5062 kmod_info->reference_count = 0; // KMOD_DECL... sets it to -1 (invalid).
5065 * resident inside the kmod_info.
5068 strlcpy(kmod_info->name, string, sizeof(kmod_info->name));
5071 strlcpy(kmod_info->version, string, sizeof(kmod_info->version));
5073 /* Add the dependencies' kmod_info structs as kmod_references.
5077 kmod_info->reference_list = (kmod_reference_t *)kalloc(
5079 if (!kmod_info->reference_list) {
5083 bzero(kmod_info->reference_list,
5086 kmod_reference_t * ref = &(kmod_info->reference_list[refIndex]);
5088 ref->info = refKext->kmod_info;
5092 ref->next = kmod_info->reference_list + refIndex + 1;
5102 kmod_info->name,
5103 (unsigned)kmod_info->size / PAGE_SIZE,
5104 (unsigned long)VM_KERNEL_UNSLIDE(kmod_info->address),
5105 (unsigned)kmod_info->id);
5146 if (kmod_info && kmod_info->reference_list) {
5147 kfree(kmod_info->reference_list,
5151 kfree(kmod_info, sizeof(kmod_info_t));
5153 kmod_info = NULL;
5172 kernel_mach_header_t * machhdr = (kernel_mach_header_t *)kmod_info->address;
5198 if (round_page(kmod_info->address + kmod_info->size) !=
5207 kextsize = kmod_info->size - linkeditsize;
5210 data = OSData::withBytesNoCopy((void *)kmod_info->address, kextsize);
5217 kmod_info->size = kextsize;
5281 extern int (*dtrace_modload)(struct kmod_info *, uint32_t);
5282 extern int (*dtrace_modunload)(struct kmod_info *);
5300 (void)(*dtrace_modload)(kmod_info, modflag);
5315 (void)(*dtrace_modunload)(kmod_info);
5385 if (!kmod_info->address && !kmod_info->size) {
5391 kext_map = kext_get_vm_map(kmod_info);
5398 result = OSKext_protect(kext_map, kmod_info->address,
5399 kmod_info->address + kmod_info->hdr_size, VM_PROT_READ, TRUE);
5405 seg = firstsegfromheader((kernel_mach_header_t *)kmod_info->address);
5439 seg = nextsegfromheader((kernel_mach_header_t *) kmod_info->address, seg);
5476 /* Verify that the kmod_info and start/stop pointers are non-NULL.
5478 if (!kmod_info) {
5482 "Kext %s - NULL kmod_info pointer.",
5489 address = (mach_vm_address_t)kmod_info->start;
5491 address = (mach_vm_address_t)kmod_info->stop;
5504 kext_map = kext_get_vm_map(kmod_info);
5509 if (address < kmod_info->address + kmod_info->hdr_size ||
5510 kmod_info->address + kmod_info->size <= address)
5521 (void *)VM_KERNEL_UNSLIDE(kmod_info->address),
5522 (void *)(VM_KERNEL_UNSLIDE(kmod_info->address) + kmod_info->size));
5563 seg = firstsegfromheader((kernel_mach_header_t *)kmod_info->address);
5570 seg = nextsegfromheader((kernel_mach_header_t *) kmod_info->address, seg);
5645 startfunc = kmod_info->start;
5694 result = OSRuntimeInitializeCPP(kmod_info, NULL);
5712 result = startfunc(kmod_info, kmodStartData);
5716 (void) OSRuntimeFinalizeCPP(kmod_info, NULL);
5841 stopfunc = kmod_info->stop;
5851 result = stopfunc(kmod_info, /* userData */ NULL);
5854 result = OSRuntimeFinalizeCPP(kmod_info, NULL);
5994 nextKext->kmod_info->next = gapKext->kmod_info;
5997 nextKext->kmod_info->next = NULL;
6003 kmod = lastKext->kmod_info;
6014 if (num_kmod_refs && kmod_info && kmod_info->reference_list) {
6016 kmod_reference_t * ref = &(kmod_info->reference_list[refIndex]);
6019 kfree(kmod_info->reference_list,
6035 vm_map_t kext_map = kext_get_vm_map(kmod_info);
6053 seg = firstsegfromheader((kernel_mach_header_t *)kmod_info->address);
6069 seg = nextsegfromheader((kernel_mach_header_t *) kmod_info->address, seg);
6076 /* An interface kext has a fake kmod_info that was allocated,
6080 kfree(kmod_info, sizeof(kmod_info_t));
6083 kmod_info = NULL;
8048 /* If we have a kmod_info struct, calculated the wired size
8051 if (kmod_info) {
8052 wiredSize = loadSize - kmod_info->hdr_size;
8674 if ((kmod_info->address <= callbackAddress) &&
8675 (callbackAddress < (kmod_info->address + kmod_info->size))) {
8724 if ((kmod_info->address <= callbackAddress) &&
8725 (callbackAddress < (kmod_info->address + kmod_info->size))) {
10043 kmod_info_t * kmod_info,
10047 kmod_info_t * kmod_info,
10052 compactIdentifier(kmod_info->name, identPlusVers, NULL);
10056 result = strlcat(identPlusVers, kmod_info->version, KMOD_MAX_NAME);
10109 kmod_info_t * kmod_info = theKext->kmod_info;
10113 match = !strncmp(kmod_info->name, prefix, strnlen(prefix, KMOD_MAX_NAME));
10126 if (!kmod_info ||
10127 !pmap_find_phys(kernel_pmap, (addr64_t)((uintptr_t)kmod_info))) {
10129 printf("kext scan stopped due to missing kmod_info page: %p\n",
10130 kmod_info);
10135 identPlusVersLength = assemble_identifier_and_version(kmod_info,
10224 if (!kmod_info) {
10228 len = assemble_identifier_and_version(kmod_info,
10237 last_loaded_address = (void *)kmod_info->address;
10238 last_loaded_size = kmod_info->size;
10242 last_unloaded_address = (void *)kmod_info->address;
10243 last_unloaded_size = kmod_info->size;
10411 summary->address = kmod_info->address;
10412 summary->size = kmod_info->size;
10414 summary->loadTag = kmod_info->id;
10416 summary->reference_list = (uint64_t) kmod_info->reference_list;
10462 /* Copy each kmod_info struct sequentially into the data buffer.
10478 /* Now add references after the kmod_info structs in the same buffer.
10479 * Update each kmod_info with the ref_count so we can associate
10480 * references with kmod_info structs.
10489 /* Note the last kmod_info in the data buffer has its next == 0.
10498 /* Stuff the # of refs into the 'reference_list' field of the kmod_info