xpv.c revision 843e19887f64dde75055cf8842fc4db2171eff45
/*
* 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 <mdb/mdb_modapi.h>
#include <mdb/mdb_gelf.h>
#include <mdb/mdb_target_impl.h>
#include <errno.h>
static mdb_ctf_id_t domain_type;
/*
* Some constants found in the non-public sched.h header file
*/
#define MAX_EVTCHNS NR_EVENT_CHANNELS
#define EVTCHNS_PER_BUCKET 128
/*
* "struct domain" is an internal Xen structure. Rather than trying to
* keep the mdb source in sync with Xen, we use CTF to extract the
* interesting bits from the binary, and stash them in the structure
* defined below.
*/
typedef struct domain {
short domain_id;
int tot_pages;
int max_pages;
int xenheap_pages;
char is_hvm;
struct domain *next_in_list;
} domain_t;
static uintptr_t
{
mdb_warn("can't find symbol 'dom0'");
return (0);
}
mdb_printf("Symbol 'dom0' found, but with the wrong size\n");
return (0);
}
mdb_warn("can't read data for symbol 'dom0'");
return (0);
}
return (addr);
}
typedef struct domain_walk {
int
{
return (WALK_ERR);
return (WALK_NEXT);
}
int
{
int status;
return (WALK_DONE);
wsp->walk_cbdata);
MDB_CTF_VREAD_IGNORE_ABSENT) != 0) {
mdb_warn("can't find next domain");
return (WALK_ERR);
}
return (status);
}
void
{
}
typedef struct vcpu_walk {
} vcpu_walk_t;
int
{
return (WALK_ERR);
mdb_warn("can't find per-domain vcpu information");
return (WALK_ERR);
}
return (WALK_NEXT);
}
int
{
int status;
return (WALK_DONE);
(vcpu_ptr == 0))
return (WALK_DONE);
wsp->walk_cbdata);
return (status);
}
void
{
}
int
{
if (!mdb_ctf_type_valid(domain_type)) {
mdb_warn("Can't parse Xen domain info.\n");
return (DCMD_ERR);
}
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("can't walk domains");
return (DCMD_ERR);
}
return (DCMD_OK);
}
if (DCMD_HDRSPEC(flags))
mdb_printf("%?s %3s %8s %8s %8s %3s %?s %?s\n",
"ADDR", "ID", "TPAGES", "MPAGES", "FLAGS", "HVM",
"VCPU", "EVTCHN");
MDB_CTF_VREAD_IGNORE_ABSENT) != 0) {
mdb_warn("can't read domain information");
return (DCMD_ERR);
}
mdb_warn("can't find per-domain vcpu information");
return (DCMD_ERR);
}
mdb_warn("can't find per-domain event channel information");
return (DCMD_ERR);
}
mdb_printf("%?lx %3d %8x %8x %8x %3d %?lx %?lx\n",
return (DCMD_OK);
}
static const mdb_dcmd_t dcmds[] = {
{ NULL }
};
static const mdb_walker_t walkers[] = {
{ "domain", "walk list of Xen domains",
{ "vcpu", "walk a Xen domain's vcpus",
{ NULL }
};
const mdb_modinfo_t *
_mdb_init(void)
{
struct panic_info pi;
return (NULL);
mdb_warn("failed to read xpv panic_info pointer");
return (NULL);
}
mdb_warn("failed to read xpv panic_info");
return (NULL);
}
mdb_warn("unrecognized hypervisor panic format");
return (NULL);
}
mdb_warn("Can't parse Xen domain info: "
"'struct domain' not found.\n");
}
return (&modinfo);
}