/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Libkvm Kernel Target SPARC v9 component
*
* This file provides the ISA-dependent portion of the libkvm kernel target.
* For more details on the implementation refer to mdb_kvm.c. The SPARC v9
* ISA code is actually compiled into *both* the sparcv7 and sparcv9 MDB
* binaries because we need to deal with the sparcv9 CPU registers when
* debugging a 32-bit crash dump from a kernel running on a sparcv9 CPU.
*/
#ifndef __sparcv9cpu
#define __sparcv9cpu
#endif
#include <sys/machtypes.h>
#include <sys/sysmacros.h>
#include <strings.h>
#include <mdb/mdb_target_impl.h>
#include <mdb/mdb_disasm.h>
#include <mdb/mdb_modapi.h>
#include <mdb/mdb_conf.h>
#include <mdb/mdb_kreg_impl.h>
#include <mdb/mdb_v9util.h>
#include <mdb/mdb_debug.h>
#ifndef STACK_BIAS
#define STACK_BIAS 0
#endif
static int
{
return (set_errno(EMDB_NOREGS));
return (0);
}
}
return (set_errno(EMDB_BADREG));
}
static int
{
return (set_errno(EMDB_NOREGS));
return (0);
}
}
return (set_errno(EMDB_BADREG));
}
/*
* - 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.
*/
/*ARGSUSED*/
static int
{
return (DCMD_OK);
}
static int
{
if (flags & DCMD_ADDRSPEC) {
} else
if (argc != 0) {
return (DCMD_USAGE);
else
}
return (DCMD_OK);
}
static int
{
}
static int
{
}
static int
{
/*
* Force printing of first register window by setting the
* saved pc (%i7) to PC_FAKE.
*/
PC_FAKE));
}
/*ARGSUSED*/
static int
{
return (DCMD_ERR);
}
kt_setflags, /* t_setflags */
kt_setcontext, /* t_setcontext */
kt_activate, /* t_activate */
kt_deactivate, /* t_deactivate */
(void (*)()) mdb_tgt_nop, /* t_periodic */
kt_destroy, /* t_destroy */
kt_name, /* t_name */
(const char *(*)()) mdb_conf_isa, /* t_isa */
kt_platform, /* t_platform */
kt_uname, /* t_uname */
kt_dmodel, /* t_dmodel */
kt_aread, /* t_aread */
kt_awrite, /* t_awrite */
kt_vread, /* t_vread */
kt_vwrite, /* t_vwrite */
kt_pread, /* t_pread */
kt_pwrite, /* t_pwrite */
kt_fread, /* t_fread */
kt_fwrite, /* t_fwrite */
kt_vtop, /* t_vtop */
kt_lookup_by_name, /* t_lookup_by_name */
kt_lookup_by_addr, /* t_lookup_by_addr */
kt_symbol_iter, /* t_symbol_iter */
kt_mapping_iter, /* t_mapping_iter */
kt_object_iter, /* t_object_iter */
kt_addr_to_map, /* t_addr_to_map */
kt_name_to_map, /* t_name_to_map */
kt_addr_to_ctf, /* t_addr_to_ctf */
kt_name_to_ctf, /* t_name_to_ctf */
kt_status, /* t_status */
(int (*)()) mdb_tgt_notsup, /* t_run */
(int (*)()) mdb_tgt_notsup, /* t_step */
(int (*)()) mdb_tgt_notsup, /* t_step_out */
(int (*)()) mdb_tgt_notsup, /* t_step_branch */
(int (*)()) mdb_tgt_notsup, /* t_next */
(int (*)()) mdb_tgt_notsup, /* t_cont */
(int (*)()) mdb_tgt_notsup, /* t_signal */
(int (*)()) mdb_tgt_null, /* t_add_vbrkpt */
(int (*)()) mdb_tgt_null, /* t_add_sbrkpt */
(int (*)()) mdb_tgt_null, /* t_add_pwapt */
(int (*)()) mdb_tgt_null, /* t_add_iowapt */
(int (*)()) mdb_tgt_null, /* t_add_vwapt */
(int (*)()) mdb_tgt_null, /* t_add_sysenter */
(int (*)()) mdb_tgt_null, /* t_add_sysexit */
(int (*)()) mdb_tgt_null, /* t_add_signal */
(int (*)()) mdb_tgt_null, /* t_add_fault */
kt_getareg, /* t_getareg */
kt_putareg, /* t_putareg */
mdb_kvm_v9stack_iter, /* t_stack_iter */
(int (*)()) mdb_tgt_notsup /* t_auxv */
};
void
{
/*
* Initialize the machine-dependent parts of the kernel target
* structure. Once this is complete and we fill in the ops
* vector, the target is now fully constructed and we can use
* the target API itself to perform the rest of our initialization.
*/
t->t_ops = &kt_sparcv9_ops;
(void) mdb_dis_select("v9plus");
/*
* Don't attempt to load any thread or register information if
* we're examining the live operating system.
*/
return;
/*
* If the panicbuf symbol is present and we can consume a panicbuf
* header of the appropriate version from this address, then
* we can initialize our current register set based on its contents:
*/
uint_t i, n;
MDB_TGT_OBJ_EXEC, "panicbuf");
n = (pd_size - (sizeof (panic_data_t) -
sizeof (panic_nv_t))) / sizeof (panic_nv_t);
for (i = 0; i < n; i++) {
} else
}
}
/*
* Prior to the re-structuring of panicbuf, our only register data
* was the panic_regs label_t, into which a setjmp() was performed.
*/
}
/*
* If we can read a saved register window from the stack at %sp,
* we can also fill in the locals and inputs.
*/
warn("failed to read rwindow at %p -- current "
"frame inputs will be unavailable\n",
}
/*
* The panic_ipl variable records the IPL of the panic CPU,
* which on sparcv9 is the %pil register's value.
*/
/*
* The panic_tick variable records %tick at the approximate
* time of the panic in a DEBUG kernel.
*/
}