X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/4bd07ac2140668789aa3ee8ec4dde4a3e0a3bba5..4d15aeb193b2c68f1d38666c317f8d3734f5f083:/osfmk/i386/AT386/model_dep.c?ds=sidebyside diff --git a/osfmk/i386/AT386/model_dep.c b/osfmk/i386/AT386/model_dep.c index d4a138af8..ebb29b76b 100644 --- a/osfmk/i386/AT386/model_dep.c +++ b/osfmk/i386/AT386/model_dep.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2012 Apple Inc. All rights reserved. + * Copyright (c) 2000-2016 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -105,6 +105,7 @@ #include #include +#include #include #include #include @@ -123,6 +124,7 @@ #include #include +#include #if DEBUG #define DPRINTF(x...) kprintf(x) @@ -133,7 +135,6 @@ static void machine_conf(void); void panic_print_symbol_name(vm_address_t search); -extern boolean_t init_task_died; extern const char version[]; extern char osversion[]; extern int max_unsafe_quanta; @@ -169,7 +170,7 @@ typedef struct _cframe_t { static unsigned panic_io_port; static unsigned commit_paniclog_to_nvram; -unsigned int debug_boot_arg; +SECURITY_READ_ONLY_LATE(unsigned int) debug_boot_arg; /* * Backtrace a single frame. @@ -807,6 +808,7 @@ int reset_mem_on_reboot = 1; /* * Halt the system or reboot. */ +__attribute__((noreturn)) void halt_all_cpus(boolean_t reboot) { @@ -868,22 +870,17 @@ machine_halt_cpu(void) { pmCPUHalt(PM_HALT_DEBUG); } -static int pid_from_task(task_t task) -{ - int pid = -1; - - if (task->bsd_info) - pid = proc_pid(task->bsd_info); - - return pid; -} - void DebuggerWithContext( __unused unsigned int reason, __unused void *ctx, - const char *message) + const char *message, + uint64_t debugger_options_mask) { + if (debugger_options_mask != DEBUGGER_OPTION_NONE) { + kprintf("debugger options (%llx) not supported for desktop.\n", debugger_options_mask); + } + Debugger(message); } @@ -894,8 +891,7 @@ Debugger( unsigned long pi_size = 0; void *stackptr; int cn = cpu_number(); - task_t task = current_task(); - int task_pid = pid_from_task(task); + boolean_t old_doprnt_hide_pointers = doprnt_hide_pointers; hw_atomic_add(&debug_mode, 1); @@ -928,7 +924,7 @@ Debugger( __asm__ volatile("movq %%rbp, %0" : "=m" (stackptr)); /* Print backtrace - callee is internally synchronized */ - if (task_pid == 1 && (init_task_died)) { + if (strncmp(panicstr, LAUNCHD_CRASHED_PREFIX, strlen(LAUNCHD_CRASHED_PREFIX)) == 0) { /* Special handling of launchd died panics */ print_launchd_info(); } else { @@ -993,7 +989,7 @@ Debugger( } } - if (!panicDebugging) { + if (!panicDebugging && !kdp_has_polled_corefile()) { unsigned cnum; /* Clear the MP rendezvous function lock, in the event * that a panic occurred while in that codepath. @@ -1264,7 +1260,7 @@ out: if (PC != 0) kmod_panic_dump(&PC, 1); - panic_display_system_configuration(); + panic_display_system_configuration(FALSE); doprnt_hide_pointers = old_doprnt_hide_pointers; @@ -1344,9 +1340,10 @@ print_tasks_user_threads(task_t task) pmap = get_task_pmap(task); savestate = get_user_regs(thread); rbp = savestate->ss_64.rbp; + kdb_printf("\t0x%016llx\n", savestate->ss_64.isf.rip); print_one_backtrace(pmap, (vm_offset_t)rbp, cur_marker, TRUE, TRUE); kdb_printf("\n"); - } + } } void @@ -1461,10 +1458,8 @@ void print_launchd_info(void) print_thread_num_that_crashed(task); print_threads_registers(thread); print_tasks_user_threads(task); - kdb_printf("Mac OS version: %s\n", (osversion[0] != 0) ? osversion : "Not yet set"); - kdb_printf("Kernel version: %s\n", version); - panic_display_kernel_uuid(); - panic_display_model_name(); + + panic_display_system_configuration(TRUE); /* Release print backtrace lock, to permit other callers in the * event of panics on multiple processors.