/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "cyclic.h"
#define CYCLIC_TRACE
#include <mdb/mdb_modapi.h>
#include <sys/cyclic_impl.h>
#include <sys/sysmacros.h>
#include <stdio.h>
int
{
static int inited = 0;
static int cyc_trace_enabled = 0;
if (!inited) {
inited = 1;
}
return (-1);
if (!cyc_trace_enabled)
return (0);
}
int
{
mdb_warn("couldn't walk 'cpu'");
return (WALK_ERR);
}
return (WALK_NEXT);
}
int
{
return (WALK_ERR);
}
}
int
{
mdb_warn("must provide a cyclic id\n");
return (WALK_ERR);
}
return (WALK_ERR);
}
return (WALK_ERR);
}
return (WALK_NEXT);
}
int
{
return (WALK_DONE);
return (WALK_ERR);
}
}
void
{
int me;
int i, x = l + (r - l) / 2;
return;
if (me < 10) {
} else if (me >= 100) {
} else {
}
if (r - l > 5) {
c[++depth][x] = '|';
depth++;
for (i = l + (r - l) / 4; i < r - (r - l) / 4; i++)
c[depth][i] = '-';
c[depth][x] = '+';
} else {
return;
return;
heap[heap_right]);
return;
}
}
void
{
char **c;
int i, j;
int depth;
return;
}
continue;
depth++;
for (i = 0; i < depth; i++)
for (i = 0; i < depth; i++) {
int dump = 0;
for (j = 0; j < width - 1; j++) {
if (c[i][j] == '\0')
c[i][j] = ' ';
else
dump = 1;
}
if (dump)
mdb_printf(c[i]);
}
}
/*
* Yes, this is very weak. Full 16-column-wide 64-bit addresses screw up
* ::cycinfo's very carefully planned 80-column layout. We set the column
* width for addresses to be 11 (instead of 16), knowing that the kernel
* heap (from which these data structures are allocated) starts at
* 0x0000030000000000, and isn't likely to extend to 0x0000100000000000.
*/
#ifdef _LP64
#else
#endif
int
{
cpu_t c;
int header = 0;
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("can't walk 'cyccpu'");
return (DCMD_ERR);
}
return (DCMD_OK);
}
return (DCMD_USAGE);
mdb_printf("\n\n");
return (DCMD_ERR);
}
return (DCMD_ERR);
}
return (DCMD_ERR);
}
return (DCMD_ERR);
}
if (cpu.cyp_nelems > 0)
else
return (DCMD_OK);
mdb_printf("\n");
mdb_inc_indent(2);
int j;
if (heap[j] == i)
break;
}
continue;
if (!header) {
header = 1;
mdb_printf("\n%*s %3s %4s %4s %5s %15s %7s %s\n",
"PEND", "FIRE", "USECINT", "HANDLER");
}
mdb_printf("%4d ", j);
if (j >= cpu.cyp_nelems) {
"-", "-", "-");
continue;
}
mdb_printf("%4s %5d %15llx ",
else
}
if (!Verbose)
goto out;
shared = 0;
continue;
}
for (i = 0; i <= pc->cypc_sizemask &&
i <= pc->cypc_prodndx; i++) {
"hard" : "soft");
if (i >= pc->cypc_prodndx)
mdb_printf("%4s %*s %5s ",
else {
cyclic_t c;
mdb_warn("\ncouldn't read cyclic at "
"%p", cyc_addr);
continue;
}
}
mdb_printf("<-- consndx");
mdb_printf(",prodndx");
mdb_printf("\n");
continue;
}
mdb_printf("<-- prodndx\n");
continue;
}
mdb_printf("\n");
if (i >= pc->cypc_prodndx)
break;
}
goto again;
}
}
out:
mdb_dec_indent(2);
return (DCMD_OK);
}
int
{
int i;
/*
* If an address isn't provided, we'll use the passive buffer.
*/
mdb_warn("couldn't find passive buffer");
return (-1);
}
mdb_warn("couldn't read passive buffer");
return (-1);
}
} else {
return (-1);
}
}
for (i = 0; i < CY_LEVELS; i++) {
}
return (0);
}
int
{
for (i = 0; i < CY_LEVELS; i++) {
continue;
/*
* Account for NPT.
*/
lev = i;
}
}
/*
* If we didn't find one, we're done.
*/
if (latest == 0)
return (-1);
new_ndx = -1;
return (rval);
}
void
{
}
int
{
int i;
char c[WHYLEN];
break;
mdb_printf("%08p %4s %15llx %-*s %15llx %15llx\n",
return (0);
}
/*ARGSUSED*/
int
{
mdb_warn("couldn't walk cyctrace");
return (DCMD_ERR);
}
return (DCMD_OK);
}
int
cyccover_comp(const void *l, const void *r)
{
return (0);
return (-1);
return (1);
}
/*ARGSUSED*/
int
{
char c[WHYLEN];
int i;
return (DCMD_USAGE);
mdb_warn("couldn't find coverage information");
return (DCMD_ABORT);
}
return (DCMD_ABORT);
}
mdb_printf("%-*s %8s %8s %8s %15s %15s\n",
for (i = 0; i < CY_NCOVERAGE; i++) {
mdb_printf("%-*s %8d %8d %8d %15llx %15llx\n",
WHYLEN, c,
cv[i].cyv_passive_count != 0 ?
cv[i].cyv_passive_count :
}
}
return (DCMD_OK);
}
/*ARGSUSED*/
int
{
return (DCMD_USAGE);
if (DCMD_HDRSPEC(flags))
"PEND", "FLAGS", "FIRE", "USECINT", "HANDLER");
return (DCMD_ERR);
}
return (DCMD_OK);
}
static int
{
cpu_t c;
return (DCMD_ERR);
}
return (DCMD_ERR);
}
return (DCMD_ERR);
}
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
mdb_printf("%?s ");
return (WALK_NEXT);
}
/*ARGSUSED*/
int
{
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("can't walk cyclic_id_cache");
return (DCMD_ERR);
}
return (DCMD_OK);
}
if (DCMD_HDRSPEC(flags)) {
"CYCLIC", "HANDLER");
}
return (DCMD_ERR);
}
/*
* This is an omnipresent cyclic.
*/
"CPU", "NDX", "CYCLIC", "HANDLER");
if (mdb_pwalk("cycomni",
return (DCMD_ERR);
}
mdb_printf("\n");
return (DCMD_OK);
}
}