/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* various system states (boot, while running, while the debugger has control).
* Functions intended for use while the debugger has control may not grab any
* locks or perform any functions that assume the availability of other system
* services.
*/
#include <sys/x86_archext.h>
#include <sys/kdi_impl.h>
#include <sys/smp_impldefs.h>
#include <sys/psm_types.h>
#include <sys/segments.h>
#include <sys/archsystm.h>
#include <sys/controlregs.h>
#include <sys/kobj_impl.h>
#include <sys/hypervisor.h>
#include <sys/bootconf.h>
#include <sys/bootinfo.h>
#include <sys/evtchn_impl.h>
#include <vm/kboot_mmu.h>
static volatile int kdi_slaves_go;
/*
* These are not safe against dropping into kmdb when fbt::: is active. This is
* also broken on i86pc...
*/
void
{
}
void
{
/*
* See kdi_idtr_set().
*/
}
{
}
void
{
}
void
kdi_flush_caches(void)
{
}
/*
* To avoid domains sucking up CPU while sitting in kmdb, we make all the slave
* CPUs wait for a wake-up evtchn. The master CPU, meanwhile, sleeps for
* console activity.
*/
extern void kdi_slave_entry(void);
void
{
if (doxc)
kdi_slaves_go = 0;
}
void
kdi_start_slaves(void)
{
int c;
kdi_slaves_go = 1;
for (c = 0; c < NCPU; c++) {
continue;
ec_try_ipi(XC_CPUPOKE_PIL, c);
}
}
/*ARGSUSED*/
static int
{
return (kdi_slaves_go == 1);
}
void
kdi_slave_wait(void)
{
return;
}
/*
* Caution.
* These routines are called -extremely- early, during kmdb initialization.
*
* Many common kernel functions assume that %gs has been initialized,
* and fail horribly if it hasn't. At this point, the boot code has
* reserved a descriptor for us (KMDBGS_SEL) in it's GDT; arrange for it
* to point at a dummy cpu_t, temporarily at least.
*
*/
#if defined(__amd64)
void *
boot_kdi_tmpinit(void)
{
/*
* (Note that we had better switch to a -new- GDT before
* we discard the KM_TMP mappings, or disaster will ensue.)
*/
panic("boot_kdi_tmpinit:HYPERVISOR_set_gdt() failed");
/*
* Now point %gsbase to our temp cpu structure.
*/
return (0);
}
/*ARGSUSED*/
void
{
/*
* This breaks, why do we need it anyway?
*/
#if 0 /* XXPV */
#endif
}
/*
* Sigh. We're called before we've initialized the kernels GDT, living
* off the hypervisor's default GDT. For kmdb's sake, we switch now to
* a GDT that looks like dboot's GDT; very shortly we'll initialize and
* switch to the kernel's GDT.
*/
void *
boot_kdi_tmpinit(void)
{
/*
* (Note that we had better switch to a -new- GDT before
* we discard the KM_TMP mappings, or disaster will ensue.)
*/
panic("boot_kdi_tmpinit:HYPERVISOR_set_gdt() failed");
return (0);
}
/*ARGSUSED*/
void
{
0, B32DATA_SEL);
}
#endif /* __i386 */