#include "apic.h"
#include "boot_info.h"
#include "checksum.h"
-#include "cmdline.h"
#include "config.h"
#include "cpu.h"
#include "initcalls.h"
#include "kernel_uart.h"
#include "kernel_task.h"
#include "kmem.h"
+#include "koptions.h"
#include "logdefs.h"
#include "mem_layout.h"
#include "pic.h"
#include "regdefs.h"
#include "static_init.h"
#include "terminate.h"
-#include "thread.h"
+#include "thread.h"
#include "thread_state.h"
#include "timer.h"
#include "trap_state.h"
-#include "virq.h"
#include "vkey.h"
#include "watchdog.h"
IMPLEMENT FIASCO_INIT FIASCO_NOINLINE
void Jdb::init()
{
- if (strstr (Cmdline::cmdline(), " -nojdb"))
+ if (Koptions::o()->opt(Koptions::F_nojdb))
return;
- if (strstr (Cmdline::cmdline(), " -jdb_never_stop"))
+ if (Koptions::o()->opt(Koptions::F_jdb_never_stop))
never_break = 1;
init_serial_console();
}
PROTECTED static inline
+template< typename T >
void
-Jdb::monitor_address(unsigned current_cpu, void *addr)
+Jdb::set_monitored_address(T *dest, T val)
{
- if (Cpu::cpus.cpu(current_cpu).has_monitor_mwait())
+ *dest = val;
+}
+
+PROTECTED static inline
+template< typename T >
+T
+Jdb::monitor_address(unsigned current_cpu, T *addr)
+{
+ if (!*addr && Cpu::cpus.cpu(current_cpu).has_monitor_mwait())
{
asm volatile ("monitor \n" : : "a"(addr), "c"(0), "d"(0) );
Mword irq_sup = Cpu::cpus.cpu(current_cpu).has_monitor_mwait_irq() ? 1 : 0;
asm volatile ("mwait \n" : : "a"(0x00), "c"(irq_sup) );
}
+
+ return *addr;
}
{
Watchdog::disable();
pic_status = Pic::disable_all_save();
+ if (Config::getchar_does_hlt && Config::getchar_does_hlt_works_ok)
+ Timer::disable();
}
if (Io_apic::active() && Apic::is_present())
{
apic_tpr.cpu(cpu) = Apic::tpr();
Apic::tpr(APIC_IRQ_BASE - 0x10);
}
-
+
if (cpu == 0 && Config::getchar_does_hlt && Config::getchar_does_hlt_works_ok)
{
// set timer interrupt does nothing than wakeup from hlt
}
}
- if (state == s_unknown && (t->state() & Thread_ipc_mask))
+ if (state == s_unknown && (t->state(false) & Thread_ipc_mask))
state = s_ipc;
return state;