9 #include "jdb_module.h"
10 #include "jdb_screen.h"
11 #include "static_init.h"
16 * Private 'exit' module.
18 * This module handles the 'exit' or '^' command that
19 * makes a call to exit() and virtually reboots the system.
21 class Jdb_io_apic_module : public Jdb_module
24 Jdb_io_apic_module() FIASCO_INIT;
27 static Jdb_io_apic_module jdb_io_apic_module INIT_PRIORITY(JDB_MODULE_INIT_PRIO);
31 Jdb_io_apic_module::print_lapic(Cpu_number cpu, void *)
33 printf("\nLocal APIC [%u, %08x]: tpr=%2x ppr=%2x\n",
34 cxx::int_value<Cpu_number>(cpu),
35 Apic::get_id(), Apic::tpr(), Apic::reg_read(0xa0));
36 printf(" Running: tpr=%02x\n", Jdb::apic_tpr.cpu(cpu));
38 unsigned const regs[] = { 0x200, 0x100, 0x180 };
39 char const *const regn[] = { "IRR", "ISR", "TMR" };
40 for (unsigned r = 0; r < 3; ++r)
42 printf(" %s:", regn[r]);
43 for (int i = 3; i >= 0; --i)
45 unsigned long v = Apic::reg_read(regs[r] + i * 0x10);
54 Jdb_io_apic_module::remote_print_lapic(Cpu_number cpu)
56 Jdb::remote_work(cpu, print_lapic, 0);
60 Jdb_module::Action_code
61 Jdb_io_apic_module::action (int cmd, void *&, char const *&, int &)
66 if (!Io_apic::active())
68 printf("\nIO APIC not present!\n");
71 printf("\nState of IO APIC\n");
72 for (Io_apic *a = Io_apic::_first; a; a = a->_next)
75 // print global LAPIC state
79 strcpy (apic_state, "N/A");
80 if ((apic_disabled = Apic::test_present_but_disabled()))
81 strcpy (apic_state, "disabled by BIOS");
82 if ((khz = Apic::get_frequency_khz()))
84 unsigned mhz = khz / 1000;
86 snprintf(apic_state, sizeof(apic_state), "yes (%d.%03d MHz)"
87 "\n local APIC spurious interrupts/bug/error: %d/%d/%d",
89 apic_spurious_interrupt_cnt,
90 apic_spurious_interrupt_bug_cnt,
93 printf("\nLocal APIC (general): %s"
102 ? "not supported (Local APIC disabled)"
103 : "not supported (no Local APIC)"
105 Jdb::foreach_cpu(&remote_print_lapic);
112 Jdb_io_apic_module::num_cmds() const
118 Jdb_module::Cmd const *
119 Jdb_io_apic_module::cmds() const
122 { { 0, "A", "apic", "", "apic\tdump state of IOAPIC", (void*)0 } };
128 Jdb_io_apic_module::Jdb_io_apic_module()