mdb_v9util.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Routines common to the kvm target and the kmdb target that manipulate
* registers. This includes register dumps, registers as named variables,
* and stack traces.
*/
#ifndef __sparcv9cpu
#define __sparcv9cpu
#endif
#include <mdb/mdb_debug.h>
#include <mdb/mdb_modapi.h>
#include <mdb/mdb_v9util.h>
#include <mdb/mdb_target_impl.h>
#include <mdb/mdb_kreg_impl.h>
/*
* We also define an array of register names and their corresponding
* array indices. This is used by the getareg and putareg entry points,
* and also by our register variable discipline.
*/
const mdb_tgt_regdesc_t mdb_sparcv9_kregs[] = {
{ "y", KREG_Y, 0 },
{ NULL, 0, 0 }
};
static const char *
{
if (KREG_PSTATE_MM_TSO(pstate))
return ("TSO");
if (KREG_PSTATE_MM_PSO(pstate))
return ("PSO");
if (KREG_PSTATE_MM_RMO(pstate))
return ("RMO");
return ("???");
}
void
{
mdb_printf("%%g0 = 0x%0?p %15A %%l0 = 0x%0?p %A\n",
mdb_printf("%%g1 = 0x%0?p %15A %%l1 = 0x%0?p %A\n",
mdb_printf("%%g2 = 0x%0?p %15A %%l2 = 0x%0?p %A\n",
mdb_printf("%%g3 = 0x%0?p %15A %%l3 = 0x%0?p %A\n",
mdb_printf("%%g4 = 0x%0?p %15A %%l4 = 0x%0?p %A\n",
mdb_printf("%%g5 = 0x%0?p %15A %%l5 = 0x%0?p %A\n",
mdb_printf("%%g6 = 0x%0?p %15A %%l6 = 0x%0?p %A\n",
mdb_printf("%%g7 = 0x%0?p %15A %%l7 = 0x%0?p %A\n\n",
mdb_printf("%%o0 = 0x%0?p %15A %%i0 = 0x%0?p %A\n",
mdb_printf("%%o1 = 0x%0?p %15A %%i1 = 0x%0?p %A\n",
mdb_printf("%%o2 = 0x%0?p %15A %%i2 = 0x%0?p %A\n",
mdb_printf("%%o3 = 0x%0?p %15A %%i3 = 0x%0?p %A\n",
mdb_printf("%%o4 = 0x%0?p %15A %%i4 = 0x%0?p %A\n",
mdb_printf("%%o5 = 0x%0?p %15A %%i5 = 0x%0?p %A\n",
mdb_printf("%%o6 = 0x%0?p %15A %%i6 = 0x%0?p %A\n",
mdb_printf("%%o7 = 0x%0?p %15A %%i7 = 0x%0?p %A\n\n",
mdb_printf(" %%ccr = 0x%02llx "
mdb_printf("%%fprs = 0x%02llx "
#if STACK_BIAS != 0
mdb_printf(" %%sp = 0x%0?p unbiased=0x%0?p\n",
#else
#endif
mdb_printf("%%pstate = 0x%03llx cle=%llu tle=%llu mm=%s"
" red=%llu pef=%llu am=%llu priv=%llu ie=%llu ag=%llu\n\n",
mdb_printf(" %%cwp = 0x%02llx %%cansave = 0x%02llx\n",
mdb_printf("%%canrestore = 0x%02llx %%otherwin = 0x%02llx\n",
mdb_printf(" %%wstate = 0x%02llx %%cleanwin = 0x%02llx\n",
}
int
{
long argv[6];
int i;
/*
* - If we got a pc, invoke the call back function starting
* with gsp.
* - If we got a saved pc (%i7), invoke the call back function
* starting with the first register window.
* - If we got neither a pc nor a saved pc, invoke the call back
* function starting with the second register window.
*/
for (;;) {
for (i = 0; i < 6; i++)
break;
break; /* Stop if we're at the end of the stack */
return (set_errno(EMDB_STKALIGN));
return (-1); /* Failed to read frame */
for (i = 0; i < 8; i++)
for (i = 0; i < 8; i++)
}
return (0);
}
/*ARGSUSED*/
int
const mdb_tgt_gregset_t *gregs)
{
if (argc != 0) {
}
mdb_printf(")\n");
return (0);
}
int
const mdb_tgt_gregset_t *gregs)
{
if (argc != 0) {
}
mdb_printf(")\n");
return (0);
}
int
const mdb_tgt_gregset_t *gregs)
{
else
if (argc != 0) {
}
mdb_printf(")\n");
(void) mdb_inc_indent(2);
mdb_printf("%%l0-%%l3: %?lr %?lr %?lr %?lr\n",
mdb_printf("%%l4-%%l7: %?lr %?lr %?lr %?lr\n",
(void) mdb_dec_indent(2);
mdb_printf("\n");
return (0);
}