Continuing from the kernel debugger did not work on SMP machines, as SMP_MSG_CPU_HALT was

a one way ticket. It now works as expected.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21280 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-05-31 22:09:39 +00:00
parent 9b39fc10cb
commit 176f0604ed
2 changed files with 22 additions and 15 deletions
+8 -4
View File
@@ -867,20 +867,23 @@ panic(const char *format, ...)
void void
kernel_debugger(const char *message) kernel_debugger(const char *message)
{ {
static vint32 inDebugger;
cpu_status state; cpu_status state;
bool dprintfState; bool dprintfState;
state = disable_interrupts();
atomic_add(&inDebugger, 1);
arch_debug_save_registers(&dbg_register_file[smp_get_current_cpu()][0]); arch_debug_save_registers(&dbg_register_file[smp_get_current_cpu()][0]);
dprintfState = set_dprintf_enabled(true); dprintfState = set_dprintf_enabled(true);
state = disable_interrupts();
if (sDebuggerOnCPU != smp_get_current_cpu()) { if (sDebuggerOnCPU != smp_get_current_cpu()) {
// halt all of the other cpus // First entry, halt all of the other cpus
// XXX need to flush current smp mailbox to make sure this goes // XXX need to flush current smp mailbox to make sure this goes
// through. Otherwise it'll hang // through. Otherwise it'll hang
smp_send_broadcast_ici(SMP_MSG_CPU_HALT, 0, 0, 0, NULL, SMP_MSG_FLAG_SYNC); smp_send_broadcast_ici(SMP_MSG_CPU_HALT, 0, 0, 0, (void *)&inDebugger,
SMP_MSG_FLAG_SYNC);
} }
if (sBlueScreenOutput) { if (sBlueScreenOutput) {
@@ -896,6 +899,7 @@ kernel_debugger(const char *message)
set_dprintf_enabled(dprintfState); set_dprintf_enabled(dprintfState);
sBlueScreenEnabled = false; sBlueScreenEnabled = false;
atomic_add(&inDebugger, -1);
restore_interrupts(state); restore_interrupts(state);
// ToDo: in case we change dbg_register_file - don't we want to restore it? // ToDo: in case we change dbg_register_file - don't we want to restore it?
+14 -11
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2006, Axel Dörfler, [email protected]. * Copyright 2002-2007, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@@ -347,11 +347,11 @@ static int32
process_pending_ici(int32 currentCPU) process_pending_ici(int32 currentCPU)
{ {
struct smp_msg *msg; struct smp_msg *msg;
bool halt = false; vint32 *haltValue = NULL;
int source_mailbox = 0; int sourceMailbox = 0;
int retval = B_HANDLED_INTERRUPT; int retval = B_HANDLED_INTERRUPT;
msg = check_for_message(currentCPU, &source_mailbox); msg = check_for_message(currentCPU, &sourceMailbox);
if (msg == NULL) if (msg == NULL)
return retval; return retval;
@@ -374,8 +374,8 @@ process_pending_ici(int32 currentCPU)
retval = B_INVOKE_SCHEDULER; retval = B_INVOKE_SCHEDULER;
break; break;
case SMP_MSG_CPU_HALT: case SMP_MSG_CPU_HALT:
halt = true; haltValue = (vint32 *)msg->data_ptr;
dprintf("cpu %ld halted!\n", currentCPU); dprintf("CPU %ld halted!\n", currentCPU);
break; break;
case SMP_MSG_CALL_FUNCTION: case SMP_MSG_CALL_FUNCTION:
{ {
@@ -389,13 +389,16 @@ process_pending_ici(int32 currentCPU)
} }
// finish dealing with this message, possibly removing it from the list // finish dealing with this message, possibly removing it from the list
finish_message_processing(currentCPU, msg, source_mailbox); finish_message_processing(currentCPU, msg, sourceMailbox);
// special case for the halt message // special case for the halt message
// we otherwise wouldn't have gotten the opportunity to clean up if (haltValue) {
if (halt) { cpu_status state = disable_interrupts();
disable_interrupts();
for(;;); while (*haltValue != 0)
;
restore_interrupts(state);
} }
return retval; return retval;