call_panic_shell (void) { int d; static bool flag_free = false, flag_shell = false; ulong cr0; if (config.vmm.panic_reboot) { ttylog_copy_to_panicmem (); mm_flush_wb_cache (); usleep (1000000); asm_rdcr0 (&cr0); cr0 = (cr0 & ~CR0_NW_BIT) | CR0_CD_BIT; asm_wridtr (0, 0); asm_wrcr0 (cr0); asm_wbinvd (); do_panic_reboot (); } if (!flag_free) { flag_free = true; mm_force_unlock (); mm_free_panicmem (); } d = panic_process; if (d >= 0 && config.vmm.shell && !flag_shell && currentcpu->panic.shell_ready) { flag_shell = true; debug_msgregister (); ttylog_stop (); msgsendint (d, 0); } printf ("%s\n", panicmsg); freeze (); }
static void dbgsh_thread (void *arg) { int shell, ttyin, ttyout; msgregister ("dbgsh_ttyin", dbgsh_ttyin_msghandler); msgregister ("dbgsh_ttyout", dbgsh_ttyout_msghandler); debug_msgregister (); ttyin = msgopen ("dbgsh_ttyin"); ttyout = msgopen ("dbgsh_ttyout"); for (;;) { shell = newprocess ("shell"); if (ttyin < 0 || ttyout < 0 || shell < 0) panic ("dbgsh_thread"); msgsenddesc (shell, ttyin); msgsenddesc (shell, ttyout); msgsendint (shell, 0); msgclose (shell); schedule (); } }