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(unsigned cpu, void *)
33 printf("\nLocal APIC [%u, %08x]: tpr=%2x ppr=%2x\n", cpu, Apic::get_id(), Apic::tpr(),
34 Apic::reg_read(0xa0));
35 printf(" Running: tpr=%02x\n", Jdb::apic_tpr.cpu(cpu));
37 unsigned const regs[] = { 0x200, 0x100, 0x180 };
38 char const *const regn[] = { "IRR", "ISR", "TMR" };
39 for (unsigned r = 0; r < 3; ++r)
41 printf(" %s:", regn[r]);
42 for (int i = 3; i >= 0; --i)
44 unsigned long v = Apic::reg_read(regs[r] + i * 0x10);
53 Jdb_io_apic_module::remote_print_lapic(unsigned cpu)
55 Jdb::remote_work(cpu, print_lapic, 0);
59 Jdb_module::Action_code
60 Jdb_io_apic_module::action (int cmd, void *&, char const *&, int &)
65 if (!Io_apic::active())
67 printf("\nIO APIC not present!\n");
70 printf("\nState of IO APIC\n");
73 // print global LAPIC state
77 strcpy (apic_state, "N/A");
78 if ((apic_disabled = Apic::test_present_but_disabled()))
79 strcpy (apic_state, "disabled by BIOS");
80 if ((khz = Apic::get_frequency_khz()))
82 unsigned mhz = khz / 1000;
84 snprintf(apic_state, sizeof(apic_state), "yes (%d.%03d MHz)"
85 "\n local APIC spurious interrupts/bug/error: %d/%d/%d",
87 apic_spurious_interrupt_cnt,
88 apic_spurious_interrupt_bug_cnt,
91 printf("\nLocal APIC (general): %s"
100 ? "not supported (Local APIC disabled)"
101 : "not supported (no Local APIC)"
103 Jdb::foreach_cpu(&remote_print_lapic);
110 Jdb_io_apic_module::num_cmds() const
116 Jdb_module::Cmd const *
117 Jdb_io_apic_module::cmds() const
120 { { 0, "A", "apic", "", "apic\tdump state of IOAPIC", (void*)0 } };
126 Jdb_io_apic_module::Jdb_io_apic_module()