- disable_preemption();
- va_start(listp, fmt);
- _doprnt_log(fmt, &listp, conslog_putc, 16);
- va_end(listp);
- enable_preemption();
+ struct console_printbuf_state info_data;
+ cpu_data_p = current_cpu_datap();
+
+ va_list ap;
+ va_copy(ap, ap_in);
+ /*
+ * for early boot printf()s console may not be setup,
+ * fallback to good old cnputc
+ */
+ if (cpu_data_p->cpu_console_buf != NULL) {
+ console_printbuf_state_init(&info_data, TRUE, TRUE);
+ __doprnt(fmt, ap, console_printbuf_putc, &info_data, 16, TRUE);
+ console_printbuf_clear(&info_data);
+ } else {
+ disable_preemption();
+ _doprnt_log(fmt, &ap, cons_putc_locked, 16);
+ enable_preemption();
+ }
+
+ va_end(ap);
+
+ os_log_with_args(OS_LOG_DEFAULT, OS_LOG_TYPE_DEFAULT, fmt, ap_in, caller);