make ddb minimally MP aware

This commit is contained in:
cherry 2011-08-11 19:52:52 +00:00
parent bc1cccc8d3
commit 5e67834ba7
2 changed files with 29 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_interface.c,v 1.23 2011/04/03 22:29:25 dyoung Exp $ */
/* $NetBSD: db_interface.c,v 1.24 2011/08/11 19:52:52 cherry Exp $ */
/*
* Mach Operating System
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.23 2011/04/03 22:29:25 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.24 2011/08/11 19:52:52 cherry Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@ -82,7 +82,9 @@ void kdbprinttrap(int, int);
#ifdef MULTIPROCESSOR
extern void ddb_ipi(struct trapframe);
static void ddb_suspend(struct trapframe *);
#ifndef XEN
int ddb_vec;
#endif /* XEN */
static bool ddb_mp_online;
#endif
@ -98,9 +100,13 @@ db_machine_init(void)
{
#ifdef MULTIPROCESSOR
#ifndef XEN
ddb_vec = idt_vec_alloc(0xf0, 0xff);
setgate((struct gate_descriptor *)&idt[ddb_vec], &Xintrddb, 1,
SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
#else
/* Initialised as part of xen_ipi_init() */
#endif /* XEN */
#endif
}
@ -114,8 +120,10 @@ db_suspend_others(void)
int cpu_me = cpu_number();
int win;
#ifndef XEN
if (ddb_vec == 0)
return 1;
#endif /* XEN */
__cpu_simple_lock(&db_lock);
if (ddb_cpu == NOCPU)
@ -123,7 +131,12 @@ db_suspend_others(void)
win = (ddb_cpu == cpu_me);
__cpu_simple_unlock(&db_lock);
if (win) {
#ifdef XEN
xen_broadcast_ipi(XEN_IPI_DDB);
#else
x86_ipi(ddb_vec, LAPIC_DEST_ALLEXCL, LAPIC_DLMODE_FIXED);
#endif /* XEN */
}
ddb_mp_online = x86_mp_online;
x86_mp_online = false;

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_interface.c,v 1.66 2011/04/03 22:29:26 dyoung Exp $ */
/* $NetBSD: db_interface.c,v 1.67 2011/08/11 19:52:52 cherry Exp $ */
/*
* Mach Operating System
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.66 2011/04/03 22:29:26 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.67 2011/08/11 19:52:52 cherry Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@ -86,7 +86,9 @@ void kdbprinttrap(int, int);
extern void ddb_ipi(int, struct trapframe);
extern void ddb_ipi_tss(struct i386tss *);
static void ddb_suspend(struct trapframe *);
#ifndef XEN
int ddb_vec;
#endif /* XEN */
static bool ddb_mp_online;
#endif
@ -104,8 +106,12 @@ db_machine_init(void)
{
#ifdef MULTIPROCESSOR
#ifndef XEN
ddb_vec = idt_vec_alloc(0xf0, 0xff);
idt_vec_set(ddb_vec, &Xintrddbipi);
#else
/* Initialised as part of xen_ipi_init() */
#endif /* XEN */
#endif
}
@ -119,8 +125,10 @@ db_suspend_others(void)
int cpu_me = cpu_number();
int win;
#ifndef XEN
if (ddb_vec == 0)
return 1;
#endif /* XEN */
__cpu_simple_lock(&db_lock);
if (ddb_cpu == NOCPU)
@ -128,7 +136,11 @@ db_suspend_others(void)
win = (ddb_cpu == cpu_me);
__cpu_simple_unlock(&db_lock);
if (win) {
#ifdef XEN
xen_broadcast_ipi(XEN_IPI_DDB);
#else
x86_ipi(ddb_vec, LAPIC_DEST_ALLEXCL, LAPIC_DLMODE_FIXED);
#endif /* XEN */
}
ddb_mp_online = x86_mp_online;
x86_mp_online = false;