/*
* 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"
/*
*/
#include <kmdb/kmdb_promif_isadep.h>
#include <kmdb/kmdb_start.h>
#include <kmdb/kmdb_kdi.h>
#include <kmdb/kmdb_asmutil.h>
#include <mdb/mdb_debug.h>
#include <mdb/mdb_kreg.h>
#include <sys/kdi_impl.h>
#include <sys/machtrap.h>
static const char kaif_defer_word_tmpl[] =
/* 1 */ ": kmdb_callback "
/*
* Don't hand control to the debugger if we're coming from OBP's text.
*/
/* 2 */ " %%pc f000.0000 ffff.ffff between if exit then "
/*
* Save registers
*/
/* 3 */ " %%pc h# %x x! "
/* 4 */ " %%npc h# %x x! "
/* 5 */ " %%g1 h# %x x! "
/* 6 */ " %%g2 h# %x x! "
/* 7 */ " %%g3 h# %x x! "
/* 8 */ " %%g4 h# %x x! "
/* 9 */ " %%g5 h# %x x! "
/* 10 */ " %%g6 h# %x x! "
/* 11 */ " %%g7 h# %x x! "
/* 12 */ " 1 %%tstate h# %x x! "
/* 13 */ " 1 %%tt h# %x x! "
/* 14 */ " %%tba h# %x x! "
/* 15 */ " h# %x set-pc "
/* 16 */ " go "
/* 17 */ "; ";
/*
* Format the Forth word which tells the prom how to save state for
* giving control to us.
*/
static char *
kaif_format_word(void)
{
int len;
kaif_trap_obp); /* 15 */
return (prom_str);
}
static void
kaif_prom_install(void)
{
kmdb_prom_interpret(" ['] kmdb_callback init-debugger-hook ");
}
void
kaif_prom_rearm(void)
{
kmdb_prom_interpret(" ['] kmdb_callback is debugger-hook ");
}
/*ARGSUSED*/
static void
{
}
/*ARGSUSED*/
static void
{
}
#ifdef sun4v
/*ARGSUSED*/
static void
{
/* LINTED - pointer alignment */
}
/*ARGSUSED*/
static void
{
/* LINTED - pointer alignment */
}
#endif /* sun4v */
static void
{
/* LINTED - pointer alignment */
}
static void
{
/* LINTED - pointer alignment */
}
static struct kaif_trap_handlers {
} kaif_trap_handlers[] = {
#ifdef sun4v
#endif
{ T_IDIV0, kaif_install_generic },
#ifdef sun4v
#endif
#ifdef sun4v
#endif
{ 0 }
};
static void
kaif_trap_init(void)
{
int i;
/*
* sun4u:
* We rely upon OBP for the handling of a great many traps. As such,
* we begin by populating our table with pointers to OBP's handlers.
* We then copy in our own handlers where appropriate. At some point,
* when we provide the bulk of the handlers, this process will be
* reversed.
*
* sun4v:
* The sun4v kernel dismisses OBP at boot. Both fast and slow TLB
* misses are handled by KMDB. Breakpoint traps go directly KMDB.
* All other trap entries are redirected to their respective
* trap implemenation within the Solaris trap table.
*/
for (i = 0; i < kaif_tba_native_sz; i += 0x20) {
/* LINTED - pointer alignment */
#ifdef sun4v
#else
#endif
}
for (i = 0; kaif_trap_handlers[i].th_tt != 0; i++) {
}
}
/*
* The kernel is ready for us to switch to our table (the HAT has been
* initialized, the hments are walkable, and the trap table's pages
* have been locked into the TLBs.
*/
static void
kaif_vmready(void)
{
}
/*
* Called on the CPR master CPU. The driver has taken care of locking the
* TLB entries. CPR restored the OBP image which contains kmdb_callback,
* so there's nothing we need to do. This function should be removed entirely
* in a future release.
*/
static void
kaif_cpr_restart(void)
{
}
NULL, /* dv_kctl_vmready */
NULL, /* dv_kctl_memavail */
NULL, /* dv_kctl_modavail */
NULL, /* dv_kctl_thravail */
NULL, /* dv_memavail */
NULL, /* dv_kctl_cpu_init */
};
/*ARGSUSED1*/
void
{
}
void
kaif_deactivate(void)
{
kmdb_prom_interpret(" ['] noop is debugger-hook ");
}