#include <IOKit/IOStatisticsPrivate.h>
#include <os/log_private.h>
#include <sys/msgbuf.h>
+#include <console/serial_protos.h>
#if IOKITSTATS
&gIOKitPageableSpace.maps[0].address,
kIOPageableMapSize,
TRUE,
- VM_FLAGS_ANYWHERE | VM_MAKE_TAG(VM_KERN_MEMORY_IOKIT),
+ VM_FLAGS_ANYWHERE,
+ VM_MAP_KERNEL_FLAGS_NONE,
+ VM_KERN_MEMORY_IOKIT,
&gIOKitPageableSpace.maps[0].map);
if (ret != KERN_SUCCESS)
panic("failed to allocate iokit pageable map\n");
bzero(&hdr->tracking, sizeof(hdr->tracking));
hdr->tracking.address = ~(((uintptr_t) address) + sizeofIOLibMallocHeader);
hdr->tracking.size = size;
- IOTrackingAdd(gIOMallocTracking, &hdr->tracking.tracking, size, true);
+ IOTrackingAdd(gIOMallocTracking, &hdr->tracking.tracking, size, true, VM_KERN_MEMORY_NONE);
}
#endif
address = (typeof(address)) (((uintptr_t) address) + sizeofIOLibMallocHeader);
bzero(&hdr->tracking, sizeof(hdr->tracking));
hdr->tracking.address = ~address;
hdr->tracking.size = size;
- IOTrackingAdd(gIOMallocTracking, &hdr->tracking.tracking, size, true);
+ IOTrackingAdd(gIOMallocTracking, &hdr->tracking.tracking, size, true, VM_KERN_MEMORY_NONE);
}
#endif
} else
#endif
}
+#if __arm__ || __arm64__
+extern unsigned long gPhysBase, gPhysSize;
+#endif
mach_vm_address_t
IOKernelAllocateWithPhysicalRestrict(mach_vm_size_t size, mach_vm_address_t maxPhys,
if (!contiguous)
{
+#if __arm__ || __arm64__
+ if (maxPhys >= (mach_vm_address_t)(gPhysBase + gPhysSize))
+ {
+ maxPhys = 0;
+ }
+ else
+#endif
if (maxPhys <= 0xFFFFFFFF)
{
maxPhys = 0;
bzero(&hdr->tracking, sizeof(hdr->tracking));
hdr->tracking.address = ~address;
hdr->tracking.size = size;
- IOTrackingAdd(gIOMallocTracking, &hdr->tracking.tracking, size, true);
+ IOTrackingAdd(gIOMallocTracking, &hdr->tracking.tracking, size, true, VM_KERN_MEMORY_NONE);
}
#endif
} else
&min,
segSize,
TRUE,
- VM_FLAGS_ANYWHERE | VM_MAKE_TAG(VM_KERN_MEMORY_IOKIT),
+ VM_FLAGS_ANYWHERE,
+ VM_MAP_KERNEL_FLAGS_NONE,
+ VM_KERN_MEMORY_IOKIT,
&map);
if( KERN_SUCCESS != kr) {
lck_mtx_unlock( gIOKitPageableSpace.lock );
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-static void _iolog_consputc(int ch, void *arg __unused)
-{
- cons_putc_locked(ch);
-}
-
-static void _IOLogv(const char *format, va_list ap, void *caller);
+static void _IOLogv(const char *format, va_list ap, void *caller) __printflike(1,0);
__attribute__((noinline,not_tail_called))
void IOLog(const char *format, ...)
void _IOLogv(const char *format, va_list ap, void *caller)
{
va_list ap2;
-
- /* Ideally not called at interrupt context or with interrupts disabled. Needs further validate */
- /* assert(TRUE == ml_get_interrupts_enabled()); */
+ struct console_printbuf_state info_data;
+ console_printbuf_state_init(&info_data, TRUE, TRUE);
va_copy(ap2, ap);
os_log_with_args(OS_LOG_DEFAULT, OS_LOG_TYPE_DEFAULT, format, ap, caller);
- __doprnt(format, ap2, _iolog_consputc, NULL, 16, TRUE);
+ __doprnt(format, ap2, console_printbuf_putc, &info_data, 16, TRUE);
+ console_printbuf_clear(&info_data);
va_end(ap2);
+
+ assertf(ml_get_interrupts_enabled() || ml_is_quiescing() || debug_mode_active() || !gCPUsRunning, "IOLog called with interrupts disabled");
}
#if !__LP64__