X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/3903760236c30e3b5ace7a4eefac3a269d68957c..4d15aeb193b2c68f1d38666c317f8d3734f5f083:/osfmk/console/serial_console.c?ds=sidebyside diff --git a/osfmk/console/serial_console.c b/osfmk/console/serial_console.c index ec139794c..358fbb8ed 100644 --- a/osfmk/console/serial_console.c +++ b/osfmk/console/serial_console.c @@ -44,6 +44,7 @@ #include #include #include +#include @@ -109,7 +110,7 @@ extern void serial_putc(char); static void _serial_putc(int, int, int); -struct console_ops cons_ops[] = { +SECURITY_READ_ONLY_EARLY(struct console_ops) cons_ops[] = { { .putc = _serial_putc, .getc = _serial_getc, }, @@ -118,7 +119,7 @@ struct console_ops cons_ops[] = { }, }; -uint32_t nconsops = (sizeof cons_ops / sizeof cons_ops[0]); +SECURITY_READ_ONLY_EARLY(uint32_t) nconsops = (sizeof cons_ops / sizeof cons_ops[0]); uint32_t cons_ops_index = VC_CONS_OPS; @@ -243,8 +244,14 @@ _cnputs(char * c, int size) /* The console device output routines are assumed to be * non-reentrant. */ +#ifdef __x86_64__ + uint32_t lock_timeout_ticks = UINT32_MAX; +#else + uint32_t lock_timeout_ticks = LockTimeOut; +#endif + mp_disable_preemption(); - if (!hw_lock_to(&cnputc_lock, LockTimeOut)) { + if (!hw_lock_to(&cnputc_lock, lock_timeout_ticks)) { /* If we timed out on the lock, and we're in the debugger, * copy lock data for debugging and break the lock. */ @@ -581,10 +588,3 @@ vcgetc(__unused int l, __unused int u, __unused boolean_t wait, __unused boolean return 0; } -/* So we can re-write the serial device functions at boot-time */ -void -console_set_serial_ops(struct console_ops * newops) -{ - cons_ops[SERIAL_CONS_OPS] = *newops; -} -