diff options
| author | Garrett D'Amore <garrett@damore.org> | 2022-07-21 02:25:46 -0400 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2022-07-26 10:16:30 -0400 |
| commit | fe441c7591b77f09d92eddfd633b49b4ccc92027 (patch) | |
| tree | 5637faa4b05193bf813c669f7476d78924b601b8 /usr | |
| parent | 46b0ac2b8506d5f4ba5ae6bff508c343d0ab4830 (diff) | |
| download | illumos-gate-fe441c7591b77f09d92eddfd633b49b4ccc92027.tar.gz | |
14841 remove SPARC support from mdb
Reviewed by: Peter Tribble <peter.tribble@gmail.com>
Reviewed by: Dan McDonald <danmcd@mnx.io>
Approved by: Dan McDonald <danmcd@mnx.io>
Diffstat (limited to 'usr')
203 files changed, 19 insertions, 20573 deletions
diff --git a/usr/src/cmd/mdb/Makefile b/usr/src/cmd/mdb/Makefile index b7bc2c0054..a925108f4d 100644 --- a/usr/src/cmd/mdb/Makefile +++ b/usr/src/cmd/mdb/Makefile @@ -23,15 +23,15 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright 2022 Garrett D'Amore +# include $(SRC)/Makefile.master .KEEP_STATE: -sparc_MACHDIR = sparc i386_MACHDIR = intel -sparc_SUBDIRS = sparc sun4u sun4v i386_SUBDIRS = intel i86pc i86xpv MACHDIR = $($(MACH)_MACHDIR) @@ -69,5 +69,5 @@ FRC: # Cross-reference customization: build the cross-reference only over the # source directories, and ignore Makefiles and machine-generated source. # -XRDIRS = common $(sparc_SUBDIRS) $(i386_SUBDIRS) +XRDIRS = common $(i386_SUBDIRS) XRDEL = mdb_lex.c mdb_grammar.c Makefile* diff --git a/usr/src/cmd/mdb/Makefile.kmdb b/usr/src/cmd/mdb/Makefile.kmdb index 0bbeaf5200..3294fa6165 100644 --- a/usr/src/cmd/mdb/Makefile.kmdb +++ b/usr/src/cmd/mdb/Makefile.kmdb @@ -63,7 +63,6 @@ ASFLAGS += -P -D_ASM $(INCDIRS:%=-I%) $(ARCHOPTS) # STACKPROTECT = none -SUBDIR64_sparc = sparcv9 SUBDIR64_i386 = amd64 SUBDIR64 = $(SUBDIR64_$(MACH)) diff --git a/usr/src/cmd/mdb/Makefile.kmdb.targ b/usr/src/cmd/mdb/Makefile.kmdb.targ index acbe85052f..d2a8aa6817 100644 --- a/usr/src/cmd/mdb/Makefile.kmdb.targ +++ b/usr/src/cmd/mdb/Makefile.kmdb.targ @@ -34,7 +34,6 @@ $(PROG).core: $(OBJS) $(KMDBLIBS) $(MAPFILE) $(PROG): $(PROG).core $(KCTLOBJS) $(LD) -ztype=kmod -o $@ $@.core -Nmisc/ctf $(KCTLOBJS) $(CTFMERGE) -l "$(UTS_LABEL)" -o $@ $(OBJS) $(KCTLOBJS) - $(KMDB_FPTEST) $(POST_PROCESS) $(SETDYNFLAG) -f DF_1_IGNMULDEF,DF_1_NOKSYMS $@ diff --git a/usr/src/cmd/mdb/Makefile.libstand b/usr/src/cmd/mdb/Makefile.libstand index 279194a6ef..26a8e1bf2a 100644 --- a/usr/src/cmd/mdb/Makefile.libstand +++ b/usr/src/cmd/mdb/Makefile.libstand @@ -23,13 +23,15 @@ # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright 2022 Garrett D'Amore +# .KEEP_STATE: .SUFFIXES: include ../../Makefile.libstand -SRCS_COMMON += \ +SRCS += \ bcmp.c \ bcopy.c \ bsearch.c \ @@ -49,10 +51,6 @@ SRCS_COMMON += \ strtol.c \ strtoul.c -sparcv9_SRCS= \ - multi3.c - -SRCS += $(SRCS_COMMON) $($(MACH64)_SRCS) # We don't want thread-specific errno's in kmdb, as we're single-threaded. DTS_ERRNO= diff --git a/usr/src/cmd/mdb/Makefile.module b/usr/src/cmd/mdb/Makefile.module index dd797234ae..8ff1e215d6 100644 --- a/usr/src/cmd/mdb/Makefile.module +++ b/usr/src/cmd/mdb/Makefile.module @@ -185,11 +185,6 @@ KMDB_LINKTEST = \ KMDB_LINKTEST_ENABLE=$(POUND_SIGN) $(KMDB_LINKTEST_ENABLE)KMDB_LINKTEST_CMD = $(KMDB_LINKTEST) -# -# Ensure that dmods don't use floating point -# -KMDB_FPTEST_CMD = $(KMDB_FPTEST) - # Allow overriding this because mdb_ks is special case fake module, # see Makefile.mdb_ks KMODFLAG = -ztype=kmod @@ -198,7 +193,6 @@ $(KMODFILE): kmod .WAIT $(KMODOBJS) $(MAPFILE) $(LD) $(KMODFLAG) $(MAPFILE:%=-Wl,-M%) -Nmisc/kmdbmod -o $@ $(KMODOBJS) \ $(STANDOBJS) $(KMDB_LINKTEST_CMD) - $(KMDB_FPTEST_CMD) $(CTFMERGE) -l "$(UTS_LABEL)" -o $@ $(KMODOBJS) $(POST_PROCESS) $(SETDYNFLAG) -f DF_1_NOKSYMS $@ diff --git a/usr/src/cmd/mdb/demo/Makefile b/usr/src/cmd/mdb/demo/Makefile index ed3acaf5cb..bda587ff7a 100644 --- a/usr/src/cmd/mdb/demo/Makefile +++ b/usr/src/cmd/mdb/demo/Makefile @@ -22,6 +22,8 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright 2022 Garrett D'Amore +# # # Note that this Makefile is *not* the Makefile that is installed in the proto @@ -38,11 +40,9 @@ DEMOFILES = \ Makefile.common \ Makefile.i386 \ Makefile.amd64 \ - Makefile.sparc \ - Makefile.sparcv9 \ README -DEMOSUBDIRS = common i386 amd64 sparc sparcv9 +DEMOSUBDIRS = common i386 amd64 ROOTDEMODIR = $(ROOT)/usr/demo/mdb ROOTDEMOFILES = $(DEMOFILES:%=$(ROOTDEMODIR)/%) diff --git a/usr/src/cmd/mdb/demo/Makefile.demo b/usr/src/cmd/mdb/demo/Makefile.demo index bb7b866bdc..94b8318064 100644 --- a/usr/src/cmd/mdb/demo/Makefile.demo +++ b/usr/src/cmd/mdb/demo/Makefile.demo @@ -23,7 +23,6 @@ # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" .KEEP_STATE: @@ -34,7 +33,6 @@ clobber := TARGET = clobber lint := TARGET = lint MACH :sh= uname -p -SUBDIRS_sparc = sparc sparcv9 SUBDIRS_i386 = i386 amd64 SUBDIRS = $(SUBDIRS_$(MACH)) diff --git a/usr/src/cmd/mdb/demo/Makefile.sparc b/usr/src/cmd/mdb/demo/Makefile.sparc deleted file mode 100644 index 80051eb1a9..0000000000 --- a/usr/src/cmd/mdb/demo/Makefile.sparc +++ /dev/null @@ -1,38 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 1999 by Sun Microsystems, Inc. -# All rights reserved. -# -#ident "%Z%%M% %I% %E% SMI" - -CC = cc -LINT = lint - -CFLAGS = -CPPFLAGS = -LDFLAGS = -LIBS = - -LINTFLAGS = - -include ../Makefile.common diff --git a/usr/src/cmd/mdb/demo/Makefile.sparcv9 b/usr/src/cmd/mdb/demo/Makefile.sparcv9 deleted file mode 100644 index ac1f2e51b6..0000000000 --- a/usr/src/cmd/mdb/demo/Makefile.sparcv9 +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -CC = cc -LINT = lint - -CFLAGS = -m64 -CPPFLAGS = -LDFLAGS = -LIBS = - -LINTFLAGS = -m64 - -include ../Makefile.common diff --git a/usr/src/cmd/mdb/demo/README b/usr/src/cmd/mdb/demo/README index c4285dc7c4..64107dcd65 100644 --- a/usr/src/cmd/mdb/demo/README +++ b/usr/src/cmd/mdb/demo/README @@ -23,7 +23,8 @@ Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. -#ident "%Z%%M% %I% %E% SMI" +Copyright 2022 Garrett D'Amore + 1. Introduction @@ -41,15 +42,14 @@ Guide". This document is available on-line at http://docs.sun.com. As the files in this directory are owned by the administrator, you should make a copy of this directory to your home directory or other location before you begin experimenting with MDB. If you wish to change the configuration, edit -the CC and LINT macro definitions in Makefile.sparc, Makefile.sparcv9, -Makefile.i386 and Makefile.amd64 to point to the appropriate pathnames. +the CC macro definitions in Makefile.i386 and Makefile.amd64 to point to the +appropriate pathnames. + The Makefiles contained in this directory are set up to use the C compiler (cc) and lint utility found in your $PATH. These four Makefiles can also be used to define base compiler settings for the corresponding instruction set architecture (ISA): - Makefile.sparc - rules for building 32-bit SPARC objects - Makefile.sparcv9 - rules for building 64-bit SPARC objects Makefile.i386 - rules for building 32-bit x86 objects Makefile.amd64 - rules for building 64-bit x86 objects @@ -84,7 +84,7 @@ execute the default "make all" target. 4. Loading Modules After you successfully compile the example modules, the module object files -reside in one or more of the i386/, amd64/, sparc/, and sparcv9/ subdirectories +reside in one or more of the i386/, amd64/ subdirectories depending on the ISAs supported on your machine. In order to load the example modules, you can either use the ::load built-in dcmd with the absolute pathname of a given module, or you can adjust the module library path to include the diff --git a/usr/src/cmd/mdb/sparc/Makefile b/usr/src/cmd/mdb/sparc/Makefile deleted file mode 100644 index cfc8be7cab..0000000000 --- a/usr/src/cmd/mdb/sparc/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -SUBDIRS = v7 v9 - -include ../Makefile.subdirs diff --git a/usr/src/cmd/mdb/sparc/Makefile.kmdb b/usr/src/cmd/mdb/sparc/Makefile.kmdb deleted file mode 100644 index 917de4a858..0000000000 --- a/usr/src/cmd/mdb/sparc/Makefile.kmdb +++ /dev/null @@ -1,31 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -SACPPFLAGS = -D__sparc - -MAPFILE_SOURCES = \ - $(MAPFILE_SOURCES_COMMON) \ - ../../../sparc/kmdb/kmdb_dpi_isadep.h \ - $(MAPFILE_SOURCES_$(MACH)) diff --git a/usr/src/cmd/mdb/sparc/Makefile.kmdb.64 b/usr/src/cmd/mdb/sparc/Makefile.kmdb.64 deleted file mode 100644 index d912b444ec..0000000000 --- a/usr/src/cmd/mdb/sparc/Makefile.kmdb.64 +++ /dev/null @@ -1,29 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -V9CODESIZE = $(CCABS32) diff --git a/usr/src/cmd/mdb/sparc/Makefile.libstand b/usr/src/cmd/mdb/sparc/Makefile.libstand deleted file mode 100644 index 73dd761d06..0000000000 --- a/usr/src/cmd/mdb/sparc/Makefile.libstand +++ /dev/null @@ -1,28 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -# - diff --git a/usr/src/cmd/mdb/sparc/Makefile.sparcv7 b/usr/src/cmd/mdb/sparc/Makefile.sparcv7 deleted file mode 100644 index b30c089efe..0000000000 --- a/usr/src/cmd/mdb/sparc/Makefile.sparcv7 +++ /dev/null @@ -1,52 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# ident "%Z%%M% %I% %E% SMI" -# - -MACHDIR=sparc -MACHMODDIR= - -ROOTMOD = $(ROOT)/usr/lib/mdb/$(MDBTGT) - -$$(ROOTMOD)/%: dmod/% - $(INS.file) - -CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) -xstrconst -CTFSTABSCFLAGS = $(CFLAGS) $(CALLSYMS) -LINTFLAGS += -u -erroff=E_BAD_FORMAT_STR2,E_BAD_FORMAT_ARG_TYPE2 - -LFLAGS = -t -v -YFLAGS = -d -v - -# -# We don't support kmdb on v7 sparc, so we don't need kmdb versions of the -# v7 modules -# -MODULE_BUILD_TYPE = mdb - -# -# `all' target to force `all' to be the first target, so that -# a `make' will `make all'. -# -all: diff --git a/usr/src/cmd/mdb/sparc/Makefile.sparcv9 b/usr/src/cmd/mdb/sparc/Makefile.sparcv9 deleted file mode 100644 index 1b46a7e8ec..0000000000 --- a/usr/src/cmd/mdb/sparc/Makefile.sparcv9 +++ /dev/null @@ -1,76 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/mdb/Makefile.tools - -MACHDIR=sparcv9 -MACHMODDIR=/$(MACHDIR) - -ROOTMOD = $(ROOT)/usr/lib/mdb/$(MDBTGT)$(MACHMODDIR) -ROOTKMOD = $(ROOT)/kernel/kmdb$(MACHMODDIR) - -CFLAGS = $(CTF_FLAGS) $(XSTRCONST) -CFLAGS64 += $(CTF_FLAGS) $(XSTRCONST) -CPPFLAGS += -D_ELF64 -CTFSTABSCFLAGS = $(CFLAGS64) $(CALLSYMS) - -LINTTAGS1 = E_BAD_FORMAT_STR2,E_INCONS_ARG_DECL2,E_INCONS_VAL_TYPE_DECL2 -LINTTAGS2 = E_BAD_FORMAT_ARG_TYPE2 -LINTFLAGS64 += -u -erroff=$(LINTTAGS1),$(LINTTAGS2) -LINTFLAGS = $(LINTFLAGS64) - -# Used to locate the SPARC kmdb linktest object -KMDBDIR = $(SRC)/cmd/mdb/sparc/v9/kmdb - -# Used to test objects ($@) for the presence of FP code -KMDB_FPTEST = \ - $(FINDFP) $@ - -PROMINCDIRS += $(SRC)/uts/sparc/v7 - -LFLAGS = -t -v -YFLAGS = -d -v - -MMU = sfmmu -ISADIR = sparc/v9 - -# -# Dummy `all' target to force `all' to be the first target, so that -# a `make' will `make all'. -# -all: - -$$(ROOTMOD)/%: dmod/% - $(INS.file) - -$$(ROOTKMOD)/%: kmod/% - $(INS.file) - -$(ROOTMOD): $(ROOT)/usr/lib/mdb/$(MDBTGT) - $(INS.dir) - -$(ROOTKMOD): $(ROOT)/kernel/kmdb - $(INS.dir) diff --git a/usr/src/cmd/mdb/sparc/kmdb/kaif.c b/usr/src/cmd/mdb/sparc/kmdb/kaif.c deleted file mode 100644 index 6251b2e30e..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kaif.c +++ /dev/null @@ -1,1013 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * The debugger/PROM interface - */ - -#include <sys/types.h> -#include <sys/mmu.h> - -#ifndef sun4v -#include <sys/spitregs.h> -#endif /* sun4v */ - -#include <sys/machasi.h> -#include <sys/machtrap.h> -#include <sys/trap.h> -#include <sys/privregs.h> - -#include <kmdb/kaif.h> -#include <kmdb/kaif_regs.h> -#include <kmdb/kmdb_asmutil.h> -#include <kmdb/kmdb_kdi.h> -#include <kmdb/kmdb_promif_isadep.h> -#include <kmdb/kmdb_dpi_impl.h> -#include <mdb/mdb_debug.h> -#include <mdb/mdb_err.h> -#include <mdb/mdb_modapi.h> -#include <mdb/mdb_nv.h> -#include <mdb/mdb_kreg_impl.h> -#include <mdb/mdb_v9util.h> -#include <mdb/mdb.h> - -#define KAIF_PREGNO_PSTATE 0x6 /* %pstate is priv reg 6 */ -#define KAIF_BRKPT_INSTR 0x91d0207e /* ta 0x7e */ - - -#define OP(x) ((x) >> 30) -#define OP2(x) (((x) >> 22) & 0x07) -#define OP3(x) (((x) >> 19) & 0x3f) -#define COND(x) (((x) >> 25) & 0x0f) -#define RD(x) (((x) >> 25) & 0x1f) -#define RS1(x) (((x) >> 14) & 0x1f) -#define RS2(x) ((x) & 0x1f) - -#define OP_BRANCH 0x0 -#define OP_ARITH 0x2 - -#define OP2_BPcc 0x1 -#define OP2_Bicc 0x2 -#define OP2_BPr 0x3 -#define OP2_FBPfcc 0x5 -#define OP2_FBfcc 0x6 - -#define OP3_RDPR 0x2a -#define OP3_WRPR 0x32 - -#define A(x) (((x) >> 29) & 0x01) -#define I(x) (((x) >> 13) & 0x01) -#define DISP16(x) ((((x) >> 6) & 0xc000) | ((x) & 0x3fff)) -#define DISP22(x) ((x) & 0x3fffff) -#define DISP19(x) ((x) & 0x7ffff) -#define SIMM13(x) ((x) & 0x1fff) - -static uint64_t kaif_vwapt_addr; -static uint64_t kaif_pwapt_addr; - -#ifndef sun4v -static uint64_t kaif_lsuctl; -#endif /* sun4v */ - -kaif_cpusave_t *kaif_cpusave; -int kaif_ncpusave; -caddr_t kaif_dseg; -caddr_t kaif_dseg_lim; -caddr_t kaif_tba; /* table currently in use */ -caddr_t kaif_tba_obp; /* obp's trap table */ -caddr_t kaif_tba_native; /* our table; needs khat */ -#ifdef sun4v -caddr_t kaif_tba_kernel; /* kernel's trap table */ -#endif /* sun4v */ -size_t kaif_tba_native_sz; -int *kaif_promexitarmp; -int kaif_trap_switch; - -void (*kaif_modchg_cb)(struct modctl *, int); -void (*kaif_ktrap_install)(int, void (*)(void)); -void (*kaif_ktrap_restore)(void); - -static int -kaif_get_master_cpuid(void) -{ - return (kaif_master_cpuid); -} - -/*ARGSUSED*/ -static int -kaif_get_nwin(int cpuid) -{ - return (get_nwin()); -} - -static kaif_cpusave_t * -kaif_cpuid2save(int cpuid) -{ - kaif_cpusave_t *save; - - if (cpuid == DPI_MASTER_CPUID) - return (&kaif_cpusave[kaif_master_cpuid]); - - if (cpuid < 0 || cpuid >= kaif_ncpusave) { - (void) set_errno(EINVAL); - return (NULL); - } - - save = &kaif_cpusave[cpuid]; - - if (save->krs_cpu_state != KAIF_CPU_STATE_MASTER && - save->krs_cpu_state != KAIF_CPU_STATE_SLAVE) { - (void) set_errno(EINVAL); - return (NULL); - } - - return (save); -} - -static int -kaif_get_cpu_state(int cpuid) -{ - kaif_cpusave_t *save; - - if ((save = kaif_cpuid2save(cpuid)) == NULL) - return (-1); /* errno is set for us */ - - switch (save->krs_cpu_state) { - case KAIF_CPU_STATE_MASTER: - return (DPI_CPU_STATE_MASTER); - case KAIF_CPU_STATE_SLAVE: - return (DPI_CPU_STATE_SLAVE); - default: - return (set_errno(EINVAL)); - } -} - -static const mdb_tgt_gregset_t * -kaif_get_gregs(int cpuid) -{ - kaif_cpusave_t *save; - mdb_tgt_gregset_t *gregs; - int wp, i; - - if ((save = kaif_cpuid2save(cpuid)) == NULL) - return (NULL); /* errno is set for us */ - - gregs = &save->krs_gregs; - - /* - * The DPI startup routine populates the register window portions of - * the kaif_cpusave_t. We copy the current set of ins, outs, and - * locals to the gregs. We also extract %pstate from %tstate. - */ - wp = gregs->kregs[KREG_CWP]; - for (i = 0; i < 8; i++) { - gregs->kregs[KREG_L0 + i] = save->krs_rwins[wp].rw_local[i]; - gregs->kregs[KREG_I0 + i] = save->krs_rwins[wp].rw_in[i]; - } - - gregs->kregs[KREG_PSTATE] = KREG_TSTATE_PSTATE(save->krs_tstate); - - if (++wp == kaif_get_nwin(cpuid)) - wp = 0; - - for (i = 0; i < 8; i++) - gregs->kregs[KREG_O0 + i] = save->krs_rwins[wp].rw_in[i]; - - return (gregs); -} - -static kreg_t * -kaif_find_regp(kaif_cpusave_t *save, const char *regname) -{ - mdb_tgt_gregset_t *gregs; - int nwin, i; - int win; - - nwin = kaif_get_nwin(DPI_MASTER_CPUID); - - gregs = &save->krs_gregs; - - win = gregs->kregs[KREG_CWP]; - - if (strcmp(regname, "sp") == 0) - regname = "o6"; - else if (strcmp(regname, "fp") == 0) - regname = "i6"; - - if (strlen(regname) == 2 && regname[1] >= '0' && regname[1] <= '7') { - int idx = regname[1] - '0'; - - switch (regname[0]) { - case 'o': - if (++win == nwin) - win = 0; - /*FALLTHROUGH*/ - case 'i': - return ((kreg_t *)&save->krs_rwins[win].rw_in[idx]); - case 'l': - return ((kreg_t *)&save->krs_rwins[win].rw_local[idx]); - } - } - - for (i = 0; mdb_sparcv9_kregs[i].rd_name != NULL; i++) { - const mdb_tgt_regdesc_t *rd = &mdb_sparcv9_kregs[i]; - - if (strcmp(rd->rd_name, regname) == 0) - return (&gregs->kregs[rd->rd_num]); - } - - (void) set_errno(ENOENT); - return (NULL); -} - -static int -kaif_get_register(const char *regname, kreg_t *valp) -{ - kaif_cpusave_t *save; - kreg_t *regp; - - save = kaif_cpuid2save(DPI_MASTER_CPUID); - - if (strcmp(regname, "pstate") == 0) { - *valp = KREG_TSTATE_PSTATE(save->krs_tstate); - return (0); - } - - if ((regp = kaif_find_regp(save, regname)) == NULL) - return (-1); - - *valp = *regp; - - return (0); -} - -static int -kaif_set_register(const char *regname, kreg_t val) -{ - kaif_cpusave_t *save; - kreg_t *regp; - - save = kaif_cpuid2save(DPI_MASTER_CPUID); - - if (strcmp(regname, "g0") == 0) { - return (0); - - } else if (strcmp(regname, "pstate") == 0) { - save->krs_tstate &= ~KREG_TSTATE_PSTATE_MASK; - save->krs_tstate |= (val & KREG_PSTATE_MASK) << - KREG_TSTATE_PSTATE_SHIFT; - return (0); - } - - if ((regp = kaif_find_regp(save, regname)) == NULL) - return (-1); - - *regp = val; - - return (0); -} - -static int -kaif_brkpt_arm(uintptr_t addr, mdb_instr_t *instrp) -{ - mdb_instr_t bkpt = KAIF_BRKPT_INSTR; - - if (mdb_tgt_vread(mdb.m_target, instrp, sizeof (mdb_instr_t), addr) != - sizeof (mdb_instr_t)) - return (-1); /* errno is set for us */ - - if (mdb_tgt_vwrite(mdb.m_target, &bkpt, sizeof (mdb_instr_t), addr) != - sizeof (mdb_instr_t)) - return (-1); /* errno is set for us */ - - return (0); -} - -static int -kaif_brkpt_disarm(uintptr_t addr, mdb_instr_t instrp) -{ - if (mdb_tgt_vwrite(mdb.m_target, &instrp, sizeof (mdb_instr_t), addr) != - sizeof (mdb_instr_t)) - return (-1); /* errno is set for us */ - - return (0); -} - -/* - * Calculate the watchpoint mask byte (VM or PM, as appropriate). A 1 bit in - * the mask indicates that the corresponding byte in the watchpoint address - * should be used for activation comparison. - */ -/* - * Sun4v doesn't have watchpoint regs - */ -#ifndef sun4v -static uchar_t -kaif_wapt_calc_mask(size_t len) -{ - int pow; - - if (len == 8) - return (0xff); - - for (pow = 0; len > 1; len /= 256, pow++) - ; - - return (~((1 << pow) - 1)); -} -#endif - -/* - * UltraSPARC processors have one physical and one virtual watchpoint. These - * watchpoints are specified by setting the address in a register, and by - * setting a selector byte in another register to determine which bytes of the - * address are to be used for comparison. For simplicity, we only support - * selector byte values whose bit patterns match the regexp "1+0*". Watchpoint - * addresses must be 8-byte aligned on these chips, so a selector byte of 0xff - * indicates an 8-byte watchpoint. Successive valid sizes are powers of 256, - * starting with 256. - */ -static int -kaif_wapt_validate(kmdb_wapt_t *wp) -{ - if (wp->wp_wflags & MDB_TGT_WA_X) { - warn("execute watchpoints are not supported on this " - "platform\n"); - return (set_errno(EMDB_TGTNOTSUP)); - } - - if (wp->wp_size % 0xff != 0 && wp->wp_size != 8) { - warn("watchpoint size must be 8 or a power of 256 bytes\n"); - return (set_errno(EINVAL)); - } - - if (wp->wp_addr & (wp->wp_size - 1)) { - warn("%lu-byte watchpoints must be %lu-byte aligned\n", - wp->wp_size, wp->wp_size); - return (set_errno(EINVAL)); - } - - if (wp->wp_type != DPI_WAPT_TYPE_PHYS && - wp->wp_type != DPI_WAPT_TYPE_VIRT) { - warn("requested watchpoint type not supported on this " - "platform\n"); - return (set_errno(EMDB_TGTHWNOTSUP)); - } - - return (0); -} - -static int -kaif_wapt_reserve(kmdb_wapt_t *wp) -{ -#ifdef sun4v -#ifdef lint - ASSERT(wp == (kmdb_wapt_t *)wp); -#endif /* !lint */ - /* Watchpoints not supported */ - return (set_errno(EMDB_TGTHWNOTSUP)); -#else - uint64_t *addrp; - - if (wp->wp_type == DPI_WAPT_TYPE_PHYS) - addrp = &kaif_pwapt_addr; - else - addrp = &kaif_vwapt_addr; - - if (*addrp != 0) - return (set_errno(EMDB_WPTOOMANY)); - - *addrp = wp->wp_addr; - - return (0); -#endif -} - -static void -kaif_wapt_release(kmdb_wapt_t *wp) -{ - uint64_t *addrp = (wp->wp_type == DPI_WAPT_TYPE_PHYS ? - &kaif_pwapt_addr : &kaif_vwapt_addr); - - ASSERT(*addrp != 0); - *addrp = 0; -} - -/*ARGSUSED*/ -static void -kaif_wapt_arm(kmdb_wapt_t *wp) -{ - /* - * Sun4v doesn't have watch point regs - */ -#ifndef sun4v - uint64_t mask = kaif_wapt_calc_mask(wp->wp_size); - - if (wp->wp_type == DPI_WAPT_TYPE_PHYS) { - kaif_lsuctl &= ~KAIF_LSUCTL_PWAPT_MASK; - - if (wp->wp_wflags & MDB_TGT_WA_R) - kaif_lsuctl |= LSU_PR; - if (wp->wp_wflags & MDB_TGT_WA_W) - kaif_lsuctl |= LSU_PW; - kaif_lsuctl |= ((mask << LSU_PM_SHIFT) & LSU_PM); - - } else if (wp->wp_type == DPI_WAPT_TYPE_VIRT) { - kaif_lsuctl &= ~KAIF_LSUCTL_VWAPT_MASK; - - if (wp->wp_wflags & MDB_TGT_WA_R) - kaif_lsuctl |= LSU_VR; - if (wp->wp_wflags & MDB_TGT_WA_W) - kaif_lsuctl |= LSU_VW; - kaif_lsuctl |= ((mask << LSU_VM_SHIFT) & LSU_VM); - } -#endif /* sun4v */ -} - -/*ARGSUSED*/ -static void -kaif_wapt_disarm(kmdb_wapt_t *wp) -{ - /* - * Sun4v doesn't have watch point regs - */ -#ifndef sun4v - if (wp->wp_type == DPI_WAPT_TYPE_PHYS) { - ASSERT(kaif_pwapt_addr != NULL); - kaif_lsuctl &= ~(LSU_PR|LSU_PW); - } else { - ASSERT(kaif_vwapt_addr != NULL); - kaif_lsuctl &= ~(LSU_VR|LSU_VW); - } -#endif -} - -/* - * `kaif_wapt_arm' and `kaif_wapt_disarm' modify the global state we keep that - * indicates what the values of the wapt control registers should be. These - * values must be individually set and cleared on each active CPU, a task which - * is performed by `kaif_wapt_clear_regs' and `kaif_wapt_set_regs', invoked as - * the world is stopped and resumed, respectively. `kaif_wapt_set_regs' is also - * used for CPU initialization. - */ -void -kaif_wapt_set_regs(void) -{ - /* - * Sun4v doesn't have watch point regs - */ -#ifndef sun4v - uint64_t lsu; - - wrasi(ASI_DMMU, MMU_VAW, kaif_vwapt_addr); - wrasi(ASI_DMMU, MMU_PAW, kaif_pwapt_addr); - - ASSERT((kaif_lsuctl & ~KAIF_LSUCTL_WAPT_MASK) == NULL); - - lsu = rdasi(ASI_LSU, (uintptr_t)NULL); - lsu &= ~KAIF_LSUCTL_WAPT_MASK; - lsu |= kaif_lsuctl; - wrasi(ASI_LSU, (uintptr_t)NULL, lsu); -#endif /* sun4v */ -} - -void -kaif_wapt_clear_regs(void) -{ - /* - * Sun4v doesn't have watch point regs - */ -#ifndef sun4v - uint64_t lsu = rdasi(ASI_LSU, (uintptr_t)NULL); - lsu &= ~KAIF_LSUCTL_WAPT_MASK; - wrasi(ASI_LSU, (uintptr_t)NULL, lsu); -#endif /* sun4v */ -} - -/* - * UltraSPARC has one PA watchpoint and one VA watchpoint. The trap we get will - * tell us which one we hit, but it won't tell us where. We could attempt to - * dissect the instruction at %pc to see where it was reading from or writing - * to, but that gets messy in a hurry. We can, however, make a couple of - * assumptions: - * - * - kaif_set_watchpoint and kaif_delete_watchpoint will enforce the limits as - * to the number of watch points. As such, at most one VA watchpoint and one - * PA watchpoint will be on the active list. - * - * - We'll only be called on watchpoints that are on the active list. - * - * Taking these two assumptions, we can conclude that, if we're stopped due to - * a watchpoint and we're asked to match against a watchpoint, we must have - * stopped due to the watchpoint. This is all very terrifying, but the - * alternative (taking instructions apart) is worse. - */ -/*ARGSUSED*/ -static int -kaif_wapt_match(kmdb_wapt_t *wp) -{ - int state, why, deswhy; - - state = kmdb_dpi_get_state(&why); - - if (wp->wp_type == DPI_WAPT_TYPE_PHYS) - deswhy = DPI_STATE_WHY_P_WAPT; - else - deswhy = DPI_STATE_WHY_V_WAPT; - - return (state == DPI_STATE_FAULTED && why == deswhy); -} - -static const char * -regno2name(int idx) -{ - const mdb_tgt_regdesc_t *rd; - - for (rd = mdb_sparcv9_kregs; rd->rd_name != NULL; rd++) { - if (idx == rd->rd_num) - return (rd->rd_name); - } - - ASSERT(rd->rd_name != NULL); - - return ("unknown"); -} - -/* - * UltraSPARC doesn't support single-step natively, so we have to do it - * ourselves, by placing breakpoints at the instruction after the current one. - * Note that "after" will be %npc in the simple case, but can be one of - * several places if %pc is a branch. - * - * If %pc is an unconditional annulled branch, we put a breakpoint at the branch - * target. If it is a conditional annulled branch, we put breakpoints at %pc + - * 8 and the branch target. For all other branches, %npc will be set correctly - * as determined by the branch condition, and thus we can step through the - * branch by putting a breakpoint at %npc. If %pc contains a non-branch - * instruction (with the exception of certain rdpr and wrpr instructions, - * described more below), we step over it by placing a breakpoint at %npc. - */ -static int -kaif_step(void) -{ - kreg_t pc, npc, brtgt, pstate, tt; - int bptgt = 0, bpnpc = 0, bppc8 = 0; - mdb_instr_t svtgt = 0, svnpc = 0, svpc8 = 0; - mdb_instr_t instr; - int ie, err; - - (void) kmdb_dpi_get_register("pc", &pc); - (void) kmdb_dpi_get_register("npc", &npc); - - if (mdb_tgt_vread(mdb.m_target, &instr, sizeof (instr), pc) != - sizeof (instr)) { - warn("failed to read %%pc at %p for step", (void *)pc); - return (-1); - } - - /* - * If the current instruction is a read or write of PSTATE we need - * to emulate it because we've taken over management of PSTATE and - * we need keep interrupts disabled. If it's a branch, we may need - * to set two breakpoints -- one at the target and one at the - * subsequent instruction. - */ - if (OP(instr) == OP_ARITH) { - if (OP3(instr) == OP3_RDPR && - RS1(instr) == KAIF_PREGNO_PSTATE) { - const char *tgtreg = - mdb_sparcv9_kregs[RD(instr)].rd_name; - kreg_t pstate; - - (void) kmdb_dpi_get_register("pstate", &pstate); - (void) kmdb_dpi_set_register(tgtreg, pstate); - - (void) kmdb_dpi_set_register("pc", npc); - (void) kmdb_dpi_set_register("npc", npc + 4); - return (0); - - } else if (OP3(instr) == OP3_WRPR && - RD(instr) == KAIF_PREGNO_PSTATE) { - kreg_t rs1, rs2, val; - - (void) kmdb_dpi_get_register(regno2name(RS1(instr)), - &rs1); - - if (I(instr)) { - int imm = SIMM13(instr); - imm <<= 19; - imm >>= 19; - rs2 = imm; - } else { - (void) kmdb_dpi_get_register( - regno2name(RS2(instr)), &rs2); - } - - val = rs1 ^ rs2; - - (void) kmdb_dpi_set_register("pstate", val); - - (void) kmdb_dpi_set_register("pc", npc); - (void) kmdb_dpi_set_register("npc", npc + 4); - return (0); - - } - - bpnpc = 1; - - } else if (OP(instr) == OP_BRANCH) { - int disp, cond, annul; - - switch (OP2(instr)) { - case OP2_BPcc: - case OP2_FBPfcc: - cond = (COND(instr) != 8); - - disp = DISP19(instr); - disp <<= 13; - disp >>= 11; - break; - - case OP2_Bicc: - case OP2_FBfcc: - cond = (COND(instr) != 8); - - disp = DISP22(instr); - disp <<= 10; - disp >>= 8; - break; - - case OP2_BPr: - cond = 1; - - disp = DISP16(instr); - disp <<= 16; - disp >>= 14; - break; - - default: - bpnpc = 1; - } - - if (!bpnpc) { - annul = A(instr); - - if (!cond && annul) { - brtgt = pc + disp; - bptgt = 1; - } else { - bpnpc = 1; - - if (cond && annul) - bppc8 = 1; - } - } - - } else { - bpnpc = 1; - } - - /* - * Place the breakpoints and resume this CPU with IE off. We'll come - * back after having encountered either one of the breakpoints we placed - * or a trap. - */ - err = 0; - if ((bpnpc && kaif_brkpt_arm(npc, &svnpc) != 0) || - (bppc8 && kaif_brkpt_arm(pc + 8, &svpc8) != 0) || - (bptgt && kaif_brkpt_arm(brtgt, &svtgt) != 0)) { - err = errno; - goto step_done; - } - - (void) kmdb_dpi_get_register("pstate", &pstate); - ie = pstate & KREG_PSTATE_IE_MASK; - (void) kmdb_dpi_set_register("pstate", (pstate & ~KREG_PSTATE_IE_MASK)); - - kmdb_dpi_resume_master(); /* ... there and back again ... */ - - (void) kmdb_dpi_get_register("pstate", &pstate); - (void) kmdb_dpi_set_register("pstate", - ((pstate & ~KREG_PSTATE_IE_MASK) | ie)); - - (void) kmdb_dpi_get_register("tt", &tt); - -step_done: - if (svnpc) - (void) kaif_brkpt_disarm(npc, svnpc); - if (svpc8) - (void) kaif_brkpt_disarm(pc + 8, svpc8); - if (svtgt) - (void) kaif_brkpt_disarm(brtgt, svtgt); - - return (err == 0 ? 0 : set_errno(err)); -} - -static uintptr_t -kaif_call(uintptr_t funcva, uint_t argc, const uintptr_t *argv) -{ - kreg_t g6, g7; - - (void) kmdb_dpi_get_register("g6", &g6); - (void) kmdb_dpi_get_register("g7", &g7); - - return (kaif_invoke(funcva, argc, argv, g6, g7)); -} - -static const mdb_bitmask_t krm_flag_bits[] = { - { "M_W", KAIF_CRUMB_F_MAIN_OBPWAPT, KAIF_CRUMB_F_MAIN_OBPWAPT }, - { "M_PE", KAIF_CRUMB_F_MAIN_OBPPENT, KAIF_CRUMB_F_MAIN_OBPPENT }, - { "M_NRM", KAIF_CRUMB_F_MAIN_NORMAL, KAIF_CRUMB_F_MAIN_NORMAL }, - { "I_RE", KAIF_CRUMB_F_IVEC_REENTER, KAIF_CRUMB_F_IVEC_REENTER }, - { "I_OBP", KAIF_CRUMB_F_IVEC_INOBP, KAIF_CRUMB_F_IVEC_INOBP }, - { "I_NRM", KAIF_CRUMB_F_IVEC_NORMAL, KAIF_CRUMB_F_IVEC_NORMAL }, - { "O_NRM", KAIF_CRUMB_F_OBP_NORMAL, KAIF_CRUMB_F_OBP_NORMAL }, - { "O_REVEC", KAIF_CRUMB_F_OBP_REVECT, KAIF_CRUMB_F_OBP_REVECT }, - { NULL } -}; - -static void -dump_crumb(kaif_crumb_t *krmp) -{ - kaif_crumb_t krm; - - if (mdb_vread(&krm, sizeof (kaif_crumb_t), (uintptr_t)krmp) != - sizeof (kaif_crumb_t)) { - warn("failed to read crumb at %p", krmp); - return; - } - - mdb_printf(" src: "); - switch (krm.krm_src) { - case KAIF_CRUMB_SRC_OBP: - mdb_printf("O"); - break; - case KAIF_CRUMB_SRC_IVEC: - mdb_printf("I"); - break; - case KAIF_CRUMB_SRC_MAIN: - mdb_printf("M"); - break; - case 0: - mdb_printf("-"); - break; - default: - mdb_printf("%d", krm.krm_src); - } - - mdb_printf(" tt %3x pc %8p %-20A <%b>\n", - krm.krm_tt, krm.krm_pc, krm.krm_pc, krm.krm_flag, krm_flag_bits); -} - -static void -dump_crumbs(kaif_cpusave_t *save) -{ - int i; - - for (i = KAIF_NCRUMBS; i > 0; i--) { - uint_t idx = (save->krs_curcrumbidx + i) % KAIF_NCRUMBS; - dump_crumb(&save->krs_crumbs[idx]); - } -} - -static void -kaif_dump_crumbs(uintptr_t addr, int cpuid) -{ - int i; - - if (addr != (uintptr_t)NULL) { - /* dump_crumb will protect us from bogus addresses */ - dump_crumb((kaif_crumb_t *)addr); - - } else if (cpuid != -1) { - if (cpuid >= kaif_ncpusave) - return; - - dump_crumbs(&kaif_cpusave[cpuid]); - - } else { - for (i = 0; i < kaif_ncpusave; i++) { - kaif_cpusave_t *save = &kaif_cpusave[i]; - - if (save->krs_cpu_state == KAIF_CPU_STATE_NONE) - continue; - - mdb_printf("%sCPU %d crumbs: (curidx %d)\n", - (i == 0 ? "" : "\n"), i, save->krs_curcrumbidx); - - dump_crumbs(save); - } - } -} - -static int -kaif_get_rwin(int cpuid, int win, struct rwindow *rwin) -{ - kaif_cpusave_t *save; - - if ((save = kaif_cpuid2save(cpuid)) == NULL) - return (-1); /* errno is set for us */ - - if (win < 0 || win >= kaif_get_nwin(cpuid)) - return (-1); - - bcopy(&save->krs_rwins[win], rwin, sizeof (struct rwindow)); - - return (0); -} - -static void -kaif_enter_mon(void) -{ - kmdb_prom_enter_mon(); - kaif_prom_rearm(); - kaif_slave_loop_barrier(); -} - -static void -kaif_modchg_register(void (*func)(struct modctl *, int)) -{ - kaif_modchg_cb = func; -} - -static void -kaif_modchg_cancel(void) -{ - ASSERT(kaif_modchg_cb != NULL); - - kaif_modchg_cb = NULL; -} - -void -kaif_mod_loaded(struct modctl *modp) -{ - if (kaif_modchg_cb != NULL) - kaif_modchg_cb(modp, 1); -} - -void -kaif_mod_unloading(struct modctl *modp) -{ - if (kaif_modchg_cb != NULL) - kaif_modchg_cb(modp, 0); -} - -void -kaif_trap_set_debugger(void) -{ - (void) set_tba((void *)kaif_tba); -} - -void -kaif_trap_set_saved(kaif_cpusave_t *save) -{ - (void) set_tba((void *)save->krs_gregs.kregs[KREG_TBA]); -} - -static void -kaif_kernpanic(int cpuid) -{ - struct regs regs; - - /* - * We're going to try to panic the system by using the same entry point - * used by the PROM when told to `sync'. The kernel wants a - * fully-populated struct regs, which we're going to build using the - * state captured at the time of the debugger fault. Said state lives - * in kaif_cb_save, since we haven't yet copied it over to the cpusave - * structure for the current master. - */ - - regs.r_tstate = kaif_cb_save.krs_tstate; - - regs.r_g1 = kaif_cb_save.krs_gregs.kregs[KREG_G1]; - regs.r_g2 = kaif_cb_save.krs_gregs.kregs[KREG_G2]; - regs.r_g3 = kaif_cb_save.krs_gregs.kregs[KREG_G3]; - regs.r_g4 = kaif_cb_save.krs_gregs.kregs[KREG_G4]; - regs.r_g5 = kaif_cb_save.krs_gregs.kregs[KREG_G5]; - regs.r_g6 = kaif_cb_save.krs_gregs.kregs[KREG_G6]; - regs.r_g7 = kaif_cb_save.krs_gregs.kregs[KREG_G7]; - - regs.r_o0 = kaif_cb_save.krs_gregs.kregs[KREG_O0]; - regs.r_o1 = kaif_cb_save.krs_gregs.kregs[KREG_O1]; - regs.r_o2 = kaif_cb_save.krs_gregs.kregs[KREG_O2]; - regs.r_o3 = kaif_cb_save.krs_gregs.kregs[KREG_O3]; - regs.r_o4 = kaif_cb_save.krs_gregs.kregs[KREG_O4]; - regs.r_o5 = kaif_cb_save.krs_gregs.kregs[KREG_O5]; - regs.r_o6 = kaif_cb_save.krs_gregs.kregs[KREG_O6]; - regs.r_o7 = kaif_cb_save.krs_gregs.kregs[KREG_O7]; - - regs.r_pc = kaif_cb_save.krs_gregs.kregs[KREG_PC]; - regs.r_npc = kaif_cb_save.krs_gregs.kregs[KREG_NPC]; - regs.r_y = kaif_cb_save.krs_gregs.kregs[KREG_Y]; - - /* - * The %tba is, as ever, different. We don't want the %tba from the - * time of the fault -- that'll be the debugger's. We want the %tba - * saved when the debugger was initially entered. It'll be saved in - * the cpusave area for the current CPU. - */ - (void) set_tba((void *)kaif_cpusave[cpuid].krs_gregs.kregs[KREG_TBA]); - - kmdb_kdi_kernpanic(®s, kaif_cb_save.krs_gregs.kregs[KREG_TT]); -} - -static int -kaif_init(kmdb_auxv_t *kav) -{ - struct rwindow *rwins; - int nwin = get_nwin(); - int i; - - kaif_vwapt_addr = kaif_pwapt_addr = 0; - - kaif_tba = kav->kav_tba_active; - kaif_tba_obp = kav->kav_tba_obp; - kaif_tba_native = kav->kav_tba_native; - kaif_tba_native_sz = kav->kav_tba_native_sz; -#ifdef sun4v - kaif_tba_kernel = kav->kav_tba_kernel; -#endif - - /* Allocate the per-CPU save areas */ - kaif_cpusave = mdb_zalloc(sizeof (kaif_cpusave_t) * kav->kav_ncpu, - UM_SLEEP); - kaif_ncpusave = kav->kav_ncpu; - - rwins = mdb_zalloc(sizeof (struct rwindow) * nwin * kav->kav_ncpu, - UM_SLEEP); - - for (i = 0; i < kaif_ncpusave; i++) { - kaif_cpusave_t *save = &kaif_cpusave[i]; - - save->krs_cpu_id = i; - save->krs_rwins = &rwins[nwin * i]; - save->krs_curcrumbidx = KAIF_NCRUMBS - 1; - save->krs_curcrumb = &save->krs_crumbs[save->krs_curcrumbidx]; - } - - kaif_dseg = kav->kav_dseg; - kaif_dseg_lim = kav->kav_dseg + kav->kav_dseg_size; - - kaif_promexitarmp = kav->kav_promexitarmp; - - kaif_ktrap_install = kav->kav_ktrap_install; - kaif_ktrap_restore = kav->kav_ktrap_restore; - - kaif_modchg_cb = NULL; - - kaif_trap_switch = (kav->kav_flags & KMDB_AUXV_FL_NOTRPSWTCH) == 0; - - return (0); -} - -dpi_ops_t kmdb_dpi_ops = { - kaif_init, - kaif_activate, - kaif_deactivate, - kaif_enter_mon, - kaif_modchg_register, - kaif_modchg_cancel, - kaif_get_cpu_state, - kaif_get_master_cpuid, - kaif_get_gregs, - kaif_get_register, - kaif_set_register, - kaif_get_rwin, - kaif_get_nwin, - kaif_brkpt_arm, - kaif_brkpt_disarm, - kaif_wapt_validate, - kaif_wapt_reserve, - kaif_wapt_release, - kaif_wapt_arm, - kaif_wapt_disarm, - kaif_wapt_match, - kaif_step, - kaif_call, - kaif_dump_crumbs, - kaif_kernpanic -}; diff --git a/usr/src/cmd/mdb/sparc/kmdb/kaif.fdbg b/usr/src/cmd/mdb/sparc/kmdb/kaif.fdbg deleted file mode 100644 index 8bfd7da376..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kaif.fdbg +++ /dev/null @@ -1,41 +0,0 @@ - -\ Copyright 2005 Sun Microsystems, Inc. All rights reserved. -\ Use is subject to license terms. -\ -\ 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 -\ or http://www.opensolaris.org/os/licensing. -\ 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 -\ -#ident "%Z%%M% %I% %E% SMI" - -#include <kmdb/kaif_regs.h> - -kaif_cpusave - krs_rwins - krs_tstate - krs_mmu_pcontext - krs_cpu_state - krs_cpu_flushed - krs_lsucr_save - krs_instr_save - krs_cpu_id - krs_curcrumbidx - krs_curcrumb - -kaif_crumb diff --git a/usr/src/cmd/mdb/sparc/kmdb/kaif.h b/usr/src/cmd/mdb/sparc/kmdb/kaif.h deleted file mode 100644 index 50445df8a3..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kaif.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -#ifndef _KAIF_H -#define _KAIF_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef sun4v -#include <sys/spitregs.h> -#endif /* sun4v */ - -#ifndef _ASM -#include <kmdb/kmdb_dpi_impl.h> -#include <kmdb/kaif_regs.h> -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define KAIF_CPU_STATE_NONE 0 -#define KAIF_CPU_STATE_MASTER 1 -#define KAIF_CPU_STATE_SLAVE 2 - -#define KAIF_LSUCTL_VWAPT_MASK (LSU_VM|LSU_VR|LSU_VW) -#define KAIF_LSUCTL_PWAPT_MASK (LSU_PM|LSU_PR|LSU_PW) -#define KAIF_LSUCTL_WAPT_MASK (LSU_PM|LSU_VM|LSU_PR|LSU_PW|LSU_VR|LSU_VW) - -#ifndef _ASM -extern kaif_cpusave_t *kaif_cpusave; -extern kaif_cpusave_t kaif_cb_save; -extern int kaif_ncpusave; -extern int kaif_master_cpuid; - -extern int *kaif_promexitarmp; - -extern void (*kaif_ktrap_install)(int, void (*)(void)); -extern void (*kaif_ktrap_restore)(void); - -extern caddr_t kaif_tba; -extern caddr_t kaif_tba_obp; -#ifdef sun4v -extern caddr_t kaif_tba_kernel; -#endif -extern caddr_t kaif_tba_native; -extern size_t kaif_tba_native_sz; - -extern int kaif_trap_switch; - -extern void kaif_trap_set_debugger(void); -extern void kaif_trap_set_saved(kaif_cpusave_t *); - -extern void kaif_hdlr_imiss(void); -extern caddr_t kaif_hdlr_imiss_patch; -extern void kaif_hdlr_dmiss(void); -extern caddr_t kaif_hdlr_dmiss_patch; -extern void kaif_hdlr_generic(void); -extern void kaif_dtrap(void); - -extern caddr_t kaif_dseg_start; -extern caddr_t kaif_dseg_lim; - -extern uintptr_t kaif_invoke(uintptr_t, uint_t, const uintptr_t[], - kreg_t, kreg_t); - -extern void kaif_enter(void); - -extern void kaif_ktrap(void); -extern void kaif_slave_entry(void); -extern void kaif_trap_obp(void); - -extern void kaif_mod_loaded(struct modctl *); -extern void kaif_mod_unloading(struct modctl *); - -extern void kaif_wapt_set_regs(void); -extern void kaif_wapt_clear_regs(void); - -extern void kaif_activate(kdi_debugvec_t **, uint_t); -extern void kaif_deactivate(void); -extern void kaif_resume(int); -extern void kaif_slave_entry(void); -extern void kaif_prom_rearm(void); -extern void kaif_debugger_entry(kaif_cpusave_t *); - -extern void kaif_slave_loop_barrier(void); - -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _KAIF_H */ diff --git a/usr/src/cmd/mdb/sparc/kmdb/kaif_activate.c b/usr/src/cmd/mdb/sparc/kmdb/kaif_activate.c deleted file mode 100644 index 12ce703801..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kaif_activate.c +++ /dev/null @@ -1,312 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -/* - * The debugger/PROM interface layer - debugger activation - */ - -#include <kmdb/kmdb_promif_isadep.h> -#include <kmdb/kmdb_start.h> -#include <kmdb/kmdb_kdi.h> -#include <kmdb/kmdb_asmutil.h> -#include <kmdb/kaif.h> -#include <mdb/mdb_debug.h> -#include <mdb/mdb_kreg.h> - -#include <sys/cpuvar.h> -#include <sys/kdi_impl.h> -#include <sys/machtrap.h> - -kaif_cpusave_t kaif_cb_save; - -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) -{ - static char prom_str[550]; - kreg_t *kregs = kaif_cb_save.krs_gregs.kregs; - int len; - - len = mdb_snprintf(prom_str, sizeof (prom_str), kaif_defer_word_tmpl, - &kregs[KREG_PC], /* 3 */ - &kregs[KREG_NPC], /* 4 */ - &kregs[KREG_G1], /* 5 */ - &kregs[KREG_G2], /* 6 */ - &kregs[KREG_G3], /* 7 */ - &kregs[KREG_G4], /* 8 */ - &kregs[KREG_G5], /* 9 */ - &kregs[KREG_G6], /* 10 */ - &kregs[KREG_G7], /* 11 */ - &kaif_cb_save.krs_tstate, /* 12 */ - &kregs[KREG_TT], /* 13 */ - &kregs[KREG_TBA], /* 14 */ - kaif_trap_obp); /* 15 */ - - if (len >= sizeof (prom_str)) { - mdb_printf("%s: prom_str is too small to fit %d bytes\n", - __func__, len); - } - return (prom_str); -} - -static void -kaif_prom_install(void) -{ - kmdb_prom_interpret(kaif_format_word()); - kmdb_prom_interpret(" ['] kmdb_callback init-debugger-hook "); -} - -void -kaif_prom_rearm(void) -{ - kmdb_prom_interpret(" ['] kmdb_callback is debugger-hook "); -} - -/*ARGSUSED*/ -static void -kaif_cpu_init(cpu_t *cp) -{ - kaif_wapt_set_regs(); -} - -/*ARGSUSED*/ -static void -kaif_install_generic(caddr_t tgt, caddr_t arg) -{ - bcopy((caddr_t)kaif_hdlr_generic, tgt, 32); -} - -#ifdef sun4v - -/*ARGSUSED*/ -static void -kaif_install_goto_tt64(caddr_t tgt, caddr_t arg) -{ - /* LINTED - pointer alignment */ - uint32_t *hdlr = (uint32_t *)tgt; - uint32_t disp = (T_FAST_INSTR_MMU_MISS - T_INSTR_MMU_MISS) * 0x20; - - *hdlr++ = 0x10480000 | (disp >> 2); /* ba,pt (to tt64) */ - *hdlr++ = 0x01000000; /* nop */ -} - -/*ARGSUSED*/ -static void -kaif_install_goto_tt68(caddr_t tgt, caddr_t arg) -{ - /* LINTED - pointer alignment */ - uint32_t *hdlr = (uint32_t *)tgt; - uint32_t disp = (T_FAST_DATA_MMU_MISS - T_DATA_MMU_MISS) * 0x20; - - *hdlr++ = 0x10480000 | (disp >> 2); /* ba,pt (to tt68) */ - *hdlr++ = 0x01000000; /* nop */ -} - -#endif /* sun4v */ - -static void -kaif_install_dmmumiss(caddr_t tgt, caddr_t vatotte) -{ - uint32_t *patch; - - bcopy((caddr_t)kaif_hdlr_dmiss, tgt, 128); - - /* LINTED - pointer alignment */ - patch = (uint32_t *)(tgt + ((uintptr_t)&kaif_hdlr_dmiss_patch - - (uintptr_t)kaif_hdlr_dmiss)); - *patch++ |= (uintptr_t)vatotte >> 10; - *patch |= ((uintptr_t)vatotte) & 0x3ff; -} - -static void -kaif_install_immumiss(caddr_t tgt, caddr_t vatotte) -{ - uint32_t *patch; - - bcopy((caddr_t)kaif_hdlr_imiss, tgt, 128); - - /* LINTED - pointer alignment */ - patch = (uint32_t *)(tgt + ((uintptr_t)&kaif_hdlr_imiss_patch - - (uintptr_t)kaif_hdlr_imiss)); - *patch++ |= (uintptr_t)vatotte >> 10; - *patch |= ((uintptr_t)vatotte) & 0x3ff; -} - -static struct kaif_trap_handlers { - uint_t th_tt; - void (*th_install)(caddr_t, caddr_t); -} kaif_trap_handlers[] = { - { T_INSTR_EXCEPTION, kaif_install_generic }, -#ifdef sun4v - { T_INSTR_MMU_MISS, kaif_install_goto_tt64 }, -#endif - { T_IDIV0, kaif_install_generic }, - { T_DATA_EXCEPTION, kaif_install_generic }, -#ifdef sun4v - { T_DATA_MMU_MISS, kaif_install_goto_tt68 }, -#endif - { T_DATA_ERROR, kaif_install_generic }, - { T_ALIGNMENT, kaif_install_generic }, - { T_FAST_INSTR_MMU_MISS, kaif_install_immumiss }, - { T_FAST_DATA_MMU_MISS, kaif_install_dmmumiss }, - { T_FAST_DATA_MMU_PROT, kaif_install_generic }, -#ifdef sun4v - { T_INSTR_MMU_MISS + T_TL1, kaif_install_goto_tt64 }, - { T_DATA_MMU_MISS + T_TL1, kaif_install_goto_tt68 }, -#endif - { T_FAST_INSTR_MMU_MISS + T_TL1, kaif_install_immumiss }, - { T_FAST_DATA_MMU_MISS + T_TL1, kaif_install_dmmumiss }, - { 0 } -}; - -static void -kaif_trap_init(void) -{ - caddr_t vatotte = kmdb_kdi_get_trap_vatotte(); - uintptr_t brtgt; - 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 */ - uint32_t *hdlr = (uint32_t *)(kaif_tba_native + i); -#ifdef sun4v - brtgt = (uintptr_t)(kaif_tba_kernel + i); -#else - brtgt = (uintptr_t)(kaif_tba_obp + i); -#endif - *hdlr++ = 0x03000000 | (brtgt >> 10); /* sethi brtgt, %g1 */ - *hdlr++ = 0x81c06000 | (brtgt & 0x3ff); /* jmp %g1 + brtgt */ - *hdlr++ = 0x01000000; /* nop */ - } - - for (i = 0; kaif_trap_handlers[i].th_tt != 0; i++) { - struct kaif_trap_handlers *th = &kaif_trap_handlers[i]; - th->th_install(kaif_tba_native + th->th_tt * 0x20, vatotte); - } - membar_producer(); -} - -/* - * 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) -{ - kaif_tba = kaif_tba_native; -} - -/* - * 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) -{ -} - -static kdi_debugvec_t kaif_dvec = { - NULL, /* dv_kctl_vmready */ - NULL, /* dv_kctl_memavail */ - NULL, /* dv_kctl_modavail */ - NULL, /* dv_kctl_thravail */ - kaif_vmready, - NULL, /* dv_memavail */ - kaif_mod_loaded, - kaif_mod_unloading, - NULL, /* dv_kctl_cpu_init */ - kaif_cpu_init, - kaif_cpr_restart -}; - -/*ARGSUSED1*/ -void -kaif_activate(kdi_debugvec_t **dvecp, uint_t flags) -{ - kaif_prom_install(); - - kaif_ktrap_install(0, kaif_ktrap); - kaif_trap_init(); - - *dvecp = &kaif_dvec; -} - -void -kaif_deactivate(void) -{ - kmdb_prom_interpret(" ['] noop is debugger-hook "); - - kaif_ktrap_restore(); -} diff --git a/usr/src/cmd/mdb/sparc/kmdb/kaif_off.in b/usr/src/cmd/mdb/sparc/kmdb/kaif_off.in deleted file mode 100644 index 6d7769144f..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kaif_off.in +++ /dev/null @@ -1,71 +0,0 @@ -\ -\ Copyright 2005 Sun Microsystems, Inc. All rights reserved. -\ Use is subject to license terms. -\ -\ 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 -\ or http://www.opensolaris.org/os/licensing. -\ 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 -\ -\ ident "%Z%%M% %I% %E% SMI" -\ -\ Keep in sync with kaif_regs.h -\ - -#include "kaif_regs.h" - -kaif_crumb_t KRM_SIZE - krm_src - krm_pc - krm_tt - krm_flag - -kaif_cpusave_t KRS_SIZE - krs_gregs - krs_rwins - krs_fpregs - krs_tstate - krs_mmu_pcontext - krs_cpu_state - krs_cpu_id - krs_instr_save - krs_lsucr_save - krs_curcrumbidx - krs_curcrumb - krs_crumbs - krs_cpustack - -mdb_tgt_gregset_t GREG_SIZE - kregs GREG_KREGS - kreg_flags GREG_FLAGS - -mdb_t - m_kdi MDB_KDI - -kdi_t - kdi_mach.mkdi_cpu_index MKDI_CPU_INDEX - -kreg_t KREG_SIZE - -\#define KREG_OFF(name) (name << 3) - -rwindow RWIN_SIZE - -kfpu_t - fpu_fprs - fpu_fsr diff --git a/usr/src/cmd/mdb/sparc/kmdb/kaif_start_isadep.c b/usr/src/cmd/mdb/sparc/kmdb/kaif_start_isadep.c deleted file mode 100644 index 71094f3779..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kaif_start_isadep.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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" - -/* - * The SPARC-specific interface to the main CPU-control loops - */ - -#include <sys/types.h> -#include <sys/trap.h> - -#include <kmdb/kaif.h> -#include <kmdb/kaif_regs.h> -#include <kmdb/kaif_start.h> -#include <kmdb/kmdb_asmutil.h> -#include <kmdb/kmdb_dpi_impl.h> -#include <kmdb/kmdb_kdi.h> -#include <mdb/mdb.h> - -void -kaif_debugger_entry(kaif_cpusave_t *cpusave) -{ - kaif_wapt_clear_regs(); - - (void) kaif_main_loop(cpusave); - - kaif_wapt_set_regs(); -} diff --git a/usr/src/cmd/mdb/sparc/kmdb/kctl/kctl_asm.s b/usr/src/cmd/mdb/sparc/kmdb/kctl/kctl_asm.s deleted file mode 100644 index c02cba52dc..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kctl/kctl_asm.s +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#if defined(__lint) -#include <sys/thread.h> -#include <kmdb/kctl/kctl.h> -#else -#include <sys/asm_linkage.h> -#endif - -#if defined(__lint) -/*ARGSUSED*/ -kthread_t * -kctl_curthread_set(kthread_t *thr) -{ - return (NULL); -} -#else - - ENTRY_NP(kctl_curthread_set) - mov %o0, %o1 - mov %g7, %o0 - retl - mov %o1, %g7 - SET_SIZE(kctl_curthread_set) - -#endif diff --git a/usr/src/cmd/mdb/sparc/kmdb/kctl/kctl_isadep.c b/usr/src/cmd/mdb/sparc/kmdb/kctl/kctl_isadep.c deleted file mode 100644 index d4567ca3db..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kctl/kctl_isadep.c +++ /dev/null @@ -1,293 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -#include <sys/types.h> -#include <sys/systm.h> -#include <sys/bootconf.h> -#include <sys/cpu_module.h> -#include <sys/x_call.h> -#include <sys/kdi_impl.h> -#include <sys/mmu.h> -#include <sys/cpuvar.h> -#include <sys/kobj.h> -#include <sys/kobj_impl.h> -#ifdef sun4v -#include <sys/ldoms.h> -#include <sys/promif_impl.h> -#include <kmdb/kmdb_kctl.h> -#endif - -#include <kmdb/kctl/kctl.h> - -#define KCTL_TTABLE_SIZE 0x6000 /* trap table size */ - -static uint32_t kctl_trap_brsav; /* saved ba,a from kmdb_trap */ -static uint32_t kctl_trap_tl1_brsav; /* saved ba,a from kmdb_trap_tl1 */ - -extern struct scb trap_table; - -static void -kctl_patch_text(caddr_t addr, uint32_t data) -{ - if (kctl.kctl_boot_loaded) { - /* LINTED - pointer alignment */ - *((uint32_t *)addr) = data; - } else { - hot_patch_kernel_text(addr, data, sizeof (data)); - } -} - -/* - * The traps that transfer control to kmdb (breakpoint, programmed entry, etc) - * use kmdb_trap and kmdb_trap_tl1, which normally begin with a ba,a to - * trap_table0 - a bad trap entry. When kmdb starts, it will use - * kctl_ktrap_install to replace the ba with a jmp to the appropriate kmdb - * entry points. Deactivation uses kctl_ktrap_restore to restore the ba - * instructions. - */ -static void -kctl_ktrap_install(int tl, void (*handler)(void)) -{ - extern uint32_t kmdb_trap, kmdb_trap_tl1; - uint32_t *entryp = tl ? &kmdb_trap_tl1 : &kmdb_trap; - uint32_t *savp = tl ? &kctl_trap_brsav : &kctl_trap_tl1_brsav; - uint32_t hi = (uint32_t)(uintptr_t)handler >> 10; - uint32_t lo = (uint32_t)(uintptr_t)handler & 0x3ff; - uint32_t inst; - - *savp = *entryp; - - inst = 0x81c06000 | lo; /* jmp %g1 + %lo(handler) */ - kctl_patch_text((caddr_t)(entryp + 1), inst); - - inst = 0x03000000 | hi; /* sethi %hi(handler), %g1 */ - kctl_patch_text((caddr_t)entryp, inst); -} - -static void -kctl_ktrap_restore(void) -{ - extern uint32_t kmdb_trap, kmdb_trap_tl1; - - hot_patch_kernel_text((caddr_t)&kmdb_trap, kctl_trap_brsav, 4); - hot_patch_kernel_text((caddr_t)&kmdb_trap_tl1, kctl_trap_tl1_brsav, 4); -} - -static void -kctl_ttable_tlb_modify(caddr_t tba, size_t sz, void (*func)(caddr_t, int)) -{ -#if defined(KMDB_TRAPCOUNT) - int do_dtlb = 1; -#else - int do_dtlb = 0; -#endif - - caddr_t va; - - ASSERT((sz & MMU_PAGEOFFSET) == 0); - - for (va = tba; sz > 0; sz -= MMU_PAGESIZE, va += MMU_PAGESIZE) - func(va, do_dtlb); -} - -static void -kctl_ttable_tlb_lock(uint64_t ptr, uint64_t sz) -{ - caddr_t tba = (caddr_t)ptr; - - kctl_ttable_tlb_modify(tba, sz, kdi_tlb_page_lock); -} - -static void -kctl_ttable_tlb_unlock(uint64_t ptr, uint64_t sz) -{ - caddr_t tba = (caddr_t)ptr; - - kctl_ttable_tlb_modify(tba, sz, kdi_tlb_page_unlock); -} - -/* - * kmdb has its own trap table. Life is made considerably easier if - * we allocate and configure it here, passing it to the debugger for - * final tweaking. - * - * The debugger code, and data accessed by the handlers are either - * a) locked into the TLB or b) accessible by our tte-lookup code. As - * such, we need only lock the trap table itself into the TLBs. We'll - * get the memory for the table from the beginning of the debugger - * segment, which has already been allocated. - */ -static void -kctl_ttable_init(void) -{ - xc_all(kctl_ttable_tlb_lock, (uint64_t)kctl.kctl_tba, - KCTL_TTABLE_SIZE); -} - -static void -kctl_ttable_fini(void) -{ - xc_all(kctl_ttable_tlb_unlock, (uint64_t)kctl.kctl_dseg, - KCTL_TTABLE_SIZE); -} - -static caddr_t -kctl_ttable_reserve(kmdb_auxv_t *kav, size_t *szp) -{ - caddr_t tba = kav->kav_dseg; - - ASSERT(kav->kav_dseg_size > KCTL_TTABLE_SIZE); - ASSERT(((uintptr_t)kav->kav_dseg & ((1 << 16) - 1)) == 0); - - kav->kav_dseg += KCTL_TTABLE_SIZE; - kav->kav_dseg_size -= KCTL_TTABLE_SIZE; - - *szp = KCTL_TTABLE_SIZE; - return (tba); -} - -static void -kctl_cpu_init(void) -{ - kctl_ttable_tlb_lock((uint64_t)kctl.kctl_tba, KCTL_TTABLE_SIZE); -} - -int -kctl_preactivate_isadep(void) -{ - if (!kctl.kctl_boot_loaded) { - if (kdi_watchdog_disable() != 0) { - cmn_err(CE_WARN, "hardware watchdog disabled while " - "debugger is activated"); - } - - kctl_ttable_init(); - } - - return (0); -} - -void -kctl_depreactivate_isadep(void) -{ - kctl_ttable_fini(); - - kdi_watchdog_restore(); -} - -void -kctl_activate_isadep(kdi_debugvec_t *dvec) -{ - dvec->dv_kctl_cpu_init = kctl_cpu_init; - dvec->dv_kctl_vmready = kctl_ttable_init; -} - -void -kctl_auxv_init_isadep(kmdb_auxv_t *kav, void *romp) -{ - extern caddr_t boot_tba; - extern void *get_tba(void); - extern int (*cif_handler)(void *); - extern int prom_exit_enter_debugger; - - kctl.kctl_tba = kav->kav_tba_native = kctl_ttable_reserve(kav, - &kav->kav_tba_native_sz); - - kav->kav_tba_obp = (boot_tba == NULL ? get_tba() : boot_tba); -#ifdef sun4v - kav->kav_tba_kernel = (caddr_t)&trap_table; -#endif - kav->kav_tba_active = (kctl.kctl_boot_loaded ? kav->kav_tba_obp : - kav->kav_tba_native); - - kav->kav_promexitarmp = &prom_exit_enter_debugger; - - kav->kav_romp = (kctl.kctl_boot_loaded ? romp : (void *)cif_handler); - - kav->kav_ktrap_install = kctl_ktrap_install; - kav->kav_ktrap_restore = kctl_ktrap_restore; -#ifdef sun4v - if (kctl.kctl_boot_loaded) { - /* - * When booting kmdb, kmdb starts before domaining is - * enabled and before the cif handler is changed to the - * kernel cif handler. So we start kmdb with using the - * OBP and we will change this when the cif handler is - * installed. - */ - kav->kav_domaining = 0; - } else { - kctl_auxv_set_promif(kav); - } -#endif -} - -#ifdef sun4v - -void -kctl_auxv_set_promif(kmdb_auxv_t *kav) -{ - kav->kav_domaining = domaining_enabled(); - kav->kav_promif_root = promif_stree_getroot(); - kav->kav_promif_in = prom_stdin_ihandle(); - kav->kav_promif_out = prom_stdout_ihandle(); - kav->kav_promif_pin = prom_stdin_node(); - kav->kav_promif_pout = prom_stdout_node(); - kav->kav_promif_chosennode = prom_chosennode(); - kav->kav_promif_optionsnode = prom_finddevice("/options"); -} - -void -kctl_switch_promif(void) -{ - kmdb_auxv_t kav; - - kctl_auxv_set_promif(&kav); - kmdb_init_promif(NULL, &kav); -} - -#endif - -/*ARGSUSED*/ -void -kctl_auxv_fini_isadep(kmdb_auxv_t *auxv) -{ -} - -void * -kctl_boot_tmpinit(void) -{ - kthread_t *kt0 = kobj_zalloc(sizeof (kthread_t), KM_TMP); - cpu_t *cpu = kobj_zalloc(sizeof (cpu_t), KM_TMP); - kt0->t_cpu = cpu; - - return (kctl_curthread_set(kt0)); -} - -void -kctl_boot_tmpfini(void *old) -{ - (void) kctl_curthread_set(old); -} diff --git a/usr/src/cmd/mdb/sparc/kmdb/kmdb_asmutil.h b/usr/src/cmd/mdb/sparc/kmdb/kmdb_asmutil.h deleted file mode 100644 index e76d0381aa..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kmdb_asmutil.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _KMDB_ASMUTIL_H -#define _KMDB_ASMUTIL_H - -#include <sys/types.h> - -#ifdef __cplusplus -extern "C" { -#endif - -extern int get_nwin(void); -extern uintptr_t get_fp(void); -extern void flush_windows(void); -extern uintptr_t cas(uintptr_t *, uintptr_t, uintptr_t); -extern void membar_producer(void); -extern void interrupts_on(void); -extern void interrupts_off(void); -extern caddr_t get_tba(void); -extern void *set_tba(void *); -extern uint64_t rdasi(uint32_t, uintptr_t); -extern void wrasi(uint32_t, uintptr_t, uint64_t); - -#ifdef __cplusplus -} -#endif - -#endif /* _KMDB_ASMUTIL_H */ diff --git a/usr/src/cmd/mdb/sparc/kmdb/kmdb_asmutil.s b/usr/src/cmd/mdb/sparc/kmdb/kmdb_asmutil.s deleted file mode 100644 index e93f402566..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kmdb_asmutil.s +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Utility Assembly routines used by the debugger. - */ - -#if defined(__lint) -#include <sys/types.h> -#include <kmdb/kmdb_asmutil.h> -#endif - -#include <sys/asm_linkage.h> -#include <sys/privregs.h> -#include "mach_asmutil.h" - -#if defined(__lint) -int -get_nwin(void) -{ - return (0); /* wouldn't that be amusing */ -} -#else - - ENTRY(get_nwin) - GET_NWIN(%g4, %g3); /* %g4 is scratch, %g3 set to nwin-1 */ - mov %g3, %o0 - retl - add %o0, 1, %o0 - SET_SIZE(get_nwin) - -#endif - -#if defined(__lint) -uintptr_t -get_fp(void) -{ - return (0); -} -#else - - ENTRY(get_fp) - retl - mov %fp, %o0 - SET_SIZE(get_fp) - -#endif - -#if defined(__lint) -void -interrupts_on(void) -{ -} -#else - - ENTRY(interrupts_on) - rdpr %pstate, %o0 - bset PSTATE_IE, %o0 - retl - wrpr %o0, %pstate - SET_SIZE(interrupts_on) - -#endif - -#if defined(__lint) -void -interrupts_off(void) -{ -} -#else - - ENTRY(interrupts_off) - rdpr %pstate, %o0 - bclr PSTATE_IE, %o0 - retl - wrpr %o0, %pstate - SET_SIZE(interrupts_off) - -#endif - -#if defined(__lint) -caddr_t -get_tba(void) -{ - return (0); -} -#else - - ENTRY(get_tba) - retl - rdpr %tba, %o0 - SET_SIZE(get_tba) - -#endif - -#if defined(__lint) -/*ARGSUSED*/ -void * -set_tba(void *new) -{ - return (0); -} -#else - - ENTRY(set_tba) - retl - wrpr %o0, %tba - SET_SIZE(set_tba) - -#endif diff --git a/usr/src/cmd/mdb/sparc/kmdb/kmdb_context_off.in b/usr/src/cmd/mdb/sparc/kmdb/kmdb_context_off.in deleted file mode 100644 index 837c5de04c..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kmdb_context_off.in +++ /dev/null @@ -1,36 +0,0 @@ -\ -\ Copyright 2005 Sun Microsystems, Inc. All rights reserved. -\ Use is subject to license terms. -\ -\ 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 -\ or http://www.opensolaris.org/os/licensing. -\ 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 -\ -\ ident "%Z%%M% %I% %E% SMI" -\ -\ Structure offsets for use in context-switching assembly code. -\ - -#include <ucontext.h> - -ucontext - uc_mcontext UC_MCTX - -mcontext_t - gregs MCTX_GREGS diff --git a/usr/src/cmd/mdb/sparc/kmdb/kmdb_dpi_isadep.c b/usr/src/cmd/mdb/sparc/kmdb/kmdb_dpi_isadep.c deleted file mode 100644 index 11e971db20..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kmdb_dpi_isadep.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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" - -/* - * SPARC-specific portions of the DPI - */ - -#include <sys/types.h> -#include <sys/mmu.h> -#include <sys/trap.h> -#include <sys/machtrap.h> - -#include <kmdb/kmdb_dpi_impl.h> -#include <kmdb/kmdb_asmutil.h> -#include <kmdb/kmdb_promif.h> -#include <kmdb/kmdb_fault.h> -#include <mdb/mdb_err.h> -#include <mdb/mdb_debug.h> -#include <mdb/mdb_kreg.h> -#include <mdb/mdb.h> - -void -kmdb_dpi_handle_fault(kreg_t tt, kreg_t tpc, kreg_t tnpc, kreg_t sp, int cpuid) -{ - mdb_dprintf(MDB_DBG_DPI, "\ndpi_handle_fault: tt 0x%01lx, tpc 0x%0?p, " - "tnpc 0x%0?p, sp 0x%0?p, fault_pcb 0x%0?p\n", tt, tpc, tnpc, sp, - kmdb_dpi_fault_pcb); - - switch (tt) { - case FAST_PROT_TT: - errno = EACCES; - break; - case T_DATA_ERROR: - errno = EIO; - break; -#ifdef sun4v - case T_DATA_MMU_MISS: -#endif /* sun4v */ - case FAST_DMMU_MISS_TT: - default: - errno = EMDB_NOMAP; - } - - if (kmdb_dpi_fault_pcb != NULL) { - longjmp(*kmdb_dpi_fault_pcb, 1); - /*NOTREACHED*/ - } - - /* Debugger fault */ - kmdb_fault(tt, tpc, sp, cpuid); -} - -int -kmdb_dpi_get_register(const char *regname, kreg_t *kregp) -{ - return (mdb.m_dpi->dpo_get_register(regname, kregp)); -} - -int -kmdb_dpi_set_register(const char *regname, kreg_t kreg) -{ - return (mdb.m_dpi->dpo_set_register(regname, kreg)); -} - -int -kmdb_dpi_get_rwin(int cpuid, int win, struct rwindow *rwin) -{ - return (mdb.m_dpi->dpo_get_rwin(cpuid, win, rwin)); -} - -int -kmdb_dpi_get_nwin(int cpuid) -{ - return (mdb.m_dpi->dpo_get_nwin(cpuid)); -} - -void -kmdb_dpi_kernpanic(int cpuid) -{ - mdb.m_dpi->dpo_kernpanic(cpuid); -} - -/* - * Continue/resume handling. If the target calls kmdb_dpi_resume(), it - * expects that the world will be resumed, and that the call will return - * when the world has stopped again. - * - * For support, we have resume_return(), which is called from main() when - * the continuation has completed (when the world has stopped again). - * set_resume_exit() tells where to jump to actually restart the world. - * - * CAUTION: This routine may be called *after* mdb_destroy. - */ -void -kmdb_dpi_resume_common(int cmd) -{ - kreg_t pc, tt; - - ASSERT(kmdb_dpi_resume_requested == 0); - - if (setjmp(kmdb_dpi_resume_pcb) == 0) { - (void) kmdb_dpi_get_register("pc", &pc); - mdb_dprintf(MDB_DBG_PROC, "Resume requested, pc is %p\n", - (void *)pc); - - if (cmd != KMDB_DPI_CMD_RESUME_UNLOAD) - kmdb_dpi_resume_requested = 1; - - longjmp(kmdb_dpi_entry_pcb, cmd); - /*NOTREACHED*/ - - } else { - (void) kmdb_dpi_get_register("pc", &pc); - (void) kmdb_dpi_get_register("tt", &tt); - mdb_dprintf(MDB_DBG_PROC, "Back from resume, pc: %p, tt: %lx\n", - (void *)pc, tt); - - kmdb_dpi_resume_requested = 0; - - switch (tt) { - case T_PA_WATCHPOINT: - kmdb_dpi_set_state(DPI_STATE_FAULTED, - DPI_STATE_WHY_P_WAPT); - break; - case T_VA_WATCHPOINT: - kmdb_dpi_set_state(DPI_STATE_FAULTED, - DPI_STATE_WHY_V_WAPT); - break; - case ST_KMDB_BREAKPOINT|T_SOFTWARE_TRAP: - case ST_MON_BREAKPOINT|T_SOFTWARE_TRAP: /* Shouldn't happen */ - kmdb_dpi_set_state(DPI_STATE_FAULTED, - DPI_STATE_WHY_BKPT); - break; - case ST_KMDB_TRAP|T_SOFTWARE_TRAP: - kmdb_dpi_set_state(DPI_STATE_STOPPED, 0); - break; - default: - kmdb_dpi_set_state(DPI_STATE_FAULTED, - DPI_STATE_WHY_TRAP); - break; - } - } -} diff --git a/usr/src/cmd/mdb/sparc/kmdb/kmdb_dpi_isadep.h b/usr/src/cmd/mdb/sparc/kmdb/kmdb_dpi_isadep.h deleted file mode 100644 index 4f1b10698c..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kmdb_dpi_isadep.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -#ifndef _KMDB_DPI_ISADEP_H -#define _KMDB_DPI_ISADEP_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <mdb/mdb_v9util.h> - -#ifdef __cplusplus -extern "C" { -#endif - -extern int kmdb_dpi_get_register(const char *, kreg_t *); -extern int kmdb_dpi_set_register(const char *, kreg_t); - -extern int kmdb_dpi_get_rwin(int, int, struct rwindow *); -extern int kmdb_dpi_get_nwin(int); - -extern void kmdb_dpi_handle_fault(kreg_t, kreg_t, kreg_t, kreg_t, int); - -extern void kmdb_dpi_kernpanic(int cpuid); - -#ifdef __cplusplus -} -#endif - -#endif /* _KMDB_DPI_ISADEP_H */ diff --git a/usr/src/cmd/mdb/sparc/kmdb/kmdb_fault_isadep.c b/usr/src/cmd/mdb/sparc/kmdb/kmdb_fault_isadep.c deleted file mode 100644 index a13660b297..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kmdb_fault_isadep.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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" - -/* - * SPARC-specific portions of the debugger fault routines - */ - -#include <sys/types.h> -#include <sys/stack.h> -#include <sys/frame.h> -#include <sys/machtrap.h> -#include <sys/machasi.h> -#include <sys/sun4asi.h> -#include <sys/intreg.h> -#include <sys/mmu.h> - -#include <kmdb/kmdb_asmutil.h> -#include <kmdb/kmdb_fault.h> -#include <mdb/mdb_io.h> -#include <mdb/mdb.h> - -#define MAX_STACK_FRAMES 30 - -static void -print_frame(uintptr_t sp, uintptr_t pc, int fnum, int safe) -{ - if (safe) { - mdb_iob_printf(mdb.m_err, " [%2d] %?p %?p()\n", - fnum, sp, pc); - } else { - mdb_iob_printf(mdb.m_err, " [%2d] %?p %a()\n", - fnum, sp, pc); - } -} - -static int -valid_frame(struct frame *fr) -{ - uintptr_t addr = (uintptr_t)fr; - - if (!(addr - (uintptr_t)mdb.m_dseg < mdb.m_dsegsz)) { - mdb_iob_printf(mdb.m_err, " frame (%p) outside of " - "debugger segment\n", addr); - return (0); - } - - if (addr & (STACK_ALIGN - 1)) { - mdb_iob_printf(mdb.m_err, " mis-aligned frame (%p)\n", fr); - return (0); - } - - return (1); -} - -static void -print_stack(kreg_t sp, int safe) -{ - struct frame *fr = (struct frame *)(sp + STACK_BIAS); - struct frame *nfr; - int frnum = 1; - - while (fr != NULL && valid_frame(fr) && fr->fr_savpc != 0 && - frnum <= MAX_STACK_FRAMES) { - print_frame((uintptr_t)fr - STACK_BIAS, fr->fr_savpc, frnum++, - safe); - - nfr = (struct frame *) - ((uintptr_t)fr->fr_savfp + STACK_BIAS); - - if ((uintptr_t)nfr == STACK_BIAS) - break; - - if ((uintptr_t)nfr < (uintptr_t)fr) { - mdb_iob_printf(mdb.m_err, - " fp (%p) < sp (%p)\n", nfr, fr); - break; - } - - fr = nfr; - } -} - -void -kmdb_print_stack(void) -{ - print_stack(get_fp(), FALSE); /* show sym names */ -} - -void -kmdb_fault_display(kreg_t tt, kreg_t pc, kreg_t sp, int safe) -{ - mdb_iob_printf(mdb.m_err, " tt: %p, sp: %p, pc: %p", tt, sp, pc); - if (!safe) - mdb_iob_printf(mdb.m_err, " %A", pc); - mdb_iob_printf(mdb.m_err, "\n"); - - switch (tt) { - case T_FAST_DATA_MMU_MISS: { -#ifdef sun4v -#else /* sun4v */ - uint64_t dsfar = rdasi(ASI_DMMU, MMU_SFAR); - const char *fmt = safe ? "%s%p\n" : "%s%a\n"; - mdb_iob_printf(mdb.m_err, fmt, "\tDSFAR now: ", dsfar); -#endif /* sun4v */ - break; - } - case T_VECTORED_INT: -#ifdef sun4v -#else /* sun4v */ - mdb_iob_printf(mdb.m_err, - "\tIRDR now: 0: %lx, 1: %lx, 2: %lx\n", - (ulong_t)rdasi(ASI_INTR_RECEIVE, IRDR_0), - (ulong_t)rdasi(ASI_INTR_RECEIVE, IRDR_1), - (ulong_t)rdasi(ASI_INTR_RECEIVE, IRDR_2)); -#endif /* sun4v */ - break; - } - - mdb_iob_printf(mdb.m_err, "\n"); - - if (mdb.m_dseg == NULL || mdb.m_dsegsz == 0) { - mdb_iob_printf(mdb.m_err, - "\t*** Stack trace omitted because debugger segment size\n" - "\t*** and/or length not set.\n"); - return; - } - - if (!(sp - (uintptr_t)mdb.m_dseg < mdb.m_dsegsz)) { - mdb_iob_printf(mdb.m_err, - "\t*** Stack trace omitted because sp (%p) isn't in the\n" - "\t*** debugger segment.\n", sp); - return; - } - - flush_windows(); - - print_stack(sp, safe); -} diff --git a/usr/src/cmd/mdb/sparc/kmdb/kmdb_kdi_isadep.c b/usr/src/cmd/mdb/sparc/kmdb/kmdb_kdi_isadep.c deleted file mode 100644 index 0b7b150c40..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kmdb_kdi_isadep.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -/* - * SPARC-specific portions of the KDI - */ - -#include <sys/types.h> -#include <sys/kdi_impl.h> - -#include <kmdb/kaif.h> -#include <kmdb/kmdb_dpi.h> -#include <kmdb/kmdb_promif.h> -#include <mdb/mdb_debug.h> -#include <mdb/mdb_err.h> -#include <mdb/mdb.h> - -#define KDI_XC_RETRIES 10 - -static size_t kdi_dcache_size; -static size_t kdi_dcache_linesize; -static size_t kdi_icache_size; -static size_t kdi_icache_linesize; - -static uint_t kdi_max_cpu_freq; -static uint_t kdi_sticks_per_usec; - -/* XXX needs to go into a header */ - -void -kdi_usecwait(clock_t n) -{ - mdb.m_kdi->mkdi_tickwait(n * kdi_sticks_per_usec); -} - -static int -kdi_cpu_ready_iter(int (*cb)(int, void *), void *arg) -{ - return (mdb.m_kdi->mkdi_cpu_ready_iter(cb, arg)); -} - -static int -kdi_xc_one(int cpuid, void (*cb)(void)) -{ - return (mdb.m_kdi->mkdi_xc_one(cpuid, (void (*)())cb, (uintptr_t)NULL, - (uintptr_t)NULL)); -} - -/*ARGSUSED1*/ -static int -kdi_init_cpus_cb(pnode_t node, void *arg, void *result) -{ - /* - * Sun4v dosen't support virtual address cache - */ -#ifndef sun4v - int dcache_size, dcache_linesize; - int icache_size, icache_linesize; -#endif - int cpu_freq; - -#ifndef sun4v - /* Get the real cpu property node if needed */ - node = kmdb_prom_getcpu_propnode(node); - - /* - * data cache - */ - - if (kmdb_prom_getprop(node, "dcache-size", - (caddr_t)&dcache_size) == -1 && - kmdb_prom_getprop(node, "l1-dcache-size", - (caddr_t)&dcache_size) == -1) - fail("can't get dcache size for node %x\n", node); - - if (kdi_dcache_size == 0 || dcache_size > kdi_dcache_size) - kdi_dcache_size = dcache_size; - - if (kmdb_prom_getprop(node, "dcache-line-size", - (caddr_t)&dcache_linesize) == -1 && - kmdb_prom_getprop(node, "l1-dcache-line-size", - (caddr_t)&dcache_linesize) == -1) - fail("can't get dcache line size for node %x\n", node); - - if (kdi_dcache_linesize == 0 || dcache_linesize < kdi_dcache_linesize) - kdi_dcache_linesize = dcache_linesize; - - /* - * instruction cache - */ - - if (kmdb_prom_getprop(node, "icache-size", - (caddr_t)&icache_size) == -1 && - kmdb_prom_getprop(node, "l1-icache-size", - (caddr_t)&icache_size) == -1) - fail("can't get icache size for node %x\n", node); - - if (kdi_icache_size == 0 || icache_size > kdi_icache_size) - kdi_icache_size = icache_size; - - if (kmdb_prom_getprop(node, "icache-line-size", - (caddr_t)&icache_linesize) == -1 && - kmdb_prom_getprop(node, "l1-icache-line-size", - (caddr_t)&icache_linesize) == -1) - fail("can't get icache size for node %x\n", node); - - if (kdi_icache_linesize == 0 || icache_linesize < kdi_icache_linesize) - kdi_icache_linesize = icache_linesize; -#endif - - if (kmdb_prom_getprop(node, "clock-frequency", - (caddr_t)&cpu_freq) == -1) { - fail("can't get cpu frequency for node %x\n", node); - } - - kdi_max_cpu_freq = MAX(kdi_max_cpu_freq, cpu_freq); - - return (0); -} - -/* - * Called on an individual CPU. Tries to send it off to the state saver if it - * hasn't already entered the debugger. Returns non-zero if it *fails* to stop - * the CPU. - */ -static int -kdi_halt_cpu(int cpuid, void *state_saverp) -{ - void (*state_saver)(void) = (void (*)(void))state_saverp; - int state = kmdb_dpi_get_cpu_state(cpuid); - const char *msg; - int rc = 0; - int res; - - if (state != DPI_CPU_STATE_MASTER && state != DPI_CPU_STATE_SLAVE) { - res = kdi_xc_one(cpuid, state_saver); - rc = 1; - - if (res == KDI_XC_RES_OK) - msg = "accepted the"; - else { - if (res == KDI_XC_RES_BUSY) - msg = "too busy for"; - else if (res == KDI_XC_RES_NACK) - msg = "NACKED the"; - else - msg = "errored the"; - } - mdb_dprintf(MDB_DBG_KDI, "CPU %d %s halt\n", cpuid, msg); - } - - return (rc); -} - -/*ARGSUSED1*/ -static int -kdi_report_unhalted(int cpuid, void *junk) -{ - int state = kmdb_dpi_get_cpu_state(cpuid); - - if (state != DPI_CPU_STATE_MASTER && state != DPI_CPU_STATE_SLAVE) - mdb_warn("CPU %d: stop failed\n", cpuid); - - return (0); -} - -/*ARGSUSED*/ -void -kmdb_kdi_stop_slaves(int my_cpuid, int doxc) -{ - int i; - - for (i = 0; i < KDI_XC_RETRIES; i++) { - if (kdi_cpu_ready_iter(kdi_halt_cpu, - (void *)kaif_slave_entry) == 0) - break; - - kdi_usecwait(2000); - } - (void) kdi_cpu_ready_iter(kdi_report_unhalted, NULL); -} - -void -kmdb_kdi_start_slaves(void) -{ -} - -void -kmdb_kdi_slave_wait(void) -{ -} - -int -kmdb_kdi_get_stick(uint64_t *stickp) -{ - return (mdb.m_kdi->mkdi_get_stick(stickp)); -} - -caddr_t -kmdb_kdi_get_trap_vatotte(void) -{ - return ((caddr_t)mdb.m_kdi->mkdi_trap_vatotte); -} - -void -kmdb_kdi_kernpanic(struct regs *regs, uint_t tt) -{ - uintptr_t args[2]; - - args[0] = (uintptr_t)regs; - args[1] = tt; - - (void) kmdb_dpi_call((uintptr_t)mdb.m_kdi->mkdi_kernpanic, 2, args); -} - -/*ARGSUSED*/ -void -kmdb_kdi_init_isadep(kdi_t *kdi, kmdb_auxv_t *kav) -{ - kdi_dcache_size = kdi_dcache_linesize = - kdi_icache_size = kdi_icache_linesize = 0; - - kdi_max_cpu_freq = kdi_sticks_per_usec = 0; - - mdb_dprintf(MDB_DBG_KDI, "Initializing CPUs\n"); - - kmdb_prom_walk_cpus(kdi_init_cpus_cb, NULL, NULL); - - /* - * If we can't find one, guess high. The CPU frequency is going to be - * used to determine the length of various delays, such as the mondo - * interrupt retry delay. Too long is generally better than too short. - */ - if (kdi_max_cpu_freq == 0) { - mdb_dprintf(MDB_DBG_KDI, "No CPU freq found - assuming " - "500MHz\n"); - kdi_max_cpu_freq = 500 * MICROSEC; - } - - kdi_sticks_per_usec = - MAX((kdi_max_cpu_freq + (MICROSEC - 1)) / MICROSEC, 1); - - mdb.m_kdi->mkdi_cpu_init(kdi_dcache_size, kdi_dcache_linesize, - kdi_icache_size, kdi_icache_linesize); - -#ifndef sun4v - kmdb_prom_preserve_kctx_init(); -#endif /* sun4v */ - -} diff --git a/usr/src/cmd/mdb/sparc/kmdb/kmdb_kdi_isadep.h b/usr/src/cmd/mdb/sparc/kmdb/kmdb_kdi_isadep.h deleted file mode 100644 index 268392e29b..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kmdb_kdi_isadep.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _KMDB_KDI_ISADEP_H -#define _KMDB_KDI_ISADEP_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/pte.h> - -#ifdef __cplusplus -extern "C" { -#endif - -struct regs; - -extern int kmdb_kdi_get_stick(uint64_t *); -extern caddr_t kmdb_kdi_get_trap_vatotte(void); -extern void kmdb_kdi_kernpanic(struct regs *, uint_t); - -#ifdef __cplusplus -} -#endif - -#endif /* _KMDB_KDI_ISADEP_H */ diff --git a/usr/src/cmd/mdb/sparc/kmdb/kmdb_makecontext.c b/usr/src/cmd/mdb/sparc/kmdb/kmdb_makecontext.c deleted file mode 100644 index 3b233209de..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kmdb_makecontext.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Context-saving routine used for pipelines. Designed for use only - * with kmdb_setcontext, and with the assumption that func() will never - * return. - */ - -#include <strings.h> -#include <ucontext.h> -#include <sys/types.h> -#include <sys/stack.h> - -#include <kmdb/kmdb_context_impl.h> -#include <mdb/mdb_kreg.h> - -void -kmdb_makecontext(ucontext_t *ucp, void (*func)(void *), void *arg, caddr_t stk, - size_t stksize) -{ - /* - * Top-of-stack must be rounded down to STACK_ALIGN and - * there must be a minimum frame for the register window. - */ - uintptr_t stack = (((uintptr_t)stk + stksize - 1) & - ~(STACK_ALIGN - 1)) - SA(MINFRAME); - - /* clear the top stack frame */ - bzero((void *)stack, SA(MINFRAME)); - - /* fill in registers of interest */ - ucp->uc_mcontext.gregs[REG_PC] = (greg_t)func; - ucp->uc_mcontext.gregs[REG_nPC] = (greg_t)func + 4; - ucp->uc_mcontext.gregs[REG_O0] = (greg_t)arg; - ucp->uc_mcontext.gregs[REG_SP] = (greg_t)(stack - STACK_BIAS); - ucp->uc_mcontext.gregs[REG_O7] = 0; - ucp->uc_mcontext.gregs[REG_G7] = 0; -} diff --git a/usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.c b/usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.c deleted file mode 100644 index ff7aa494a0..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -/* - * PROM interface - */ - -#include <sys/types.h> -#include <unistd.h> -#include <string.h> -#include <stdlib.h> - -#define _KERNEL -#define _BOOT -#include <sys/promif.h> -#undef _BOOT -#undef _KERNEL - -#include <mdb/mdb_debug.h> -#include <mdb/mdb_err.h> -#include <kmdb/kmdb_promif_impl.h> -#include <kmdb/kmdb_kdi.h> -#include <mdb/mdb_string.h> -#include <mdb/mdb.h> - -#ifndef sun4v -int kmdb_prom_preserve_kctx = 0; -#endif /* sun4v */ - -ssize_t -kmdb_prom_obp_writer(caddr_t buf, size_t len) -{ - return (prom_write(prom_stdout_ihandle(), buf, len, 0, 0)); -} - -ihandle_t -kmdb_prom_get_handle(char *name) -{ - if (strcmp(name, "stdin") == 0) - return (prom_stdin_ihandle()); - else if (strcmp(name, "stdout") == 0 || strcmp(name, "stderr") == 0) - return (prom_stdout_ihandle()); - else - return (-1); -} - -/*ARGSUSED*/ -char * -kmdb_prom_get_ddi_prop(kmdb_auxv_t *kav, char *propname) -{ - pnode_t node; - ssize_t len; - char *val; - - if ((node = prom_finddevice("/options")) == 0) - return (NULL); - - if ((len = prom_getproplen(node, propname)) < 0) - return (NULL); - - val = mdb_alloc(len + 1, UM_SLEEP); - - if (prom_bounded_getprop(node, propname, val, len) != len) { - mdb_free(val, len); - return (NULL); - } - val[len] = '\0'; - - return (val); -} - -void -kmdb_prom_free_ddi_prop(char *val) -{ - strfree(val); -} - -int -kmdb_prom_getprop(pnode_t node, char *name, caddr_t value) -{ - return (prom_getprop(node, name, value)); -} - -/*ARGSUSED*/ -void -kmdb_prom_get_tem_size(kmdb_auxv_t *kav, ushort_t *rows, ushort_t *cols) -{ - /* We fall back to defaults for now. */ -} - -typedef struct walk_cpu_data { - int (*wcd_cb)(pnode_t, void *, void *); - void *wcd_arg; -} walk_cpu_data_t; - -static int -walk_cpus_cb(pnode_t node, void *arg, void *result) -{ - walk_cpu_data_t *wcd = arg; - - /* - * Sun4v doesn't support port_id on guest. - */ -#ifndef sun4v - int port_id; -#endif /* sun4v */ - - if (!prom_devicetype(node, OBP_CPU)) - return (PROM_WALK_CONTINUE); - -#ifndef sun4v - if ((prom_getprop(node, "portid", (caddr_t)&port_id) == -1) && - (prom_getprop(node, "upa-portid", (caddr_t)&port_id) == -1) && - (prom_getprop(node, "cpuid", (caddr_t)&port_id) == -1)) { - warn("cpu node %x has no identifying properties\n", - node); - return (PROM_WALK_CONTINUE); - } -#endif /* sun4v */ - - if (wcd->wcd_cb(node, wcd->wcd_arg, result) != 0) - return (PROM_WALK_TERMINATE); - - return (PROM_WALK_CONTINUE); -} - -void -kmdb_prom_walk_cpus(int (*cb)(pnode_t, void *, void *), void *arg, void *result) -{ - walk_cpu_data_t wcd; - - wcd.wcd_cb = cb; - wcd.wcd_arg = arg; - - prom_walk_devs(prom_rootnode(), walk_cpus_cb, &wcd, result); -} - -void -kmdb_prom_enter_mon(void) -{ - prom_enter_mon(); -} - -#ifndef sun4v -pnode_t -kmdb_prom_getcpu_propnode(pnode_t node) -{ - int val; - pnode_t pnode; - char name[OBP_MAXPROPNAME]; - - - /* - * Check for the CMT case where cpu nodes are "strand" nodes - * In this case, the "cpu node" properties are contained in - * its parent "core" node. - */ - if (prom_getprop(node, "portid", (caddr_t)&val) == -1 && - prom_getprop(node, "upa-portid", (caddr_t)&val) == -1 && - prom_getprop((pnode = prom_parentnode(node)), "name", name) != -1 && - strcmp(name, "core") == 0) - return (pnode); - - return (node); -} -#endif /* sun4v */ - -void -kmdb_prom_exit_to_mon(void) -{ - prom_exit_to_mon(); -} - -void -kmdb_prom_interpret(const char *str) -{ - prom_interpret((char *)str, 0, 0, 0, 0, 0); -} - -/*ARGSUSED*/ -int -kmdb_prom_translate_virt(uintptr_t virt, physaddr_t *pap) -{ - extern int prom_translate_virt(caddr_t, int *, u_longlong_t *, int *); - - int valid, mode; - uintptr_t vabase = virt & ~(mdb.m_pagesize - 1); - uintptr_t off = virt - vabase; - u_longlong_t pa; - - mdb_dprintf(MDB_DBG_DPI, "using OBP for vtop of %p\n", (void *)virt); - - if (prom_translate_virt((caddr_t)vabase, &valid, &pa, &mode) != 0) - return (set_errno(EMDB_NOMAP)); - - *pap = pa + off; - return (0); -} - -/*ARGSUSED*/ -int -kmdb_prom_stdout_is_framebuffer(kmdb_auxv_t *kav) -{ - return (prom_stdout_is_framebuffer()); -} - -#ifndef sun4v -#define PROM_KCTX_PRESERVED_PROPNAME "context0-page-size-preserved" -void -kmdb_prom_preserve_kctx_init(void) -{ - pnode_t pnode; - int val; - - pnode = (pnode_t)prom_getphandle(prom_mmu_ihandle()); - if (prom_getprop(pnode, PROM_KCTX_PRESERVED_PROPNAME, - (caddr_t)&val) == 0) { - kmdb_prom_preserve_kctx = 1; - } -} -#endif /* sun4v */ diff --git a/usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.h b/usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.h deleted file mode 100644 index a01da89460..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -#ifndef _KMDB_PROMIF_ISADEP_H -#define _KMDB_PROMIF_ISADEP_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/obpdefs.h> -#include <sys/termios.h> - -#include <mdb/mdb_target.h> -#include <kmdb/kmdb_promif.h> - -#ifdef __cplusplus -extern "C" { -#endif - -extern void kmdb_prom_walk_cpus(int (*)(pnode_t, void *, void *), - void *, void *); -extern void kmdb_prom_enter_mon(void); -extern void kmdb_prom_exit_to_mon(void); -extern void kmdb_prom_interpret(const char *); -extern int kmdb_prom_getprop(pnode_t, char *, caddr_t); - -#ifndef sun4v -extern pnode_t kmdb_prom_getcpu_propnode(pnode_t); -extern void kmdb_prom_preserve_kctx_init(void); -#endif /* sun4v */ - -/* private to promif */ -extern int kmdb_prom_translate_virt(uintptr_t, physaddr_t *); - -#ifdef __cplusplus -} -#endif - -#endif /* _KMDB_PROMIF_ISADEP_H */ diff --git a/usr/src/cmd/mdb/sparc/kmdb/kvm_isadep.c b/usr/src/cmd/mdb/sparc/kmdb/kvm_isadep.c deleted file mode 100644 index 2ee4aad89d..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kvm_isadep.c +++ /dev/null @@ -1,523 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - * - * Copyright 2018 Joyent, Inc. - */ - -/* - * isa-dependent portions of the kmdb target - */ - -#include <mdb/mdb_kreg_impl.h> -#include <mdb/mdb_debug.h> -#include <mdb/mdb_modapi.h> -#include <mdb/mdb_v9util.h> -#include <mdb/mdb_target_impl.h> -#include <mdb/mdb_err.h> -#include <mdb/mdb_umem.h> -#include <kmdb/kmdb_kdi.h> -#include <kmdb/kmdb_dpi.h> -#include <kmdb/kmdb_promif.h> -#include <kmdb/kmdb_asmutil.h> -#include <kmdb/kvm.h> -#include <mdb/mdb.h> - -#include <sys/types.h> -#include <sys/stack.h> -#include <sys/regset.h> -#include <sys/sysmacros.h> -#include <sys/bitmap.h> -#include <sys/machtrap.h> -#include <sys/trap.h> - -/* Higher than the highest trap number for which we have a specific specifier */ -#define KMT_MAXTRAPNO 0x1ff - -#define OP(x) ((x) >> 30) -#define OP3(x) (((x) >> 19) & 0x3f) -#define RD(x) (((x) >> 25) & 0x1f) -#define RS1(x) (((x) >> 14) & 0x1f) -#define RS2(x) ((x) & 0x1f) - -#define OP_ARITH 0x2 - -#define OP3_OR 0x02 -#define OP3_SAVE 0x3c -#define OP3_RESTORE 0x3d - -static int -kmt_stack_iter(mdb_tgt_t *t, const mdb_tgt_gregset_t *gsp, - mdb_tgt_stack_f *func, void *arg, int cpuid) -{ - const mdb_tgt_gregset_t *grp; - mdb_tgt_gregset_t gregs; - kreg_t *kregs = &gregs.kregs[0]; - long nwin, stopwin, canrestore, wp, i, sp; - long argv[6]; - - /* - * If gsp isn't null, we were asked to dump a trace from a - * specific location. The normal iterator can handle that. - */ - if (gsp != NULL) { - if (cpuid != DPI_MASTER_CPUID) - warn("register set provided - ignoring cpu argument\n"); - return (mdb_kvm_v9stack_iter(t, gsp, func, arg)); - } - - if (kmdb_dpi_get_cpu_state(cpuid) < 0) { - warn("failed to iterate through stack for cpu %u", cpuid); - return (DCMD_ERR); - } - - /* - * We're being asked to dump the trace for the current CPU. - * To do that, we need to iterate first through the saved - * register windors. If there's more to the trace than that, - * we'll hand off to the normal iterator. - */ - if ((grp = kmdb_dpi_get_gregs(cpuid)) == NULL) { - warn("failed to retrieve registers for cpu %d", cpuid); - return (DCMD_ERR); - } - - bcopy(grp, &gregs, sizeof (mdb_tgt_gregset_t)); - - wp = kregs[KREG_CWP]; - canrestore = kregs[KREG_CANRESTORE]; - nwin = kmdb_dpi_get_nwin(cpuid); - stopwin = ((wp + nwin) - canrestore - 1) % nwin; - - mdb_dprintf(MDB_DBG_KMOD, "dumping cwp = %lu, canrestore = %lu, " - "stopwin = %lu\n", wp, canrestore, stopwin); - - for (;;) { - struct rwindow rwin; - - for (i = 0; i < 6; i++) - argv[i] = kregs[KREG_I0 + i]; - - if (kregs[KREG_PC] != 0 && - func(arg, kregs[KREG_PC], 6, argv, &gregs) != 0) - return (0); - - kregs[KREG_PC] = kregs[KREG_I7]; - kregs[KREG_NPC] = kregs[KREG_PC] + 4; - - if ((sp = kregs[KREG_FP] + STACK_BIAS) == STACK_BIAS || sp == 0) - return (0); /* Stop if we're at the end of stack */ - - if (sp & (STACK_ALIGN - 1)) - return (set_errno(EMDB_STKALIGN)); - - wp = (wp + nwin - 1) % nwin; - - if (wp == stopwin) - break; - - bcopy(&kregs[KREG_I0], &kregs[KREG_O0], 8 * sizeof (kreg_t)); - - if (kmdb_dpi_get_rwin(cpuid, wp, &rwin) < 0) { - warn("unable to get registers from window %ld\n", wp); - return (-1); - } - - for (i = 0; i < 8; i++) - kregs[KREG_L0 + i] = (uintptr_t)rwin.rw_local[i]; - for (i = 0; i < 8; i++) - kregs[KREG_I0 + i] = (uintptr_t)rwin.rw_in[i]; - } - - mdb_dprintf(MDB_DBG_KMOD, "dumping wp %ld and beyond normally\n", wp); - - /* - * hack - if we null out pc here, iterator won't print the frame - * that corresponds to the current set of registers. That's what we - * want because we just printed them above. - */ - kregs[KREG_PC] = 0; - return (mdb_kvm_v9stack_iter(t, &gregs, func, arg)); -} - -void -kmt_printregs(const mdb_tgt_gregset_t *gregs) -{ - mdb_v9printregs(gregs); -} - -static int -kmt_stack_common(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv, - int cpuid, mdb_tgt_stack_f *func, kreg_t saved_pc) -{ - mdb_tgt_gregset_t *grp = NULL; - mdb_tgt_gregset_t gregs; - void *arg = (void *)(uintptr_t)mdb.m_nargs; - - if (flags & DCMD_ADDRSPEC) { - bzero(&gregs, sizeof (gregs)); - gregs.kregs[KREG_FP] = addr; - gregs.kregs[KREG_I7] = saved_pc; - grp = &gregs; - } - - if (argc != 0) { - if (argv->a_type == MDB_TYPE_CHAR || argc > 1) - return (DCMD_USAGE); - - if (argv->a_type == MDB_TYPE_STRING) - arg = (void *)(uintptr_t)(uint_t) - mdb_strtoull(argv->a_un.a_str); - else - arg = (void *)(uintptr_t)(uint_t)argv->a_un.a_val; - } - - (void) kmt_stack_iter(mdb.m_target, grp, func, arg, cpuid); - - return (DCMD_OK); -} - -int -kmt_cpustack(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv, - int cpuid, int verbose) -{ - return (kmt_stack_common(addr, flags, argc, argv, cpuid, - (verbose ? mdb_kvm_v9framev : mdb_kvm_v9frame), 0)); -} - -int -kmt_stack(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - return (kmt_stack_common(addr, flags, argc, argv, DPI_MASTER_CPUID, - mdb_kvm_v9frame, 0)); -} - -int -kmt_stackv(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - return (kmt_stack_common(addr, flags, argc, argv, DPI_MASTER_CPUID, - mdb_kvm_v9framev, 0)); -} - -int -kmt_stackr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - /* - * Force printing of the first register window by setting the saved - * pc (%i7) to PC_FAKE. - */ - return (kmt_stack_common(addr, flags, argc, argv, DPI_MASTER_CPUID, - mdb_kvm_v9framer, PC_FAKE)); -} - -ssize_t -kmt_write_page(mdb_tgt_t *t, const void *buf, size_t nbytes, uintptr_t addr) -{ - jmp_buf *oldpcb = NULL; - jmp_buf pcb; - physaddr_t pa; - - /* - * Can we write to this page? - */ - if (!(t->t_flags & MDB_TGT_F_ALLOWIO) && - (nbytes = kmdb_kdi_range_is_nontoxic(addr, nbytes, 1)) == 0) - return (set_errno(EMDB_NOMAP)); - - /* - * The OBP va>pa call returns a protection value that's right only some - * of the time. We can, however, tell if we failed a write due to a - * protection violation. If we get such an error, we'll retry the - * write using pwrite. - */ - if (setjmp(pcb) != 0) { - /* We failed the write */ - kmdb_dpi_restore_fault_hdlr(oldpcb); - - if (errno == EACCES && kmdb_prom_vtop(addr, &pa) == 0) - return (kmt_pwrite(t, buf, nbytes, pa)); - return (-1); /* errno is set for us */ - } - - mdb_dprintf(MDB_DBG_KMOD, "copying %lu bytes from %p to %p\n", nbytes, - buf, (void *)addr); - - oldpcb = kmdb_dpi_set_fault_hdlr(&pcb); - (void) kmt_writer((void *)buf, nbytes, addr); - kmdb_dpi_restore_fault_hdlr(oldpcb); - - return (nbytes); -} - -/*ARGSUSED*/ -ssize_t -kmt_write(mdb_tgt_t *t, const void *buf, size_t nbytes, uintptr_t addr) -{ - size_t ntowrite, nwritten, n; - int rc; - - kmdb_prom_check_interrupt(); - - if (nbytes == 0) - return (0); - - /* - * Break the writes up into page-sized chunks. First, the leading page - * fragment (if any), then the subsequent pages. - */ - - if ((n = (addr & (mdb.m_pagesize - 1))) != 0) { - ntowrite = MIN(mdb.m_pagesize - n, nbytes); - - if ((rc = kmt_write_page(t, buf, ntowrite, addr)) != ntowrite) - return (rc); - - addr = roundup(addr, mdb.m_pagesize); - nbytes -= ntowrite; - nwritten = ntowrite; - buf = ((caddr_t)buf + ntowrite); - } - - while (nbytes > 0) { - ntowrite = MIN(mdb.m_pagesize, nbytes); - - if ((rc = kmt_write_page(t, buf, ntowrite, addr)) != ntowrite) - return (rc < 0 ? rc : rc + nwritten); - - addr += mdb.m_pagesize; - nbytes -= ntowrite; - nwritten += ntowrite; - buf = ((caddr_t)buf + ntowrite); - } - - return (rc); -} - -/*ARGSUSED*/ -ssize_t -kmt_ioread(mdb_tgt_t *t, void *buf, size_t nbytes, uintptr_t addr) -{ - return (set_errno(EMDB_TGTHWNOTSUP)); -} - -/*ARGSUSED*/ -ssize_t -kmt_iowrite(mdb_tgt_t *t, const void *buf, size_t nbytes, uintptr_t addr) -{ - return (set_errno(EMDB_TGTHWNOTSUP)); -} - -const char * -kmt_def_dismode(void) -{ -#ifdef __sparcv9 - return ("v9plus"); -#else - return ("v8"); -#endif -} - -/* - * If we are stopped on a save instruction or at the first instruction of a - * known function, return %o7 as the step-out address; otherwise return the - * current frame's return address (%i7). Significantly better handling of - * step out in leaf routines could be accomplished by implementing more - * complex decoding of the current function and our current state. - */ -int -kmt_step_out(mdb_tgt_t *t, uintptr_t *p) -{ - kreg_t pc, i7, o7; - GElf_Sym func; - - (void) kmdb_dpi_get_register("pc", &pc); - (void) kmdb_dpi_get_register("i7", &i7); - (void) kmdb_dpi_get_register("o7", &o7); - - if (mdb_tgt_lookup_by_addr(t, pc, MDB_TGT_SYM_FUZZY, NULL, 0, - &func, NULL) == 0 && func.st_value == pc) - *p = o7 + 2 * sizeof (mdb_instr_t); - else { - mdb_instr_t instr; - - if (mdb_tgt_vread(t, &instr, sizeof (instr), pc) != - sizeof (instr)) { - warn("failed to read instruction at %p for step out", - (void *)pc); - return (-1); - } - - if (OP(instr) == OP_ARITH && OP3(instr) == OP3_SAVE) - *p = o7 + 2 * sizeof (mdb_instr_t); - else - *p = i7 + 2 * sizeof (mdb_instr_t); - } - - return (0); -} - -static const char * -regno2name(int idx) -{ - const mdb_tgt_regdesc_t *rd; - - for (rd = mdb_sparcv9_kregs; rd->rd_name != NULL; rd++) { - if (idx == rd->rd_num) - return (rd->rd_name); - } - - ASSERT(rd->rd_name != NULL); - - return ("unknown"); -} - -/* - * Step over call and jmpl by returning the address of the position where a - * temporary breakpoint can be set to catch return from the control transfer. - * This function does not currently provide advanced decoding of DCTI couples - * or any other complex special case; we just fall back to single-step. - */ -int -kmt_next(mdb_tgt_t *t, uintptr_t *p) -{ - kreg_t pc, npc; - GElf_Sym func; - - (void) kmdb_dpi_get_register("pc", &pc); - (void) kmdb_dpi_get_register("npc", &npc); - - if (mdb_tgt_lookup_by_addr(t, pc, MDB_TGT_SYM_FUZZY, NULL, 0, - &func, NULL) != 0) - return (-1); - - if (npc < func.st_value || func.st_value + func.st_size <= npc) { - mdb_instr_t instr; - kreg_t reg; - - /* - * We're about to transfer control outside this function, so we - * want to stop when control returns from the other function. - * Normally the return address will be in %o7, tail-calls being - * the exception. We try to discover if this is a tail-call and - * compute the return address in that case. - */ - if (mdb_tgt_vread(t, &instr, sizeof (instr), pc) != - sizeof (instr)) { - warn("failed to read instruction at %p for next", - (void *)pc); - return (-1); - } - - if (OP(instr) == OP_ARITH && OP3(instr) == OP3_RESTORE) { - (void) kmdb_dpi_get_register("i7", ®); - } else if (OP(instr) == OP_ARITH && OP3(instr) == OP3_OR && - RD(instr) == KREG_O7) { - if (RS1(instr) == KREG_G0) - return (set_errno(EAGAIN)); - - (void) kmdb_dpi_get_register(regno2name(RS2(instr)), - ®); - } else - (void) kmdb_dpi_get_register("o7", ®); - - *p = reg + 2 * sizeof (mdb_instr_t); - - return (0); - } - - return (set_errno(EAGAIN)); -} - -const char * -kmt_trapname(int trapnum) -{ - static char trapname[11]; - - switch (trapnum) { - case T_INSTR_EXCEPTION: - return ("instruction access error trap"); - case T_ALIGNMENT: - return ("improper alignment trap"); - case T_UNIMP_INSTR: - return ("illegal instruction trap"); - case T_IDIV0: - return ("division by zero trap"); - case T_FAST_INSTR_MMU_MISS: - return ("instruction access MMU miss trap"); - case T_FAST_DATA_MMU_MISS: - return ("data access MMU miss trap"); - case ST_KMDB_TRAP|T_SOFTWARE_TRAP: - return ("debugger entry trap"); - case ST_KMDB_BREAKPOINT|T_SOFTWARE_TRAP: - return ("breakpoint trap"); - default: - (void) mdb_snprintf(trapname, sizeof (trapname), "trap %#x", - trapnum); - return (trapname); - } -} - -void -kmt_init_isadep(mdb_tgt_t *t) -{ - kmt_data_t *kmt = t->t_data; - - kmt->kmt_rds = mdb_sparcv9_kregs; - - kmt->kmt_trapmax = KMT_MAXTRAPNO; - kmt->kmt_trapmap = mdb_zalloc(BT_SIZEOFMAP(kmt->kmt_trapmax), UM_SLEEP); - - /* Traps for which we want to provide an explicit message */ - (void) mdb_tgt_add_fault(t, T_INSTR_EXCEPTION, MDB_TGT_SPEC_INTERNAL, - no_se_f, NULL); - (void) mdb_tgt_add_fault(t, T_ALIGNMENT, MDB_TGT_SPEC_INTERNAL, - no_se_f, NULL); - (void) mdb_tgt_add_fault(t, T_UNIMP_INSTR, MDB_TGT_SPEC_INTERNAL, - no_se_f, NULL); - (void) mdb_tgt_add_fault(t, T_IDIV0, MDB_TGT_SPEC_INTERNAL, - no_se_f, NULL); - (void) mdb_tgt_add_fault(t, T_FAST_INSTR_MMU_MISS, - MDB_TGT_SPEC_INTERNAL, no_se_f, NULL); - (void) mdb_tgt_add_fault(t, T_FAST_DATA_MMU_MISS, MDB_TGT_SPEC_INTERNAL, - no_se_f, NULL); - - /* - * Traps which will be handled elsewhere, and which therefore don't - * need the trap-based message. - */ - BT_SET(kmt->kmt_trapmap, ST_KMDB_TRAP|T_SOFTWARE_TRAP); - BT_SET(kmt->kmt_trapmap, ST_KMDB_BREAKPOINT|T_SOFTWARE_TRAP); - BT_SET(kmt->kmt_trapmap, T_PA_WATCHPOINT); - BT_SET(kmt->kmt_trapmap, T_VA_WATCHPOINT); - - /* Catch-all for traps not explicitly listed here */ - (void) mdb_tgt_add_fault(t, KMT_TRAP_NOTENUM, MDB_TGT_SPEC_INTERNAL, - no_se_f, NULL); -} - -/*ARGSUSED*/ -void -kmt_startup_isadep(mdb_tgt_t *t) -{ -} diff --git a/usr/src/cmd/mdb/sparc/kmdb/kvm_isadep.h b/usr/src/cmd/mdb/sparc/kmdb/kvm_isadep.h deleted file mode 100644 index 733e329f12..0000000000 --- a/usr/src/cmd/mdb/sparc/kmdb/kvm_isadep.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _KMDB_KVM_ISADEP_H -#define _KMDB_KVM_ISADEP_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> - -#ifdef __cplusplus -extern "C" { -#endif - -uintptr_t kmt_invoke(uintptr_t, uint_t, const uintptr_t *, kreg_t, kreg_t); - -#ifdef __cplusplus -} -#endif - -#endif /* _KMDB_KVM_ISADEP_H */ diff --git a/usr/src/cmd/mdb/sparc/mdb/kvm_v7dep.c b/usr/src/cmd/mdb/sparc/mdb/kvm_v7dep.c deleted file mode 100644 index 02725d8e1f..0000000000 --- a/usr/src/cmd/mdb/sparc/mdb/kvm_v7dep.c +++ /dev/null @@ -1,533 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - * - * Copyright 2018 Joyent, Inc. - */ - -/* - * Libkvm Kernel Target SPARC v7 component - * - * This file provides the ISA-dependent portion of the libkvm kernel target. - * For more details on the implementation refer to mdb_kvm.c. - */ - -#include <sys/types.h> -#include <sys/machtypes.h> -#include <sys/regset.h> -#include <sys/frame.h> -#include <sys/stack.h> -#include <sys/sysmacros.h> -#include <sys/panic.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.h> -#include <mdb/mdb_kvm.h> -#include <mdb/mdb_err.h> -#include <mdb/mdb_debug.h> -#include <mdb/mdb.h> - -/* - * The mdb_tgt_gregset type is opaque to callers of the target interface - * and to our own target common code. We now can define it explicitly. - */ -struct mdb_tgt_gregset { - kreg_t kregs[KREG_NGREG]; -}; - -/* - * 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. - */ -static const mdb_tgt_regdesc_t kt_sparcv7_regs[] = { - { "g0", KREG_G0, MDB_TGT_R_EXPORT }, - { "g1", KREG_G1, MDB_TGT_R_EXPORT }, - { "g2", KREG_G2, MDB_TGT_R_EXPORT }, - { "g3", KREG_G3, MDB_TGT_R_EXPORT }, - { "g4", KREG_G4, MDB_TGT_R_EXPORT }, - { "g5", KREG_G5, MDB_TGT_R_EXPORT }, - { "g6", KREG_G6, MDB_TGT_R_EXPORT }, - { "g7", KREG_G7, MDB_TGT_R_EXPORT }, - { "o0", KREG_O0, MDB_TGT_R_EXPORT }, - { "o1", KREG_O1, MDB_TGT_R_EXPORT }, - { "o2", KREG_O2, MDB_TGT_R_EXPORT }, - { "o3", KREG_O3, MDB_TGT_R_EXPORT }, - { "o4", KREG_O4, MDB_TGT_R_EXPORT }, - { "o5", KREG_O5, MDB_TGT_R_EXPORT }, - { "o6", KREG_O6, MDB_TGT_R_EXPORT }, - { "o7", KREG_O7, MDB_TGT_R_EXPORT }, - { "l0", KREG_L0, MDB_TGT_R_EXPORT }, - { "l1", KREG_L1, MDB_TGT_R_EXPORT }, - { "l2", KREG_L2, MDB_TGT_R_EXPORT }, - { "l3", KREG_L3, MDB_TGT_R_EXPORT }, - { "l4", KREG_L4, MDB_TGT_R_EXPORT }, - { "l5", KREG_L5, MDB_TGT_R_EXPORT }, - { "l6", KREG_L6, MDB_TGT_R_EXPORT }, - { "l7", KREG_L7, MDB_TGT_R_EXPORT }, - { "i0", KREG_I0, MDB_TGT_R_EXPORT }, - { "i1", KREG_I1, MDB_TGT_R_EXPORT }, - { "i2", KREG_I2, MDB_TGT_R_EXPORT }, - { "i3", KREG_I3, MDB_TGT_R_EXPORT }, - { "i4", KREG_I4, MDB_TGT_R_EXPORT }, - { "i5", KREG_I5, MDB_TGT_R_EXPORT }, - { "i6", KREG_I6, MDB_TGT_R_EXPORT }, - { "i7", KREG_I7, MDB_TGT_R_EXPORT }, - { "psr", KREG_PSR, MDB_TGT_R_EXPORT }, - { "pc", KREG_PC, MDB_TGT_R_EXPORT }, - { "npc", KREG_NPC, MDB_TGT_R_EXPORT }, - { "y", KREG_Y, 0 }, - { "wim", KREG_WIM, MDB_TGT_R_EXPORT | MDB_TGT_R_PRIV }, - { "tbr", KREG_TBR, MDB_TGT_R_EXPORT | MDB_TGT_R_PRIV }, - { "sp", KREG_SP, MDB_TGT_R_EXPORT | MDB_TGT_R_ALIAS }, - { "fp", KREG_FP, MDB_TGT_R_EXPORT | MDB_TGT_R_ALIAS }, - { NULL, 0, 0 } -}; - -static int -kt_getareg(mdb_tgt_t *t, mdb_tgt_tid_t tid, - const char *rname, mdb_tgt_reg_t *rp) -{ - const mdb_tgt_regdesc_t *rdp; - kt_data_t *kt = t->t_data; - - if (tid != kt->k_tid) - return (set_errno(EMDB_NOREGS)); - - for (rdp = kt->k_rds; rdp->rd_name != NULL; rdp++) { - if (strcmp(rname, rdp->rd_name) == 0) { - *rp = kt->k_regs->kregs[rdp->rd_num]; - return (0); - } - } - - return (set_errno(EMDB_BADREG)); -} - -static int -kt_putareg(mdb_tgt_t *t, mdb_tgt_tid_t tid, const char *rname, mdb_tgt_reg_t r) -{ - const mdb_tgt_regdesc_t *rdp; - kt_data_t *kt = t->t_data; - - if (tid != kt->k_tid) - return (set_errno(EMDB_NOREGS)); - - for (rdp = kt->k_rds; rdp->rd_name != NULL; rdp++) { - if (strcmp(rname, rdp->rd_name) == 0) { - kt->k_regs->kregs[rdp->rd_num] = r; - return (0); - } - } - - return (set_errno(EMDB_BADREG)); -} - -static int -kt_stack_iter(mdb_tgt_t *t, const mdb_tgt_gregset_t *gsp, - mdb_tgt_stack_f *func, void *arg) -{ - mdb_tgt_gregset_t gregs; - kreg_t *kregs = &gregs.kregs[0]; - int got_pc = (gsp->kregs[KREG_PC] != 0); - - struct rwindow rwin; - uintptr_t sp; - long argv[6]; - int i; - - bcopy(gsp, &gregs, sizeof (gregs)); - - for (;;) { - for (i = 0; i < 6; i++) - argv[i] = kregs[KREG_I0 + i]; - - if (got_pc && func(arg, kregs[KREG_PC], 6, argv, &gregs) != 0) - break; - - kregs[KREG_PC] = kregs[KREG_I7]; - kregs[KREG_NPC] = kregs[KREG_PC] + 4; - - bcopy(&kregs[KREG_I0], &kregs[KREG_O0], 8 * sizeof (kreg_t)); - got_pc |= (kregs[KREG_PC] != 0); - - if ((sp = kregs[KREG_FP]) == 0) - break; /* Stop if we're at the end of the stack */ - - if (sp & (STACK_ALIGN - 1)) - return (set_errno(EMDB_STKALIGN)); - - if (mdb_tgt_vread(t, &rwin, sizeof (rwin), sp) != sizeof (rwin)) - return (-1); /* Failed to read frame */ - - for (i = 0; i < 8; i++) - kregs[KREG_L0 + i] = (uintptr_t)rwin.rw_local[i]; - for (i = 0; i < 8; i++) - kregs[KREG_I0 + i] = (uintptr_t)rwin.rw_in[i]; - } - - return (0); -} - -/*ARGSUSED*/ -static int -kt_regs(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - mdb_tgt_gregset_t *k_regs = (mdb_tgt_gregset_t *)addr; - const kreg_t *kregs = &k_regs->kregs[0]; - - if (argc != 0 || (flags & DCMD_ADDRSPEC)) - return (DCMD_USAGE); - -#define GETREG2(x) ((uintptr_t)kregs[(x)]), ((uintptr_t)kregs[(x)]) - - mdb_printf("%%g0 = 0x%0?p %15A %%l0 = 0x%0?p %A\n", - GETREG2(KREG_G0), GETREG2(KREG_L0)); - - mdb_printf("%%g1 = 0x%0?p %15A %%l1 = 0x%0?p %A\n", - GETREG2(KREG_G1), GETREG2(KREG_L1)); - - mdb_printf("%%g2 = 0x%0?p %15A %%l2 = 0x%0?p %A\n", - GETREG2(KREG_G2), GETREG2(KREG_L2)); - - mdb_printf("%%g3 = 0x%0?p %15A %%l3 = 0x%0?p %A\n", - GETREG2(KREG_G3), GETREG2(KREG_L3)); - - mdb_printf("%%g4 = 0x%0?p %15A %%l4 = 0x%0?p %A\n", - GETREG2(KREG_G4), GETREG2(KREG_L4)); - - mdb_printf("%%g5 = 0x%0?p %15A %%l5 = 0x%0?p %A\n", - GETREG2(KREG_G5), GETREG2(KREG_L5)); - - mdb_printf("%%g6 = 0x%0?p %15A %%l6 = 0x%0?p %A\n", - GETREG2(KREG_G6), GETREG2(KREG_L6)); - - mdb_printf("%%g7 = 0x%0?p %15A %%l7 = 0x%0?p %A\n\n", - GETREG2(KREG_G7), GETREG2(KREG_L7)); - - mdb_printf("%%o0 = 0x%0?p %15A %%i0 = 0x%0?p %A\n", - GETREG2(KREG_O0), GETREG2(KREG_I0)); - - mdb_printf("%%o1 = 0x%0?p %15A %%i1 = 0x%0?p %A\n", - GETREG2(KREG_O1), GETREG2(KREG_I1)); - - mdb_printf("%%o2 = 0x%0?p %15A %%i2 = 0x%0?p %A\n", - GETREG2(KREG_O2), GETREG2(KREG_I2)); - - mdb_printf("%%o3 = 0x%0?p %15A %%i3 = 0x%0?p %A\n", - GETREG2(KREG_O3), GETREG2(KREG_I3)); - - mdb_printf("%%o4 = 0x%0?p %15A %%i4 = 0x%0?p %A\n", - GETREG2(KREG_O4), GETREG2(KREG_I4)); - - mdb_printf("%%o5 = 0x%0?p %15A %%i5 = 0x%0?p %A\n", - GETREG2(KREG_O5), GETREG2(KREG_I5)); - - mdb_printf("%%o6 = 0x%0?p %15A %%i6 = 0x%0?p %A\n", - GETREG2(KREG_O6), GETREG2(KREG_I6)); - - mdb_printf("%%o7 = 0x%0?p %15A %%i7 = 0x%0?p %A\n\n", - GETREG2(KREG_O7), GETREG2(KREG_I7)); - - mdb_printf(" %%psr = 0x%08x impl=0x%x ver=0x%x icc=%c%c%c%c\n" - " ec=%u ef=%u pil=%u s=%u ps=%u et=%u cwp=0x%x\n", - kregs[KREG_PSR], - (kregs[KREG_PSR] & KREG_PSR_IMPL_MASK) >> KREG_PSR_IMPL_SHIFT, - (kregs[KREG_PSR] & KREG_PSR_VER_MASK) >> KREG_PSR_VER_SHIFT, - (kregs[KREG_PSR] & KREG_PSR_ICC_N_MASK) ? 'N' : 'n', - (kregs[KREG_PSR] & KREG_PSR_ICC_Z_MASK) ? 'Z' : 'z', - (kregs[KREG_PSR] & KREG_PSR_ICC_V_MASK) ? 'V' : 'v', - (kregs[KREG_PSR] & KREG_PSR_ICC_C_MASK) ? 'C' : 'c', - kregs[KREG_PSR] & KREG_PSR_EC_MASK, - kregs[KREG_PSR] & KREG_PSR_EF_MASK, - (kregs[KREG_PSR] & KREG_PSR_PIL_MASK) >> KREG_PSR_PIL_SHIFT, - kregs[KREG_PSR] & KREG_PSR_S_MASK, - kregs[KREG_PSR] & KREG_PSR_PS_MASK, - kregs[KREG_PSR] & KREG_PSR_ET_MASK, - (kregs[KREG_PSR] & KREG_PSR_CWP_MASK) >> KREG_PSR_CWP_SHIFT); - - mdb_printf(" %%y = 0x%0?p\n", kregs[KREG_Y]); - - mdb_printf(" %%pc = 0x%0?p %A\n", GETREG2(KREG_PC)); - mdb_printf(" %%npc = 0x%0?p %A\n", GETREG2(KREG_NPC)); - - mdb_printf(" %%sp = 0x%0?p\n", kregs[KREG_SP]); - mdb_printf(" %%fp = 0x%0?p\n\n", kregs[KREG_FP]); - - mdb_printf(" %%wim = 0x%08lx\n", kregs[KREG_WIM]); - mdb_printf(" %%tbr = 0x%08lx\n", kregs[KREG_TBR]); - - return (DCMD_OK); -} - -/*ARGSUSED*/ -static int -kt_frame(void *arglim, uintptr_t pc, uint_t argc, const long *argv, - const mdb_tgt_gregset_t *gregs) -{ - argc = MIN(argc, (uint_t)arglim); - mdb_printf("%a(", pc); - - if (argc != 0) { - mdb_printf("%lr", *argv++); - for (argc--; argc != 0; argc--) - mdb_printf(", %lr", *argv++); - } - - mdb_printf(")\n"); - return (0); -} - -static int -kt_framev(void *arglim, uintptr_t pc, uint_t argc, const long *argv, - const mdb_tgt_gregset_t *gregs) -{ - argc = MIN(argc, (uint_t)arglim); - mdb_printf("%0?lr %a(", gregs->kregs[KREG_SP], pc); - - if (argc != 0) { - mdb_printf("%lr", *argv++); - for (argc--; argc != 0; argc--) - mdb_printf(", %lr", *argv++); - } - - mdb_printf(")\n"); - return (0); -} - -static int -kt_stack_common(uintptr_t addr, uint_t flags, int argc, - const mdb_arg_t *argv, mdb_tgt_stack_f *func) -{ - kt_data_t *kt = mdb.m_target->t_data; - void *arg = (void *)mdb.m_nargs; - mdb_tgt_gregset_t gregs, *grp; - - if (flags & DCMD_ADDRSPEC) { - bzero(&gregs, sizeof (gregs)); - gregs.kregs[KREG_FP] = addr; - grp = &gregs; - } else - grp = kt->k_regs; - - if (argc != 0) { - if (argv->a_type == MDB_TYPE_CHAR || argc > 1) - return (DCMD_USAGE); - - if (argv->a_type == MDB_TYPE_STRING) - arg = (void *)(uint_t)mdb_strtoull(argv->a_un.a_str); - else - arg = (void *)(uint_t)argv->a_un.a_val; - } - - (void) kt_stack_iter(mdb.m_target, grp, func, arg); - return (DCMD_OK); -} - -static int -kt_stack(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - return (kt_stack_common(addr, flags, argc, argv, kt_frame)); -} - -static int -kt_stackv(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - return (kt_stack_common(addr, flags, argc, argv, kt_framev)); -} - -/*ARGSUSED*/ -static int -kt_notsup(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - errno = EMDB_TGTNOTSUP; - return (DCMD_ERR); -} - -const mdb_tgt_ops_t kt_sparcv7_ops = { - kt_setflags, /* t_setflags */ - kt_setcontext, /* t_setcontext */ - kt_activate, /* t_activate */ - kt_deactivate, /* t_deactivate */ - (void (*)())(uintptr_t)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 */ - (ssize_t (*)())mdb_tgt_notsup, /* t_ioread */ - (ssize_t (*)())mdb_tgt_notsup, /* t_iowrite */ - 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_next */ - (int (*)())mdb_tgt_notsup, /* t_cont */ - (int (*)())mdb_tgt_notsup, /* t_signal */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_vbrkpt */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_sbrkpt */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_pwapt */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_vwapt */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_iowapt */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_sysenter */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_sysexit */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_signal */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_fault */ - kt_getareg, /* t_getareg */ - kt_putareg, /* t_putareg */ - kt_stack_iter, /* t_stack_iter */ - (int (*)())mdb_tgt_notsup /* t_auxv */ -}; - -void -kt_sparcv7_init(mdb_tgt_t *t) -{ - kt_data_t *kt = t->t_data; - - struct rwindow rwin; - panic_data_t pd; - label_t label; - kreg_t *kregs; - - /* - * 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. - */ - kt->k_rds = kt_sparcv7_regs; - kt->k_regs = mdb_zalloc(sizeof (mdb_tgt_gregset_t), UM_SLEEP); - kt->k_regsize = sizeof (mdb_tgt_gregset_t); - kt->k_dcmd_regs = kt_regs; - kt->k_dcmd_stack = kt_stack; - kt->k_dcmd_stackv = kt_stackv; - kt->k_dcmd_stackr = kt_stackv; - kt->k_dcmd_cpustack = kt_notsup; - kt->k_dcmd_cpuregs = kt_notsup; - - t->t_ops = &kt_sparcv7_ops; - kregs = kt->k_regs->kregs; - - (void) mdb_dis_select("v8"); - - /* - * Don't attempt to load any thread or register information if - * we're examining the live operating system. - */ - if (strcmp(kt->k_symfile, "/dev/ksyms") == 0) - 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: - */ - if (mdb_tgt_readsym(t, MDB_TGT_AS_VIRT, &pd, sizeof (pd), - MDB_TGT_OBJ_EXEC, "panicbuf") == sizeof (pd) && - pd.pd_version == PANICBUFVERS) { - - size_t pd_size = MIN(PANICBUFSIZE, pd.pd_msgoff); - panic_data_t *pdp = mdb_zalloc(pd_size, UM_SLEEP); - uint_t i, n; - - (void) mdb_tgt_readsym(t, MDB_TGT_AS_VIRT, pdp, pd_size, - 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++) { - (void) kt_putareg(t, kt->k_tid, - pdp->pd_nvdata[i].pnv_name, - pdp->pd_nvdata[i].pnv_value); - } - - mdb_free(pdp, pd_size); - } - - /* - * Prior to the re-structuring of panicbuf, our only register data - * was the panic_regs label_t, into which a setjmp() was performed. - */ - if (kregs[KREG_PC] == 0 && kregs[KREG_SP] == 0 && - mdb_tgt_readsym(t, MDB_TGT_AS_VIRT, &label, sizeof (label), - MDB_TGT_OBJ_EXEC, "panic_regs") == sizeof (label)) { - - kregs[KREG_PC] = label.val[0]; - kregs[KREG_SP] = label.val[1]; - } - - /* - * If we can read a saved register window from the stack at %sp, - * we can also fill in the locals and inputs. - */ - if (kregs[KREG_SP] != 0 && mdb_tgt_vread(t, &rwin, sizeof (rwin), - kregs[KREG_SP]) == sizeof (rwin)) { - - kregs[KREG_L0] = rwin.rw_local[0]; - kregs[KREG_L1] = rwin.rw_local[1]; - kregs[KREG_L2] = rwin.rw_local[2]; - kregs[KREG_L3] = rwin.rw_local[3]; - kregs[KREG_L4] = rwin.rw_local[4]; - kregs[KREG_L5] = rwin.rw_local[5]; - kregs[KREG_L6] = rwin.rw_local[6]; - kregs[KREG_L7] = rwin.rw_local[7]; - - kregs[KREG_I0] = rwin.rw_in[0]; - kregs[KREG_I1] = rwin.rw_in[1]; - kregs[KREG_I2] = rwin.rw_in[2]; - kregs[KREG_I3] = rwin.rw_in[3]; - kregs[KREG_I4] = rwin.rw_in[4]; - kregs[KREG_I5] = rwin.rw_in[5]; - kregs[KREG_I6] = rwin.rw_in[6]; - kregs[KREG_I7] = rwin.rw_in[7]; - - } else if (kregs[KREG_SP] != 0) { - warn("failed to read rwindow at %p -- current " - "frame inputs will be unavailable\n", - (void *)kregs[KREG_SP]); - } -} diff --git a/usr/src/cmd/mdb/sparc/mdb/kvm_v9dep.c b/usr/src/cmd/mdb/sparc/mdb/kvm_v9dep.c deleted file mode 100644 index ea3407fcef..0000000000 --- a/usr/src/cmd/mdb/sparc/mdb/kvm_v9dep.c +++ /dev/null @@ -1,372 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - * - * Copyright 2018 Joyent, Inc. - */ - -/* - * 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/types.h> -#include <sys/machtypes.h> -#include <sys/regset.h> -#include <sys/frame.h> -#include <sys/stack.h> -#include <sys/sysmacros.h> -#include <sys/panic.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_kvm.h> -#include <mdb/mdb_err.h> -#include <mdb/mdb_debug.h> -#include <mdb/mdb.h> - -#ifndef STACK_BIAS -#define STACK_BIAS 0 -#endif - -static int -kt_getareg(mdb_tgt_t *t, mdb_tgt_tid_t tid, - const char *rname, mdb_tgt_reg_t *rp) -{ - const mdb_tgt_regdesc_t *rdp; - kt_data_t *kt = t->t_data; - - if (tid != kt->k_tid) - return (set_errno(EMDB_NOREGS)); - - for (rdp = kt->k_rds; rdp->rd_name != NULL; rdp++) { - if (strcmp(rname, rdp->rd_name) == 0) { - *rp = kt->k_regs->kregs[rdp->rd_num]; - return (0); - } - } - - return (set_errno(EMDB_BADREG)); -} - -static int -kt_putareg(mdb_tgt_t *t, mdb_tgt_tid_t tid, const char *rname, mdb_tgt_reg_t r) -{ - const mdb_tgt_regdesc_t *rdp; - kt_data_t *kt = t->t_data; - - if (tid != kt->k_tid) - return (set_errno(EMDB_NOREGS)); - - for (rdp = kt->k_rds; rdp->rd_name != NULL; rdp++) { - if (strcmp(rname, rdp->rd_name) == 0) { - kt->k_regs->kregs[rdp->rd_num] = r; - 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 -kt_regs(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - mdb_v9printregs((const mdb_tgt_gregset_t *)addr); - return (DCMD_OK); -} - -static int -kt_stack_common(uintptr_t addr, uint_t flags, int argc, - const mdb_arg_t *argv, mdb_tgt_stack_f *func, kreg_t saved_pc) -{ - kt_data_t *kt = mdb.m_target->t_data; - void *arg = (void *)(uintptr_t)mdb.m_nargs; - mdb_tgt_gregset_t gregs, *grp; - - if (flags & DCMD_ADDRSPEC) { - bzero(&gregs, sizeof (gregs)); - gregs.kregs[KREG_FP] = addr; - gregs.kregs[KREG_I7] = saved_pc; - grp = &gregs; - } else - grp = kt->k_regs; - - if (argc != 0) { - if (argv->a_type == MDB_TYPE_CHAR || argc > 1) - return (DCMD_USAGE); - - if (argv->a_type == MDB_TYPE_STRING) - arg = (void *)(uintptr_t)(uint_t) - mdb_strtoull(argv->a_un.a_str); - else - arg = (void *)(uintptr_t)(uint_t)argv->a_un.a_val; - } - - (void) mdb_kvm_v9stack_iter(mdb.m_target, grp, func, arg); - return (DCMD_OK); -} - -static int -kt_stack(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - return (kt_stack_common(addr, flags, argc, argv, mdb_kvm_v9frame, 0)); -} - -static int -kt_stackv(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - return (kt_stack_common(addr, flags, argc, argv, mdb_kvm_v9framev, 0)); -} - -static int -kt_stackr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - /* - * Force printing of first register window by setting the - * saved pc (%i7) to PC_FAKE. - */ - return (kt_stack_common(addr, flags, argc, argv, mdb_kvm_v9framer, - PC_FAKE)); -} - -/*ARGSUSED*/ -static int -kt_notsup(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - errno = EMDB_TGTNOTSUP; - return (DCMD_ERR); -} - -const mdb_tgt_ops_t kt_sparcv9_ops = { - kt_setflags, /* t_setflags */ - kt_setcontext, /* t_setcontext */ - kt_activate, /* t_activate */ - kt_deactivate, /* t_deactivate */ - (void (*)())(uintptr_t)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 */ - (ssize_t (*)())mdb_tgt_notsup, /* t_ioread */ - (ssize_t (*)())mdb_tgt_notsup, /* t_iowrite */ - 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 (*)())(uintptr_t)mdb_tgt_notsup, /* t_run */ - (int (*)())(uintptr_t)mdb_tgt_notsup, /* t_step */ - (int (*)())(uintptr_t)mdb_tgt_notsup, /* t_step_out */ - (int (*)())(uintptr_t)mdb_tgt_notsup, /* t_next */ - (int (*)())(uintptr_t)mdb_tgt_notsup, /* t_cont */ - (int (*)())(uintptr_t)mdb_tgt_notsup, /* t_signal */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_vbrkpt */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_sbrkpt */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_pwapt */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_iowapt */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_vwapt */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_sysenter */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_sysexit */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_signal */ - (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_fault */ - kt_getareg, /* t_getareg */ - kt_putareg, /* t_putareg */ - mdb_kvm_v9stack_iter, /* t_stack_iter */ - (int (*)())(uintptr_t)mdb_tgt_notsup /* t_auxv */ -}; - -void -kt_sparcv9_init(mdb_tgt_t *t) -{ - kt_data_t *kt = t->t_data; - - struct rwindow rwin; - panic_data_t pd; - label_t label; - kreg_t *kregs; - - uint64_t tick; - uint32_t pil; - - /* - * 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. - */ - kt->k_rds = mdb_sparcv9_kregs; - kt->k_regs = mdb_zalloc(sizeof (mdb_tgt_gregset_t), UM_SLEEP); - kt->k_regsize = sizeof (mdb_tgt_gregset_t); - kt->k_dcmd_regs = kt_regs; - kt->k_dcmd_stack = kt_stack; - kt->k_dcmd_stackv = kt_stackv; - kt->k_dcmd_stackr = kt_stackr; - kt->k_dcmd_cpustack = kt_notsup; - kt->k_dcmd_cpuregs = kt_notsup; - - t->t_ops = &kt_sparcv9_ops; - kregs = kt->k_regs->kregs; - - (void) mdb_dis_select("v9plus"); - - /* - * Don't attempt to load any thread or register information if - * we're examining the live operating system. - */ - if (strcmp(kt->k_symfile, "/dev/ksyms") == 0) - 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: - */ - if (mdb_tgt_readsym(t, MDB_TGT_AS_VIRT, &pd, sizeof (pd), - MDB_TGT_OBJ_EXEC, "panicbuf") == sizeof (pd) && - pd.pd_version == PANICBUFVERS) { - - size_t pd_size = MIN(PANICBUFSIZE, pd.pd_msgoff); - panic_data_t *pdp = mdb_zalloc(pd_size, UM_SLEEP); - uint_t i, n; - - (void) mdb_tgt_readsym(t, MDB_TGT_AS_VIRT, pdp, pd_size, - 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++) { - const char *name = pdp->pd_nvdata[i].pnv_name; - uint64_t value = pdp->pd_nvdata[i].pnv_value; - - if (strcmp(name, "tstate") == 0) { - kregs[KREG_CCR] = KREG_TSTATE_CCR(value); - kregs[KREG_ASI] = KREG_TSTATE_ASI(value); - kregs[KREG_PSTATE] = KREG_TSTATE_PSTATE(value); - kregs[KREG_CWP] = KREG_TSTATE_CWP(value); - } else - (void) kt_putareg(t, kt->k_tid, name, value); - } - - mdb_free(pdp, pd_size); - } - - /* - * Prior to the re-structuring of panicbuf, our only register data - * was the panic_regs label_t, into which a setjmp() was performed. - */ - if (kregs[KREG_PC] == 0 && kregs[KREG_SP] == 0 && - mdb_tgt_readsym(t, MDB_TGT_AS_VIRT, &label, sizeof (label), - MDB_TGT_OBJ_EXEC, "panic_regs") == sizeof (label)) { - - kregs[KREG_PC] = label.val[0]; - kregs[KREG_SP] = label.val[1]; - } - - /* - * If we can read a saved register window from the stack at %sp, - * we can also fill in the locals and inputs. - */ - if (kregs[KREG_SP] != 0 && mdb_tgt_vread(t, &rwin, sizeof (rwin), - kregs[KREG_SP] + STACK_BIAS) == sizeof (rwin)) { - - kregs[KREG_L0] = rwin.rw_local[0]; - kregs[KREG_L1] = rwin.rw_local[1]; - kregs[KREG_L2] = rwin.rw_local[2]; - kregs[KREG_L3] = rwin.rw_local[3]; - kregs[KREG_L4] = rwin.rw_local[4]; - kregs[KREG_L5] = rwin.rw_local[5]; - kregs[KREG_L6] = rwin.rw_local[6]; - kregs[KREG_L7] = rwin.rw_local[7]; - - kregs[KREG_I0] = rwin.rw_in[0]; - kregs[KREG_I1] = rwin.rw_in[1]; - kregs[KREG_I2] = rwin.rw_in[2]; - kregs[KREG_I3] = rwin.rw_in[3]; - kregs[KREG_I4] = rwin.rw_in[4]; - kregs[KREG_I5] = rwin.rw_in[5]; - kregs[KREG_I6] = rwin.rw_in[6]; - kregs[KREG_I7] = rwin.rw_in[7]; - - } else if (kregs[KREG_SP] != 0) { - warn("failed to read rwindow at %p -- current " - "frame inputs will be unavailable\n", - (void *)(uintptr_t)(kregs[KREG_SP] + STACK_BIAS)); - } - - /* - * The panic_ipl variable records the IPL of the panic CPU, - * which on sparcv9 is the %pil register's value. - */ - if (mdb_tgt_readsym(t, MDB_TGT_AS_VIRT, &pil, sizeof (pil), - MDB_TGT_OBJ_EXEC, "panic_ipl") == sizeof (pil)) - kregs[KREG_PIL] = pil; - - /* - * The panic_tick variable records %tick at the approximate - * time of the panic in a DEBUG kernel. - */ - if (mdb_tgt_readsym(t, MDB_TGT_AS_VIRT, &tick, sizeof (tick), - MDB_TGT_OBJ_EXEC, "panic_tick") == sizeof (tick)) - kregs[KREG_TICK] = tick; -} diff --git a/usr/src/cmd/mdb/sparc/mdb/mdb_kreg.h b/usr/src/cmd/mdb/sparc/mdb/mdb_kreg.h deleted file mode 100644 index 56255b9031..0000000000 --- a/usr/src/cmd/mdb/sparc/mdb/mdb_kreg.h +++ /dev/null @@ -1,269 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _MDB_KREG_H -#define _MDB_KREG_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _ASM -#include <sys/types.h> -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __sparcv9cpu -#define KREG_NGREG 52 -#ifndef _ASM -typedef uint64_t kreg_t; -#endif /* _ASM */ -#else /* __sparcv9cpu */ -#define KREG_NGREG 38 -#ifndef _ASM -typedef uint32_t kreg_t; -#endif /* _ASM */ -#endif /* __sparcv9cpu */ - -/* - * mdb_tgt_gregset_t register indicies - */ - -#define KREG_G0 0 -#define KREG_G1 1 -#define KREG_G2 2 -#define KREG_G3 3 -#define KREG_G4 4 -#define KREG_G5 5 -#define KREG_G6 6 -#define KREG_G7 7 -#define KREG_O0 8 -#define KREG_O1 9 -#define KREG_O2 10 -#define KREG_O3 11 -#define KREG_O4 12 -#define KREG_O5 13 -#define KREG_O6 14 -#define KREG_O7 15 -#define KREG_L0 16 -#define KREG_L1 17 -#define KREG_L2 18 -#define KREG_L3 19 -#define KREG_L4 20 -#define KREG_L5 21 -#define KREG_L6 22 -#define KREG_L7 23 -#define KREG_I0 24 -#define KREG_I1 25 -#define KREG_I2 26 -#define KREG_I3 27 -#define KREG_I4 28 -#define KREG_I5 29 -#define KREG_I6 30 -#define KREG_I7 31 - -#define KREG_SP KREG_O6 -#define KREG_FP KREG_I6 - -#ifdef __sparcv9cpu -#define KREG_CCR 32 -#else -#define KREG_PSR 32 -#endif - -#define KREG_PC 33 -#define KREG_NPC 34 -#define KREG_Y 35 - -#ifdef __sparcv9cpu - -#define KREG_ASI 36 -#define KREG_FPRS 37 -#define KREG_TICK 38 -#define KREG_STICK 39 -#define KREG_PSTATE 40 -#define KREG_TL 41 -#define KREG_PIL 42 -#define KREG_TBA 43 -#define KREG_VER 44 -#define KREG_CWP 45 -#define KREG_CANSAVE 46 -#define KREG_CANRESTORE 47 -#define KREG_OTHERWIN 48 -#define KREG_WSTATE 49 -#define KREG_CLEANWIN 50 -#define KREG_TT 51 - -#else /* __sparcv9cpu */ - -#define KREG_WIM 36 -#define KREG_TBR 37 - -#endif /* __sparcv9cpu */ - -#ifdef __sparcv9cpu - -#define KREG_CCR_XCC_N_MASK 0x80 -#define KREG_CCR_XCC_Z_MASK 0x40 -#define KREG_CCR_XCC_V_MASK 0x20 -#define KREG_CCR_XCC_C_MASK 0x10 - -#define KREG_CCR_ICC_N_MASK 0x08 -#define KREG_CCR_ICC_Z_MASK 0x04 -#define KREG_CCR_ICC_V_MASK 0x02 -#define KREG_CCR_ICC_C_MASK 0x01 - -#define KREG_FPRS_FEF_MASK 0x4 -#define KREG_FPRS_FEF_SHIFT 2 - -#define KREG_FPRS_DU_MASK 0x2 -#define KREG_FPRS_DU_SHIFT 1 - -#define KREG_FPRS_DL_MASK 0x1 -#define KREG_FPRS_DL_SHIFT 0 - -#define KREG_TICK_NPT_MASK 0x8000000000000000ULL -#define KREG_TICK_NPT_SHIFT 63 - -#define KREG_TICK_CNT_MASK 0x7fffffffffffffffULL -#define KREG_TICK_CNT_SHIFT 0 - -#define KREG_PSTATE_CLE_MASK 0x200 -#define KREG_PSTATE_CLE_SHIFT 9 - -#define KREG_PSTATE_TLE_MASK 0x100 -#define KREG_PSTATE_TLE_SHIFT 8 - -#define KREG_PSTATE_MM_MASK 0x0c0 -#define KREG_PSTATE_MM_SHIFT 6 - -#define KREG_PSTATE_MM_TSO(x) (((x) & KREG_PSTATE_MM_MASK) == 0x000) -#define KREG_PSTATE_MM_PSO(x) (((x) & KREG_PSTATE_MM_MASK) == 0x040) -#define KREG_PSTATE_MM_RMO(x) (((x) & KREG_PSTATE_MM_MASK) == 0x080) -#define KREG_PSTATE_MM_UNDEF(x) (((x) & KREG_PSTATE_MM_MASK) == 0x0c0) - -#define KREG_PSTATE_RED_MASK 0x020 -#define KREG_PSTATE_RED_SHIFT 5 - -#define KREG_PSTATE_PEF_MASK 0x010 -#define KREG_PSTATE_PEF_SHIFT 4 - -#define KREG_PSTATE_AM_MASK 0x008 -#define KREG_PSTATE_AM_SHIFT 3 - -#define KREG_PSTATE_PRIV_MASK 0x004 -#define KREG_PSTATE_PRIV_SHIFT 2 - -#define KREG_PSTATE_IE_MASK 0x002 -#define KREG_PSTATE_IE_SHIFT 1 - -#define KREG_PSTATE_AG_MASK 0x001 -#define KREG_PSTATE_AG_SHIFT 0 - -#define KREG_PSTATE_MASK 0xfff - -#define KREG_TSTATE_CCR(x) (((x) >> 32) & 0xff) -#define KREG_TSTATE_ASI(x) (((x) >> 24) & 0xff) -#define KREG_TSTATE_PSTATE(x) (((x) >> 8) & 0xfff) -#define KREG_TSTATE_CWP(x) ((x) & 0x1f) - -#define KREG_TSTATE_PSTATE_MASK 0x000000000000fff0ULL -#define KREG_TSTATE_PSTATE_SHIFT 8 - -#define KREG_TBA_TBA_MASK 0xffffffffffff8000ULL -#define KREG_TBA_TBA_SHIFT 0 - -#define KREG_TBA_TLG0_MASK 0x4000 -#define KREG_TBA_TLG0_SHIFT 14 - -#define KREG_TBA_TT_MASK 0x3fd0 -#define KREG_TBA_TT_SHIFT 5 - -#define KREG_VER_MANUF_MASK 0xffff000000000000ULL -#define KREG_VER_MANUF_SHIFT 48 - -#define KREG_VER_IMPL_MASK 0x0000ffff00000000ULL -#define KREG_VER_IMPL_SHIFT 32 - -#define KREG_VER_MASK_MASK 0xff000000 -#define KREG_VER_MASK_SHIFT 24 - -#define KREG_VER_MAXTL_MASK 0x0000ff00 -#define KREG_VER_MAXTL_SHIFT 8 - -#define KREG_VER_MAXWIN_MASK 0x0000000f -#define KREG_VER_MAXWIN_SHIFT 0 - -#else /* __sparcv9cpu */ - -#define KREG_PSR_IMPL_MASK 0xf0000000 -#define KREG_PSR_IMPL_SHIFT 28 - -#define KREG_PSR_VER_MASK 0x0f000000 -#define KREG_PSR_VER_SHIFT 24 - -#define KREG_PSR_ICC_MASK 0x00f00000 -#define KREG_PSR_ICC_N_MASK 0x00800000 -#define KREG_PSR_ICC_Z_MASK 0x00400000 -#define KREG_PSR_ICC_V_MASK 0x00200000 -#define KREG_PSR_ICC_C_MASK 0x00100000 -#define KREG_PSR_ICC_SHIFT 20 - -#define KREG_PSR_EC_MASK 0x00002000 -#define KREG_PSR_EC_SHIFT 13 - -#define KREG_PSR_EF_MASK 0x00001000 -#define KREG_PSR_EF_SHIFT 12 - -#define KREG_PSR_PIL_MASK 0x00000f00 -#define KREG_PSR_PIL_SHIFT 8 - -#define KREG_PSR_S_MASK 0x00000080 -#define KREG_PSR_S_SHIFT 7 - -#define KREG_PSR_PS_MASK 0x00000040 -#define KREG_PSR_PS_SHIFT 6 - -#define KREG_PSR_ET_MASK 0x00000020 -#define KREG_PSR_ET_SHIFT 5 - -#define KREG_PSR_CWP_MASK 0x0000001f -#define KREG_PSR_CWP_SHIFT 0 - -#define KREG_TBR_TBA_MASK 0xfffff000 -#define KREG_TBR_TBA_SHIFT 0 - -#define KREG_TBR_TT_MASK 0x00000ff0 -#define KREG_TBR_TT_SHIFT 4 - -#endif /* __sparcv9cpu */ - -#ifdef __cplusplus -} -#endif - -#endif /* _MDB_KREG_H */ diff --git a/usr/src/cmd/mdb/sparc/mdb/mdb_kreg_impl.h b/usr/src/cmd/mdb/sparc/mdb/mdb_kreg_impl.h deleted file mode 100644 index 76a9af2dda..0000000000 --- a/usr/src/cmd/mdb/sparc/mdb/mdb_kreg_impl.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _MDB_KREG_IMPL_H -#define _MDB_KREG_IMPL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <mdb/mdb_kreg.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define MDB_V9GREG_F_STICK_VALID 0x1 /* set on systems with %stick */ - -#ifndef _ASM -/* - * The mdb_tgt_gregset type is opaque to callers of the target interface - * and to our own target common code. - */ -struct mdb_tgt_gregset { - kreg_t kregs[KREG_NGREG]; - uint_t kreg_flags; -}; -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _MDB_KREG_IMPL_H */ diff --git a/usr/src/cmd/mdb/sparc/mdb/mdb_v9util.c b/usr/src/cmd/mdb/sparc/mdb/mdb_v9util.c deleted file mode 100644 index fcc85eb407..0000000000 --- a/usr/src/cmd/mdb/sparc/mdb/mdb_v9util.c +++ /dev/null @@ -1,380 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -#include <sys/types.h> -#include <sys/stack.h> -#include <sys/regset.h> - -#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_err.h> -#include <mdb/mdb.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[] = { - { "g0", KREG_G0, MDB_TGT_R_EXPORT }, - { "g1", KREG_G1, MDB_TGT_R_EXPORT }, - { "g2", KREG_G2, MDB_TGT_R_EXPORT }, - { "g3", KREG_G3, MDB_TGT_R_EXPORT }, - { "g4", KREG_G4, MDB_TGT_R_EXPORT }, - { "g5", KREG_G5, MDB_TGT_R_EXPORT }, - { "g6", KREG_G6, MDB_TGT_R_EXPORT }, - { "g7", KREG_G7, MDB_TGT_R_EXPORT }, - { "o0", KREG_O0, MDB_TGT_R_EXPORT }, - { "o1", KREG_O1, MDB_TGT_R_EXPORT }, - { "o2", KREG_O2, MDB_TGT_R_EXPORT }, - { "o3", KREG_O3, MDB_TGT_R_EXPORT }, - { "o4", KREG_O4, MDB_TGT_R_EXPORT }, - { "o5", KREG_O5, MDB_TGT_R_EXPORT }, - { "o6", KREG_O6, MDB_TGT_R_EXPORT }, - { "o7", KREG_O7, MDB_TGT_R_EXPORT }, - { "l0", KREG_L0, MDB_TGT_R_EXPORT }, - { "l1", KREG_L1, MDB_TGT_R_EXPORT }, - { "l2", KREG_L2, MDB_TGT_R_EXPORT }, - { "l3", KREG_L3, MDB_TGT_R_EXPORT }, - { "l4", KREG_L4, MDB_TGT_R_EXPORT }, - { "l5", KREG_L5, MDB_TGT_R_EXPORT }, - { "l6", KREG_L6, MDB_TGT_R_EXPORT }, - { "l7", KREG_L7, MDB_TGT_R_EXPORT }, - { "i0", KREG_I0, MDB_TGT_R_EXPORT }, - { "i1", KREG_I1, MDB_TGT_R_EXPORT }, - { "i2", KREG_I2, MDB_TGT_R_EXPORT }, - { "i3", KREG_I3, MDB_TGT_R_EXPORT }, - { "i4", KREG_I4, MDB_TGT_R_EXPORT }, - { "i5", KREG_I5, MDB_TGT_R_EXPORT }, - { "i6", KREG_I6, MDB_TGT_R_EXPORT }, - { "i7", KREG_I7, MDB_TGT_R_EXPORT }, - { "ccr", KREG_CCR, MDB_TGT_R_EXPORT }, - { "pc", KREG_PC, MDB_TGT_R_EXPORT }, - { "npc", KREG_NPC, MDB_TGT_R_EXPORT }, - { "y", KREG_Y, 0 }, - { "asi", KREG_ASI, MDB_TGT_R_EXPORT }, - { "fprs", KREG_FPRS, MDB_TGT_R_EXPORT }, - { "tick", KREG_TICK, MDB_TGT_R_EXPORT }, - { "stick", KREG_STICK, MDB_TGT_R_EXPORT }, - { "pstate", KREG_PSTATE, MDB_TGT_R_PRIV | MDB_TGT_R_EXPORT }, - { "tl", KREG_TL, MDB_TGT_R_PRIV | MDB_TGT_R_EXPORT }, - { "tt", KREG_TT, MDB_TGT_R_PRIV | MDB_TGT_R_EXPORT }, - { "pil", KREG_PIL, MDB_TGT_R_PRIV | MDB_TGT_R_EXPORT }, - { "tba", KREG_TBA, MDB_TGT_R_PRIV | MDB_TGT_R_EXPORT }, - { "ver", KREG_VER, MDB_TGT_R_PRIV | MDB_TGT_R_EXPORT }, - { "cwp", KREG_CWP, MDB_TGT_R_PRIV | MDB_TGT_R_EXPORT }, - { "cansave", KREG_CANSAVE, MDB_TGT_R_PRIV }, - { "canrestore", KREG_CANRESTORE, MDB_TGT_R_PRIV }, - { "otherwin", KREG_OTHERWIN, MDB_TGT_R_PRIV }, - { "wstate", KREG_WSTATE, MDB_TGT_R_PRIV }, - { "cleanwin", KREG_CLEANWIN, MDB_TGT_R_PRIV }, - { "sp", KREG_SP, MDB_TGT_R_EXPORT | MDB_TGT_R_ALIAS }, - { "fp", KREG_FP, MDB_TGT_R_EXPORT | MDB_TGT_R_ALIAS }, - { NULL, 0, 0 } -}; - -static const char * -pstate_mm_to_str(kreg_t pstate) -{ - 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_v9printregs(const mdb_tgt_gregset_t *gregs) -{ - const kreg_t *kregs = gregs->kregs; - -#define GETREG2(x) ((uintptr_t)kregs[(x)]), ((uintptr_t)kregs[(x)]) - - mdb_printf("%%g0 = 0x%0?p %15A %%l0 = 0x%0?p %A\n", - GETREG2(KREG_G0), GETREG2(KREG_L0)); - - mdb_printf("%%g1 = 0x%0?p %15A %%l1 = 0x%0?p %A\n", - GETREG2(KREG_G1), GETREG2(KREG_L1)); - - mdb_printf("%%g2 = 0x%0?p %15A %%l2 = 0x%0?p %A\n", - GETREG2(KREG_G2), GETREG2(KREG_L2)); - - mdb_printf("%%g3 = 0x%0?p %15A %%l3 = 0x%0?p %A\n", - GETREG2(KREG_G3), GETREG2(KREG_L3)); - - mdb_printf("%%g4 = 0x%0?p %15A %%l4 = 0x%0?p %A\n", - GETREG2(KREG_G4), GETREG2(KREG_L4)); - - mdb_printf("%%g5 = 0x%0?p %15A %%l5 = 0x%0?p %A\n", - GETREG2(KREG_G5), GETREG2(KREG_L5)); - - mdb_printf("%%g6 = 0x%0?p %15A %%l6 = 0x%0?p %A\n", - GETREG2(KREG_G6), GETREG2(KREG_L6)); - - mdb_printf("%%g7 = 0x%0?p %15A %%l7 = 0x%0?p %A\n\n", - GETREG2(KREG_G7), GETREG2(KREG_L7)); - - mdb_printf("%%o0 = 0x%0?p %15A %%i0 = 0x%0?p %A\n", - GETREG2(KREG_O0), GETREG2(KREG_I0)); - - mdb_printf("%%o1 = 0x%0?p %15A %%i1 = 0x%0?p %A\n", - GETREG2(KREG_O1), GETREG2(KREG_I1)); - - mdb_printf("%%o2 = 0x%0?p %15A %%i2 = 0x%0?p %A\n", - GETREG2(KREG_O2), GETREG2(KREG_I2)); - - mdb_printf("%%o3 = 0x%0?p %15A %%i3 = 0x%0?p %A\n", - GETREG2(KREG_O3), GETREG2(KREG_I3)); - - mdb_printf("%%o4 = 0x%0?p %15A %%i4 = 0x%0?p %A\n", - GETREG2(KREG_O4), GETREG2(KREG_I4)); - - mdb_printf("%%o5 = 0x%0?p %15A %%i5 = 0x%0?p %A\n", - GETREG2(KREG_O5), GETREG2(KREG_I5)); - - mdb_printf("%%o6 = 0x%0?p %15A %%i6 = 0x%0?p %A\n", - GETREG2(KREG_O6), GETREG2(KREG_I6)); - - mdb_printf("%%o7 = 0x%0?p %15A %%i7 = 0x%0?p %A\n\n", - GETREG2(KREG_O7), GETREG2(KREG_I7)); - - mdb_printf(" %%ccr = 0x%02llx " - "xcc=%c%c%c%c icc=%c%c%c%c\n", kregs[KREG_CCR], - (kregs[KREG_CCR] & KREG_CCR_XCC_N_MASK) ? 'N' : 'n', - (kregs[KREG_CCR] & KREG_CCR_XCC_Z_MASK) ? 'Z' : 'z', - (kregs[KREG_CCR] & KREG_CCR_XCC_V_MASK) ? 'V' : 'v', - (kregs[KREG_CCR] & KREG_CCR_XCC_C_MASK) ? 'C' : 'c', - (kregs[KREG_CCR] & KREG_CCR_ICC_N_MASK) ? 'N' : 'n', - (kregs[KREG_CCR] & KREG_CCR_ICC_Z_MASK) ? 'Z' : 'z', - (kregs[KREG_CCR] & KREG_CCR_ICC_V_MASK) ? 'V' : 'v', - (kregs[KREG_CCR] & KREG_CCR_ICC_C_MASK) ? 'C' : 'c'); - - mdb_printf("%%fprs = 0x%02llx " - "fef=%llu du=%llu dl=%llu\n", kregs[KREG_FPRS], - (kregs[KREG_FPRS] & KREG_FPRS_FEF_MASK) >> KREG_FPRS_FEF_SHIFT, - (kregs[KREG_FPRS] & KREG_FPRS_DU_MASK) >> KREG_FPRS_DU_SHIFT, - (kregs[KREG_FPRS] & KREG_FPRS_DL_MASK) >> KREG_FPRS_DL_SHIFT); - - mdb_printf(" %%asi = 0x%02llx\n", kregs[KREG_ASI]); - mdb_printf(" %%y = 0x%0?p\n", (uintptr_t)kregs[KREG_Y]); - - mdb_printf(" %%pc = 0x%0?p %A\n", GETREG2(KREG_PC)); - mdb_printf(" %%npc = 0x%0?p %A\n", GETREG2(KREG_NPC)); - -#if STACK_BIAS != 0 - mdb_printf(" %%sp = 0x%0?p unbiased=0x%0?p\n", - (uintptr_t)kregs[KREG_SP], (uintptr_t)kregs[KREG_SP] + STACK_BIAS); -#else - mdb_printf(" %%sp = 0x%0?p\n", (uintptr_t)kregs[KREG_SP]); -#endif - mdb_printf(" %%fp = 0x%0?p\n\n", (uintptr_t)kregs[KREG_FP]); - - mdb_printf(" %%tick = 0x%016llx\n", kregs[KREG_TICK]); - if (gregs->kreg_flags & MDB_V9GREG_F_STICK_VALID) - mdb_printf(" %%stick = 0x%016llx\n", kregs[KREG_STICK]); - mdb_printf(" %%tba = 0x%016llx\n", kregs[KREG_TBA]); - mdb_printf(" %%tt = 0x%01llx\n", kregs[KREG_TT]); - mdb_printf(" %%tl = 0x%01llx\n", kregs[KREG_TL]); - mdb_printf(" %%pil = 0x%01llx\n", kregs[KREG_PIL]); - - 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", - kregs[KREG_PSTATE], - (kregs[KREG_PSTATE] & KREG_PSTATE_CLE_MASK) >> - KREG_PSTATE_CLE_SHIFT, - (kregs[KREG_PSTATE] & KREG_PSTATE_TLE_MASK) >> - KREG_PSTATE_TLE_SHIFT, pstate_mm_to_str(kregs[KREG_PSTATE]), - (kregs[KREG_PSTATE] & KREG_PSTATE_RED_MASK) >> - KREG_PSTATE_RED_SHIFT, - (kregs[KREG_PSTATE] & KREG_PSTATE_PEF_MASK) >> - KREG_PSTATE_PEF_SHIFT, - (kregs[KREG_PSTATE] & KREG_PSTATE_AM_MASK) >> KREG_PSTATE_AM_SHIFT, - (kregs[KREG_PSTATE] & KREG_PSTATE_PRIV_MASK) >> - KREG_PSTATE_PRIV_SHIFT, - (kregs[KREG_PSTATE] & KREG_PSTATE_IE_MASK) >> KREG_PSTATE_IE_SHIFT, - (kregs[KREG_PSTATE] & KREG_PSTATE_AG_MASK) >> KREG_PSTATE_AG_SHIFT); - - mdb_printf(" %%cwp = 0x%02llx %%cansave = 0x%02llx\n", - kregs[KREG_CWP], kregs[KREG_CANSAVE]); - - mdb_printf("%%canrestore = 0x%02llx %%otherwin = 0x%02llx\n", - kregs[KREG_CANRESTORE], kregs[KREG_OTHERWIN]); - - mdb_printf(" %%wstate = 0x%02llx %%cleanwin = 0x%02llx\n", - kregs[KREG_WSTATE], kregs[KREG_CLEANWIN]); -} - -int -mdb_kvm_v9stack_iter(mdb_tgt_t *t, const mdb_tgt_gregset_t *gsp, - mdb_tgt_stack_f *func, void *arg) -{ - mdb_tgt_gregset_t gregs; - kreg_t *kregs = &gregs.kregs[0]; - int got_pc = (gsp->kregs[KREG_PC] != 0); - - struct rwindow rwin; - uintptr_t sp; - 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. - */ - - bcopy(gsp, &gregs, sizeof (gregs)); - - for (;;) { - for (i = 0; i < 6; i++) - argv[i] = kregs[KREG_I0 + i]; - - if (got_pc && func(arg, kregs[KREG_PC], 6, argv, &gregs) != 0) - break; - - kregs[KREG_PC] = kregs[KREG_I7]; - kregs[KREG_NPC] = kregs[KREG_PC] + 4; - - bcopy(&kregs[KREG_I0], &kregs[KREG_O0], 8 * sizeof (kreg_t)); - got_pc |= (kregs[KREG_PC] != 0); - - if ((sp = kregs[KREG_FP] + STACK_BIAS) == STACK_BIAS || sp == 0) - break; /* Stop if we're at the end of the stack */ - - if (sp & (STACK_ALIGN - 1)) - return (set_errno(EMDB_STKALIGN)); - - if (mdb_tgt_vread(t, &rwin, sizeof (rwin), sp) != sizeof (rwin)) - return (-1); /* Failed to read frame */ - - for (i = 0; i < 8; i++) - kregs[KREG_L0 + i] = (uintptr_t)rwin.rw_local[i]; - for (i = 0; i < 8; i++) - kregs[KREG_I0 + i] = (uintptr_t)rwin.rw_in[i]; - } - - return (0); -} - -/*ARGSUSED*/ -int -mdb_kvm_v9frame(void *arglim, uintptr_t pc, uint_t argc, const long *argv, - const mdb_tgt_gregset_t *gregs) -{ - argc = MIN(argc, (uint_t)(uintptr_t)arglim); - mdb_printf("%a(", pc); - - if (argc != 0) { - mdb_printf("%lr", *argv++); - for (argc--; argc != 0; argc--) - mdb_printf(", %lr", *argv++); - } - - mdb_printf(")\n"); - return (0); -} - -int -mdb_kvm_v9framev(void *arglim, uintptr_t pc, uint_t argc, const long *argv, - const mdb_tgt_gregset_t *gregs) -{ - argc = MIN(argc, (uint_t)(uintptr_t)arglim); - mdb_printf("%0?llr %a(", gregs->kregs[KREG_SP], pc); - - if (argc != 0) { - mdb_printf("%lr", *argv++); - for (argc--; argc != 0; argc--) - mdb_printf(", %lr", *argv++); - } - - mdb_printf(")\n"); - return (0); -} - -int -mdb_kvm_v9framer(void *arglim, uintptr_t pc, uint_t argc, const long *argv, - const mdb_tgt_gregset_t *gregs) -{ - char buf[BUFSIZ]; - const kreg_t *kregs = &gregs->kregs[0]; - - argc = MIN(argc, (uint_t)(uintptr_t)arglim); - - if (pc == PC_FAKE) - mdb_printf("%<b>%0?llr% %s%</b>(", kregs[KREG_SP], "?"); - else - mdb_printf("%<b>%0?llr% %a%</b>(", kregs[KREG_SP], pc); - - if (argc != 0) { - mdb_printf("%lr", *argv++); - for (argc--; argc != 0; argc--) - mdb_printf(", %lr", *argv++); - } - - mdb_printf(")\n"); - - (void) mdb_inc_indent(2); - - mdb_printf("%%l0-%%l3: %?lr %?lr %?lr %?lr\n", - kregs[KREG_L0], kregs[KREG_L1], kregs[KREG_L2], kregs[KREG_L3]); - - mdb_printf("%%l4-%%l7: %?lr %?lr %?lr %?lr\n", - kregs[KREG_L4], kregs[KREG_L5], kregs[KREG_L6], kregs[KREG_L7]); - - if (kregs[KREG_FP] != 0 && (kregs[KREG_FP] + STACK_BIAS) != 0) - if (mdb_dis_ins2str(mdb.m_disasm, mdb.m_target, MDB_TGT_AS_VIRT, - buf, sizeof (buf), kregs[KREG_I7]) != kregs[KREG_I7]) - mdb_printf("%-#25a%s\n", kregs[KREG_I7], buf); - - (void) mdb_dec_indent(2); - mdb_printf("\n"); - - return (0); -} diff --git a/usr/src/cmd/mdb/sparc/mdb/mdb_v9util.h b/usr/src/cmd/mdb/sparc/mdb/mdb_v9util.h deleted file mode 100644 index cc64925b60..0000000000 --- a/usr/src/cmd/mdb/sparc/mdb/mdb_v9util.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _MDB_V9UTIL_H -#define _MDB_V9UTIL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <mdb/mdb_kreg.h> -#include <mdb/mdb_target_impl.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define PC_FAKE -1UL /* illegal pc value unequal 0 */ - -typedef uint32_t mdb_instr_t; - -extern const mdb_tgt_regdesc_t mdb_sparcv9_kregs[]; - -extern void mdb_v9printregs(const mdb_tgt_gregset_t *); -extern int mdb_kvm_v9stack_iter(mdb_tgt_t *, const mdb_tgt_gregset_t *, - mdb_tgt_stack_f *, void *); - -extern int mdb_kvm_v9frame(void *, uintptr_t, uint_t, const long *, - const mdb_tgt_gregset_t *); -extern int mdb_kvm_v9framev(void *, uintptr_t, uint_t, const long *, - const mdb_tgt_gregset_t *); -extern int mdb_kvm_v9framer(void *, uintptr_t, uint_t, const long *, - const mdb_tgt_gregset_t *); - -#ifdef __cplusplus -} -#endif - -#endif /* _MDB_V9UTIL_H */ diff --git a/usr/src/cmd/mdb/sparc/mdb/proc_isadep.c b/usr/src/cmd/mdb/sparc/mdb/proc_isadep.c deleted file mode 100644 index bb64ec399e..0000000000 --- a/usr/src/cmd/mdb/sparc/mdb/proc_isadep.c +++ /dev/null @@ -1,785 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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" - -/* - * User Process Target SPARC v7 and v9 component - * - * This file provides the ISA-dependent portion of the user process target - * for both the sparcv7 and sparcv9 ISAs. For more details on the - * implementation refer to mdb_proc.c. - */ - -#ifdef __sparcv9 -#define __sparcv9cpu -#endif - -#include <mdb/mdb_proc.h> -#include <mdb/mdb_kreg.h> -#include <mdb/mdb_err.h> -#include <mdb/mdb_stdlib.h> -#include <mdb/mdb.h> - -#include <sys/elf_SPARC.h> -#include <sys/stack.h> -#include <libproc.h> - -#ifndef STACK_BIAS -#define STACK_BIAS 0 -#endif - -const mdb_tgt_regdesc_t pt_regdesc[] = { - { "g0", R_G0, MDB_TGT_R_EXPORT }, - { "g1", R_G1, MDB_TGT_R_EXPORT }, - { "g2", R_G2, MDB_TGT_R_EXPORT }, - { "g3", R_G3, MDB_TGT_R_EXPORT }, - { "g4", R_G4, MDB_TGT_R_EXPORT }, - { "g5", R_G5, MDB_TGT_R_EXPORT }, - { "g6", R_G6, MDB_TGT_R_EXPORT }, - { "g7", R_G7, MDB_TGT_R_EXPORT }, - { "o0", R_O0, MDB_TGT_R_EXPORT }, - { "o1", R_O1, MDB_TGT_R_EXPORT }, - { "o2", R_O2, MDB_TGT_R_EXPORT }, - { "o3", R_O3, MDB_TGT_R_EXPORT }, - { "o4", R_O4, MDB_TGT_R_EXPORT }, - { "o5", R_O5, MDB_TGT_R_EXPORT }, - { "o6", R_O6, MDB_TGT_R_EXPORT }, - { "o7", R_O7, MDB_TGT_R_EXPORT }, - { "l0", R_L0, MDB_TGT_R_EXPORT }, - { "l1", R_L1, MDB_TGT_R_EXPORT }, - { "l2", R_L2, MDB_TGT_R_EXPORT }, - { "l3", R_L3, MDB_TGT_R_EXPORT }, - { "l4", R_L4, MDB_TGT_R_EXPORT }, - { "l5", R_L5, MDB_TGT_R_EXPORT }, - { "l6", R_L6, MDB_TGT_R_EXPORT }, - { "l7", R_L7, MDB_TGT_R_EXPORT }, - { "i0", R_I0, MDB_TGT_R_EXPORT }, - { "i1", R_I1, MDB_TGT_R_EXPORT }, - { "i2", R_I2, MDB_TGT_R_EXPORT }, - { "i3", R_I3, MDB_TGT_R_EXPORT }, - { "i4", R_I4, MDB_TGT_R_EXPORT }, - { "i5", R_I5, MDB_TGT_R_EXPORT }, - { "i6", R_I6, MDB_TGT_R_EXPORT }, - { "i7", R_I7, MDB_TGT_R_EXPORT }, -#ifdef __sparcv9 - { "ccr", R_CCR, MDB_TGT_R_EXPORT }, -#else - { "psr", R_PSR, MDB_TGT_R_EXPORT }, -#endif - { "pc", R_PC, MDB_TGT_R_EXPORT }, - { "npc", R_nPC, MDB_TGT_R_EXPORT }, - { "y", R_Y, 0 }, -#ifdef __sparcv9 - { "asi", R_ASI, MDB_TGT_R_EXPORT }, - { "fprs", R_FPRS, MDB_TGT_R_EXPORT }, -#else - { "wim", R_WIM, MDB_TGT_R_EXPORT | MDB_TGT_R_PRIV }, - { "tbr", R_TBR, MDB_TGT_R_EXPORT | MDB_TGT_R_PRIV }, -#endif - { "sp", R_SP, MDB_TGT_R_EXPORT | MDB_TGT_R_ALIAS }, - { "fp", R_FP, MDB_TGT_R_EXPORT | MDB_TGT_R_ALIAS }, - { NULL, 0, 0 } -}; - -#define FPU_FSR 0 /* fake register number for %fsr */ -#define FPU_FPRS 1 /* fake register number for %fprs */ - -/* - * We cannot rely on pr_instr, because if we hit a breakpoint or the user has - * artifically modified memory, it will no longer be correct. - */ -static uint32_t -pt_read_instr(mdb_tgt_t *t) -{ - const lwpstatus_t *psp = &Pstatus(t->t_pshandle)->pr_lwp; - uint32_t ret = 0; - - (void) mdb_tgt_vread(t, &ret, sizeof (ret), psp->pr_reg[R_PC]); - - return (ret); -} - -/*ARGSUSED*/ -int -pt_regs(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - mdb_tgt_t *t = mdb.m_target; - mdb_tgt_tid_t tid; - prgregset_t grs; - uint64_t xgregs[8]; - uint64_t xoregs[8]; - int rwidth, i; - -#if defined(__sparc) && defined(_ILP32) - static const uint32_t zero[8] = { 0 }; - prxregset_t xrs; -#endif - -#define GETREG2(x) ((uintptr_t)grs[(x)]), ((uintptr_t)grs[(x)]) - - if (argc != 0) - return (DCMD_USAGE); - - if (t->t_pshandle == NULL || Pstate(t->t_pshandle) == PS_UNDEAD) { - mdb_warn("no process active\n"); - return (DCMD_ERR); - } - - if (Pstate(t->t_pshandle) == PS_LOST) { - mdb_warn("debugger has lost control of process\n"); - return (DCMD_ERR); - } - - if (flags & DCMD_ADDRSPEC) - tid = (mdb_tgt_tid_t)addr; - else - tid = PTL_TID(t); - - if (PTL_GETREGS(t, tid, grs) != 0) { - mdb_warn("failed to get current register set"); - return (DCMD_ERR); - } - - for (i = 0; i < 8; i++) { - xgregs[i] = (ulong_t)grs[R_G0 + i]; - xoregs[i] = (ulong_t)grs[R_O0 + i]; - } - - if (Pstatus(t->t_pshandle)->pr_dmodel == PR_MODEL_LP64) - rwidth = 16; - else - rwidth = 8; - -#if defined(__sparc) && defined(_ILP32) - /* - * If we are debugging a 32-bit SPARC process on an UltraSPARC CPU, - * the globals and outs can have 32 upper bits hiding in the xregs. - */ - if (PTL_GETXREGS(t, tid, &xrs) == 0 && xrs.pr_type == XR_TYPE_V8P) { - for (i = 0; i < 8; i++) { - xgregs[i] |= (uint64_t) - xrs.pr_un.pr_v8p.pr_xg[XR_G0 + i] << 32; - xoregs[i] |= (uint64_t) - xrs.pr_un.pr_v8p.pr_xo[XR_O0 + i] << 32; - } - - if (bcmp(xrs.pr_un.pr_v8p.pr_xg, zero, sizeof (zero)) || - bcmp(xrs.pr_un.pr_v8p.pr_xo, zero, sizeof (zero))) - rwidth = 16; /* one or more have upper bits set */ - } -#endif /* __sparc && _ILP32 */ - - for (i = 0; i < 8; i++) { - mdb_printf("%%g%d = 0x%0*llx %15llA %%l%d = 0x%0?p %A\n", - i, rwidth, xgregs[i], xgregs[i], i, GETREG2(R_L0 + i)); - } - - for (i = 0; i < 8; i++) { - mdb_printf("%%o%d = 0x%0*llx %15llA %%i%d = 0x%0?p %A\n", - i, rwidth, xoregs[i], xoregs[i], i, GETREG2(R_I0 + i)); - } - - mdb_printf("\n"); - -#ifdef __sparcv9 - mdb_printf(" %%ccr = 0x%02x xcc=%c%c%c%c icc=%c%c%c%c\n", grs[R_CCR], - (grs[R_CCR] & KREG_CCR_XCC_N_MASK) ? 'N' : 'n', - (grs[R_CCR] & KREG_CCR_XCC_Z_MASK) ? 'Z' : 'z', - (grs[R_CCR] & KREG_CCR_XCC_V_MASK) ? 'V' : 'v', - (grs[R_CCR] & KREG_CCR_XCC_C_MASK) ? 'C' : 'c', - (grs[R_CCR] & KREG_CCR_ICC_N_MASK) ? 'N' : 'n', - (grs[R_CCR] & KREG_CCR_ICC_Z_MASK) ? 'Z' : 'z', - (grs[R_CCR] & KREG_CCR_ICC_V_MASK) ? 'V' : 'v', - (grs[R_CCR] & KREG_CCR_ICC_C_MASK) ? 'C' : 'c'); -#else /* __sparcv9 */ - mdb_printf(" %%psr = 0x%08x impl=0x%x ver=0x%x icc=%c%c%c%c\n" - " ec=%u ef=%u pil=%u s=%u ps=%u et=%u cwp=0x%x\n", - grs[R_PSR], - (grs[R_PSR] & KREG_PSR_IMPL_MASK) >> KREG_PSR_IMPL_SHIFT, - (grs[R_PSR] & KREG_PSR_VER_MASK) >> KREG_PSR_VER_SHIFT, - (grs[R_PSR] & KREG_PSR_ICC_N_MASK) ? 'N' : 'n', - (grs[R_PSR] & KREG_PSR_ICC_Z_MASK) ? 'Z' : 'z', - (grs[R_PSR] & KREG_PSR_ICC_V_MASK) ? 'V' : 'v', - (grs[R_PSR] & KREG_PSR_ICC_C_MASK) ? 'C' : 'c', - grs[R_PSR] & KREG_PSR_EC_MASK, grs[R_PSR] & KREG_PSR_EF_MASK, - (grs[R_PSR] & KREG_PSR_PIL_MASK) >> KREG_PSR_PIL_SHIFT, - grs[R_PSR] & KREG_PSR_S_MASK, grs[R_PSR] & KREG_PSR_PS_MASK, - grs[R_PSR] & KREG_PSR_ET_MASK, - (grs[R_PSR] & KREG_PSR_CWP_MASK) >> KREG_PSR_CWP_SHIFT); -#endif /* __sparcv9 */ - - mdb_printf(" %%y = 0x%0?p\n", grs[R_Y]); - - mdb_printf(" %%pc = 0x%0?p %A\n", GETREG2(R_PC)); - mdb_printf(" %%npc = 0x%0?p %A\n", GETREG2(R_nPC)); - - mdb_printf(" %%sp = 0x%0?p\n", grs[R_SP]); - mdb_printf(" %%fp = 0x%0?p\n\n", grs[R_FP]); - -#ifdef __sparcv9 - mdb_printf(" %%asi = 0x%02lx\n", grs[R_ASI]); - mdb_printf("%%fprs = 0x%02lx\n", grs[R_FPRS]); -#else /* __sparcv9 */ - mdb_printf(" %%wim = 0x%08x\n", grs[R_WIM]); - mdb_printf(" %%tbr = 0x%08x\n", grs[R_TBR]); -#endif /* __sparcv9 */ - - return (DCMD_OK); -} - -/*ARGSUSED*/ -int -pt_fpregs(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - mdb_tgt_t *t = mdb.m_target; - mdb_tgt_tid_t tid; - int is_v8plus, is_v9, i; -#ifdef __sparcv9 - prgregset_t grs; -#endif - prfpregset_t fprs; - prxregset_t xrs; - uint32_t *regs; - int ns, nd, nq; - - enum { - FPR_MIXED = 0x0, /* show single, double, and status */ - FPR_SINGLE = 0x1, /* show single-precision only */ - FPR_DOUBLE = 0x2, /* show double-precision only */ - FPR_QUAD = 0x4 /* show quad-precision only */ - }; - - uint_t opts = FPR_MIXED; - - /* - * The prfpregset structure only provides us with the FPU in the form - * of 32-bit integers, doubles, or quads. We use this union of the - * various types to display floats, doubles, and long doubles. - */ - union { - struct { - uint32_t i1; - uint32_t i2; - uint32_t i3; - uint32_t i4; - } ip; - float f; - double d; - long double ld; - } fpu; - - if (mdb_getopts(argc, argv, - 's', MDB_OPT_SETBITS, FPR_SINGLE, &opts, - 'd', MDB_OPT_SETBITS, FPR_DOUBLE, &opts, - 'q', MDB_OPT_SETBITS, FPR_QUAD, &opts, NULL) != argc) - return (DCMD_USAGE); - - if (t->t_pshandle == NULL || Pstate(t->t_pshandle) == PS_UNDEAD) { - mdb_warn("no process active\n"); - return (DCMD_ERR); - } - - if (Pstate(t->t_pshandle) == PS_LOST) { - mdb_warn("debugger has lost control of process\n"); - return (DCMD_ERR); - } - - if (flags & DCMD_ADDRSPEC) - tid = (mdb_tgt_tid_t)addr; - else - tid = PTL_TID(t); - - is_v9 = Pstatus(t->t_pshandle)->pr_dmodel == PR_MODEL_LP64; - is_v8plus = is_v9 == 0 && PTL_GETXREGS(t, tid, &xrs) == 0 && - xrs.pr_type == XR_TYPE_V8P; - -#ifdef __sparcv9 - if (is_v9 && opts == FPR_MIXED) { - if (PTL_GETREGS(t, tid, grs) == 0) - mdb_printf("fprs %lx\n", grs[R_FPRS]); - else - mdb_warn("failed to read fprs register"); - } -#endif - if (is_v8plus && opts == FPR_MIXED) - mdb_printf("fprs %x\n", xrs.pr_un.pr_v8p.pr_fprs); - - if (PTL_GETFPREGS(t, tid, &fprs) != 0) { - mdb_warn("failed to get floating point registers"); - return (DCMD_ERR); - } - - if (opts == FPR_MIXED) { - uint64_t fsr = fprs.pr_fsr; - if (is_v8plus) - fsr |= (uint64_t)xrs.pr_un.pr_v8p.pr_xfsr << 32; - mdb_printf("fsr %llx\n", fsr); - } - - /* - * Set up the regs pointer to be a pointer to a contiguous chunk of - * memory containing all the floating pointer register data. Set - * ns, nd, and nq to indicate the number of registers of each type. - */ - if (is_v9) { - regs = fprs.pr_fr.pr_regs; - ns = 64; - nd = 32; - nq = 16; - } else if (is_v8plus) { - regs = mdb_alloc(sizeof (uint32_t) * 64, UM_SLEEP | UM_GC); - bcopy(fprs.pr_fr.pr_regs, regs, sizeof (uint32_t) * 32); - bcopy(xrs.pr_un.pr_v8p.pr_xfr.pr_regs, regs + 32, - sizeof (uint32_t) * 32); - ns = 64; - nd = 32; - nq = 16; - } else { - regs = fprs.pr_fr.pr_regs; - ns = 32; - nd = 16; - nq = 0; - } - - if (opts == FPR_MIXED) { - for (i = 0; i < ns; i++) { - fpu.ip.i1 = regs[i]; - mdb_printf("f%-3d %08x %e", i, fpu.ip.i1, fpu.f); - if (i & 1) { - fpu.ip.i1 = regs[i - 1]; - fpu.ip.i2 = regs[i]; - mdb_printf(" %g", fpu.d); - } - mdb_printf("\n"); - } - } - - if (opts & FPR_SINGLE) { - for (i = 0; i < ns; i++) { - fpu.ip.i1 = regs[i]; - mdb_printf("f%-3d %08x %e\n", i, fpu.ip.i1, fpu.f); - } - } - - if (opts & FPR_DOUBLE) { - for (i = 0; i < nd; i++) { - fpu.ip.i1 = regs[i * 2 + 0]; - fpu.ip.i2 = regs[i * 2 + 1]; - mdb_printf("f%-3d %08x.%08x %g\n", i * 2, - fpu.ip.i1, fpu.ip.i2, fpu.d); - } - } - - if (opts & FPR_QUAD) { - for (i = 0; i < nq; i++) { - fpu.ip.i1 = regs[i * 4 + 0]; - fpu.ip.i2 = regs[i * 4 + 1]; - fpu.ip.i3 = regs[i * 4 + 2]; - fpu.ip.i4 = regs[i * 4 + 3]; - mdb_printf("f%-3d %08x.%08x.%08x.%08x %s\n", i * 4, - fpu.ip.i1, fpu.ip.i2, fpu.ip.i3, fpu.ip.i4, - longdoubletos(&fpu.ld, 16, 'e')); - } - } - - return (DCMD_OK); -} - -/* - * Read a single floating-point register. If it's a v8 or v9 register, then - * we get its value from prfpregset_t. If it's a v8+ register, look in xregs. - */ -int -pt_getfpreg(mdb_tgt_t *t, mdb_tgt_tid_t tid, ushort_t rd_num, - ushort_t rd_flags, mdb_tgt_reg_t *rp) -{ - mdb_tgt_reg_t rval; - prfpregset_t fprs; - prxregset_t xrs; - - if (PTL_GETFPREGS(t, tid, &fprs) != 0) - return (-1); /* errno is set for us */ - - if ((rd_flags & MDB_TGT_R_XREG) && PTL_GETXREGS(t, tid, &xrs) != 0) - return (-1); /* errno is set for us */ - - if (rd_flags & MDB_TGT_R_FPU) { - switch (rd_num) { - case FPU_FSR: - rval = fprs.pr_fsr; - if (rd_flags & MDB_TGT_R_XREG) - rval |= (uint64_t) - xrs.pr_un.pr_v8p.pr_xfsr << 32; - break; - case FPU_FPRS: - if (rd_flags & MDB_TGT_R_XREG) - rval = xrs.pr_un.pr_v8p.pr_fprs; - break; - } - - } else if (rd_flags & MDB_TGT_R_FPS) { - if (rd_flags & MDB_TGT_R_XREG) - rval = xrs.pr_un.pr_v8p.pr_xfr.pr_regs[rd_num - 32]; - else - rval = fprs.pr_fr.pr_regs[rd_num]; - - } else if (rd_flags & MDB_TGT_R_FPD) { - if (rd_flags & MDB_TGT_R_XREG) - rval = ((uint64_t *) - xrs.pr_un.pr_v8p.pr_xfr.pr_dregs)[rd_num - 16]; - else - rval = ((uint64_t *)fprs.pr_fr.pr_dregs)[rd_num]; - } - - *rp = rval; - return (0); -} - -/* - * Write a single floating-point register. If it's a v8 or v9 register, then - * we set its value in prfpregset_t. If it's a v8+ register, modify the xregs. - */ -int -pt_putfpreg(mdb_tgt_t *t, mdb_tgt_tid_t tid, ushort_t rd_num, - ushort_t rd_flags, mdb_tgt_reg_t rval) -{ - prfpregset_t fprs; - prxregset_t xrs; - - if (PTL_GETFPREGS(t, tid, &fprs) != 0) - return (-1); /* errno is set for us */ - - if ((rd_flags & MDB_TGT_R_XREG) && PTL_GETXREGS(t, tid, &xrs) != 0) - return (-1); /* errno is set for us */ - - if (rd_flags & MDB_TGT_R_FPU) { - switch (rd_num) { - case FPU_FSR: - fprs.pr_fsr = (uint32_t)rval; - if (rd_flags & MDB_TGT_R_XREG) - xrs.pr_un.pr_v8p.pr_xfsr = rval >> 32; - break; - case FPU_FPRS: - if (rd_flags & MDB_TGT_R_XREG) - xrs.pr_un.pr_v8p.pr_fprs = rval; - break; - } - - } else if (rd_flags & MDB_TGT_R_FPS) { - if (rd_flags & MDB_TGT_R_XREG) - xrs.pr_un.pr_v8p.pr_xfr.pr_regs[rd_num - 32] = rval; - else - fprs.pr_fr.pr_regs[rd_num] = rval; - - } else if (rd_flags & MDB_TGT_R_FPD) { - if (rd_flags & MDB_TGT_R_XREG) - ((uint64_t *)xrs.pr_un.pr_v8p.pr_xfr.pr_dregs) - [rd_num - 16] = rval; - else - ((uint64_t *)fprs.pr_fr.pr_dregs)[rd_num] = rval; - } - - if (PTL_SETFPREGS(t, tid, &fprs) != 0) - return (-1); /* errno is set for us */ - - if ((rd_flags & MDB_TGT_R_XREG) && PTL_SETXREGS(t, tid, &xrs) != 0) - return (-1); /* errno is set for us */ - - return (0); -} - -/* - * Utility function for inserting a floating-point register description into - * the p_regs hash table of register descriptions. - */ -static void -pt_addfpreg(mdb_nv_t *nvp, uint_t rnum, uint_t rnam, char pref, ushort_t flags) -{ - uintmax_t nval = MDB_TGT_R_NVAL(rnum, flags | MDB_TGT_R_EXPORT); - char name[8]; /* enough for "[fdq][0-9][0-9]\0" */ - - (void) mdb_iob_snprintf(name, sizeof (name), "%c%u", pref, rnam); - (void) mdb_nv_insert(nvp, name, NULL, nval, MDB_NV_RDONLY); -} - -/* - * Determine the ISA of the target and then insert the appropriate register - * description entries into p_regs. If the target is v8plus or v9, add the - * entire v9 floating-point model; otherwise just add the v8 registers. - */ -void -pt_addfpregs(mdb_tgt_t *t) -{ - pt_data_t *pt = t->t_data; - struct ps_prochandle *P = t->t_pshandle; - prxregset_t xrs; - uint_t i; - - uint_t fpuflag = MDB_TGT_R_FPU | MDB_TGT_R_EXPORT; - uint_t e_mach = pt->p_file ? pt->p_file->gf_ehdr.e_machine : EM_NONE; - uint_t model = P ? Pstatus(P)->pr_dmodel : PR_MODEL_UNKNOWN; - - /* - * If the ELF file is SPARCv9 or the process or core is 64-bit, then - * add the SPARCv9 floating-point descriptions. Otherwise use v7/v8. - */ - if (e_mach == EM_SPARCV9 || model == PR_MODEL_LP64) { - for (i = 0; i < 64; i++) - pt_addfpreg(&pt->p_regs, i, i, 'f', MDB_TGT_R_FPS); - for (i = 0; i < 32; i++) - pt_addfpreg(&pt->p_regs, i, i * 2, 'd', MDB_TGT_R_FPD); - } else { - for (i = 0; i < 32; i++) - pt_addfpreg(&pt->p_regs, i, i, 'f', MDB_TGT_R_FPS); - for (i = 0; i < 16; i++) - pt_addfpreg(&pt->p_regs, i, i * 2, 'd', MDB_TGT_R_FPD); - } - - /* - * If the ELF file is SPARCv8+ or the process or core has v8+ xregs, - * then include the additional v8plus register descriptions. - */ - if (e_mach == EM_SPARC32PLUS || (P != NULL && PTL_GETXREGS(t, - PTL_TID(t), &xrs) == 0 && xrs.pr_type == XR_TYPE_V8P)) { - - for (i = 32; i < 64; i++) { - pt_addfpreg(&pt->p_regs, i, i, 'f', - MDB_TGT_R_FPS | MDB_TGT_R_XREG); - } - - for (i = 16; i < 32; i++) { - pt_addfpreg(&pt->p_regs, i, i * 2, 'd', - MDB_TGT_R_FPD | MDB_TGT_R_XREG); - } - - fpuflag |= MDB_TGT_R_XREG; /* fpu status regs are in xregs */ - - (void) mdb_nv_insert(&pt->p_regs, "fsr", NULL, - MDB_TGT_R_NVAL(FPU_FSR, fpuflag), MDB_NV_RDONLY); - - (void) mdb_nv_insert(&pt->p_regs, "fprs", NULL, - MDB_TGT_R_NVAL(FPU_FPRS, fpuflag), MDB_NV_RDONLY); - - } else { - (void) mdb_nv_insert(&pt->p_regs, "fsr", NULL, - MDB_TGT_R_NVAL(FPU_FSR, fpuflag), MDB_NV_RDONLY); - } -} - -int -pt_frameregs(void *arglim, uintptr_t pc, uint_t argc, const long *argv, - const mdb_tgt_gregset_t *gregs, boolean_t pc_faked) -{ - char buf[BUFSIZ]; - const prgreg_t *pregs = &gregs->gregs[0]; - - argc = MIN(argc, (uint_t)(uintptr_t)arglim); - - if (pc_faked) - mdb_printf("%<b>%0?lr %s%</b>(", pregs[R_SP], "?"); - else - mdb_printf("%<b>%0?lr %a%</b>(", pregs[R_SP], pc); - - if (argc != 0) { - mdb_printf("%lr", *argv++); - for (argc--; argc != 0; argc--) - mdb_printf(", %lr", *argv++); - } - - mdb_printf(")\n"); - - (void) mdb_inc_indent(2); - - mdb_printf("%%l0-%%l3: %?lr %?lr %?lr %?lr\n", - pregs[R_L0], pregs[R_L1], pregs[R_L2], pregs[R_L3]); - - mdb_printf("%%l4-%%l7: %?lr %?lr %?lr %?lr\n", - pregs[R_L4], pregs[R_L5], pregs[R_L6], pregs[R_L7]); - - if (pregs[R_FP] != 0 && (pregs[R_FP] + STACK_BIAS) != 0) - if (mdb_dis_ins2str(mdb.m_disasm, mdb.m_target, MDB_TGT_AS_VIRT, - buf, sizeof (buf), pregs[R_I7]) != pregs[R_I7]) - mdb_printf("%-#25a%s\n", pregs[R_I7], buf); - - (void) mdb_dec_indent(2); - mdb_printf("\n"); - - return (0); -} - -const char * -pt_disasm(const GElf_Ehdr *ehp) -{ -#ifdef __sparcv9 - const char *disname = "v9plus"; -#else - const char *disname = "v8"; -#endif - /* - * If e_machine is SPARC32+, the program has been compiled v8plus or - * v8plusa and we need to allow v9 and potentially VIS opcodes. - */ - if (ehp != NULL && ehp->e_machine == EM_SPARC32PLUS) { - if (ehp->e_flags & (EF_SPARC_SUN_US1 | EF_SPARC_SUN_US3)) - disname = "v9plus"; - else - disname = "v9"; - } - - return (disname); -} - -/* - * Macros and #defines for extracting and interpreting SPARC instruction set, - * used in pt_step_out() and pt_next() below. - */ -#define OP(machcode) ((machcode) >> 30) -#define OP2(machcode) (((machcode) >> 22) & 0x07) -#define OP3(machcode) (((machcode) >> 19) & 0x3f) -#define RD(machcode) (((machcode) >> 25) & 0x1f) -#define RS1(machcode) (((machcode) >> 14) & 0x1f) -#define RS2(machcode) ((machcode) & 0x1f) - -#define OP_BRANCH 0x0 -#define OP_ARITH 0x2 - -#define OP2_ILLTRAP 0x0 - -#define OP3_OR 0x02 -#define OP3_SAVE 0x3c -#define OP3_RESTORE 0x3d - -/* - * If we are stopped on a save instruction or at the first instruction of a - * known function, return %o7 as the step-out address; otherwise return the - * current frame's return address (%i7). Significantly better handling of - * step out in leaf routines could be accomplished by implementing more - * complex decoding of the current function and our current state. - */ -int -pt_step_out(mdb_tgt_t *t, uintptr_t *p) -{ - const lwpstatus_t *psp = &Pstatus(t->t_pshandle)->pr_lwp; - uintptr_t pc = psp->pr_reg[R_PC]; - uint32_t instr; - - char buf[1]; - GElf_Sym s; - - if (Pstate(t->t_pshandle) != PS_STOP) - return (set_errno(EMDB_TGTBUSY)); - - instr = pt_read_instr(t); - - if (mdb_tgt_lookup_by_addr(t, pc, MDB_TGT_SYM_FUZZY, - buf, sizeof (buf), &s, NULL) == 0 && s.st_value == pc) - *p = psp->pr_reg[R_O7] + 2 * sizeof (instr_t); - else if (OP(instr) == OP_ARITH && - OP3(instr) == OP3_SAVE) - *p = psp->pr_reg[R_O7] + 2 * sizeof (instr_t); - else - *p = psp->pr_reg[R_I7] + 2 * sizeof (instr_t); - - return (0); -} - -/* - * Step over call and jmpl by returning the address of the position where a - * temporary breakpoint can be set to catch return from the control transfer. - * This function does not currently provide advancing decoding of DCTI - * couples or any other complex special case; we just fall back to single-step. - */ -int -pt_next(mdb_tgt_t *t, uintptr_t *p) -{ - const lwpstatus_t *psp = &Pstatus(t->t_pshandle)->pr_lwp; - uintptr_t pc; - uintptr_t npc; - GElf_Sym func; - char name[1]; - instr_t instr; - - if (Pstate(t->t_pshandle) != PS_STOP) - return (set_errno(EMDB_TGTBUSY)); - - pc = psp->pr_reg[R_PC]; - npc = psp->pr_reg[R_nPC]; - instr = pt_read_instr(t); - - if (mdb_tgt_lookup_by_addr(t, pc, MDB_TGT_SYM_FUZZY, - name, sizeof (name), &func, NULL) != 0) - return (-1); - - if (npc < func.st_value || func.st_value + func.st_size <= npc) { - uint_t reg; - - /* - * We're about to transfer control outside this function, - * so we want to stop when control returns from the other - * function. Normally the return address will be in %o7, - * tail-calls being the exception. We try to discover - * if this is a tail-call and compute the return address - * in that case. - */ - if (OP(instr) == OP_ARITH && - OP3(instr) == OP3_RESTORE) { - reg = R_I7; - - } else if (OP(instr) == OP_ARITH && - OP3(instr) == OP3_OR && - RD(instr) == R_O7) { - - if (RS1(instr) != R_G0) - return (set_errno(EAGAIN)); - reg = RS2(instr); - - } else { - reg = R_O7; - } - - *p = psp->pr_reg[reg] + 2 * sizeof (instr_t); - - /* - * If a function returns a structure, the caller may place - * an illtrap whose const22 field represents the size of - * the structure immediately after the delay slot of the - * call (or jmpl) instruction. To handle this case, we - * check the instruction that we think we're going to - * return to, and advance past it if it's an illtrap - * instruction. Note that this applies to SPARC v7 and v8, - * but not v9. - */ - if (mdb_tgt_vread(t, &instr, sizeof (instr_t), *p) == - sizeof (instr_t) && - OP(instr) == OP_BRANCH && OP2(instr) == OP2_ILLTRAP) - *p += sizeof (instr_t); - - return (0); - } - - return (set_errno(EAGAIN)); -} diff --git a/usr/src/cmd/mdb/sparc/modules/genunix/gcore_isadep.c b/usr/src/cmd/mdb/sparc/modules/genunix/gcore_isadep.c deleted file mode 100644 index 2839f47219..0000000000 --- a/usr/src/cmd/mdb/sparc/modules/genunix/gcore_isadep.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * This file and its contents are supplied under the terms of the - * Common Development and Distribution License ("CDDL"), version 1.0. - * You may only use this file in accordance with the terms of version - * 1.0 of the CDDL. - * - * A full copy of the text of the CDDL should have accompanied this - * source. A copy of the CDDL is also available via the Internet at - * http://www.illumos.org/license/CDDL. - */ -/* - * Copyright (c) 2013 by Delphix. All rights reserved. - */ - -/* - * ::gcore is not supported on sparc, so these functions are not - * implemented. - */ - -#include <mdb/mdb_gcore.h> - -/* ARGSUSED */ -uintptr_t -gcore_prgetstackbase(mdb_proc_t *p) -{ - return (0); -} - -/* ARGSUSED */ -int -gcore_prfetchinstr(mdb_klwp_t *lwp, ulong_t *ip) -{ - return (0); -} - -/* ARGSUSED */ -int -gcore_prisstep(mdb_klwp_t *lwp) -{ - return (0); -} - -/* ARGSUSED */ -void -gcore_getgregs(mdb_klwp_t *lwp, gregset_t grp) -{ -} - -/* ARGSUSED */ -int -gcore_prgetrvals(mdb_klwp_t *lwp, long *rval1, long *rval2) -{ - return (0); -} diff --git a/usr/src/cmd/mdb/sparc/modules/intr/intr.c b/usr/src/cmd/mdb/sparc/modules/intr/intr.c deleted file mode 100644 index 1ffb7edcce..0000000000 --- a/usr/src/cmd/mdb/sparc/modules/intr/intr.c +++ /dev/null @@ -1,589 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <sys/mdb_modapi.h> -#include <mdb/mdb_ks.h> -#include <sys/async.h> /* ecc_flt for pci_ecc.h */ -#include <sys/ddi_subrdefs.h> -#include <sys/pci/pci_obj.h> -#include "niumx_var.h" -#include "px_obj.h" - -static int intr_pci_walk_step(mdb_walk_state_t *); -static int intr_px_walk_step(mdb_walk_state_t *); -static int intr_niumx_walk_step(mdb_walk_state_t *); -static void intr_pci_print_items(mdb_walk_state_t *); -static void intr_px_print_items(mdb_walk_state_t *); -static char *intr_get_intr_type(uint16_t type); -static void intr_print_banner(void); - -typedef struct intr_info { - uint32_t cpuid; - uint32_t inum; - uint32_t num; - uint32_t pil; - uint16_t intr_type; - uint16_t mondo; - uint8_t ino_ino; - uint_t intr_state; - int instance; - int shared; - char driver_name[12]; - char pathname[MAXNAMELEN]; -} -intr_info_t; - -#define PX_MAX_ENTRIES 32 - -static void intr_print_elements(intr_info_t); -static int detailed = 0; /* Print detailed view */ - - -static int -intr_walk_init(mdb_walk_state_t *wsp) -{ - wsp->walk_addr = (uintptr_t)NULL; - - return (WALK_NEXT); -} - -static int -intr_walk_step(mdb_walk_state_t *wsp) -{ - pci_t *pci_per_p; - px_t *px_state_p; - niumx_devstate_t *niumx_state_p; - - /* read globally declared structures in the pci driver */ - if (mdb_readvar(&pci_per_p, "per_pci_state") != -1) { - wsp->walk_addr = (uintptr_t)pci_per_p; - intr_pci_walk_step(wsp); - } - - /* read globally declared structures in the px driver */ - if (mdb_readvar(&px_state_p, "px_state_p") != -1) { - wsp->walk_addr = (uintptr_t)px_state_p; - intr_px_walk_step(wsp); - } - - /* read globally declared structures in the niumx driver */ - if (mdb_readvar(&niumx_state_p, "niumx_state") != -1) { - wsp->walk_addr = (uintptr_t)niumx_state_p; - intr_niumx_walk_step(wsp); - } - - return (WALK_DONE); -} - -static int -intr_pci_walk_step(mdb_walk_state_t *wsp) -{ - pci_t *pci_per_p; - pci_t pci_per; - uintptr_t start_addr; - - /* Read start of state structure array */ - if (mdb_vread(&pci_per_p, sizeof (uintptr_t), - (uintptr_t)wsp->walk_addr) == -1) { - mdb_warn("intr: failed to read the initial pci_per_p " - "structure\n"); - return (WALK_ERR); - } - - /* Figure out how many items are here */ - start_addr = (uintptr_t)pci_per_p; - - intr_print_banner(); - - while (mdb_vread(&pci_per_p, sizeof (uintptr_t), - (uintptr_t)start_addr) != -1) { - /* Read until nothing is left */ - if (mdb_vread(&pci_per, sizeof (pci_t), - (uintptr_t)pci_per_p) == -1) { - return (WALK_DONE); - } - - wsp->walk_addr = (uintptr_t)pci_per.pci_ib_p; - intr_pci_print_items(wsp); - - start_addr += sizeof (uintptr_t); - } - - return (WALK_DONE); -} - -static int -intr_px_walk_step(mdb_walk_state_t *wsp) -{ - px_t *px_state_p; - px_t px_state; - uintptr_t start_addr; - int x; - - /* Read start of state structure array */ - if (mdb_vread(&px_state_p, sizeof (uintptr_t), - (uintptr_t)wsp->walk_addr) == -1) { - mdb_warn("intr: failed to read the initial px_per_p " - "structure\n"); - return (WALK_ERR); - } - - /* Figure out how many items are here */ - start_addr = (uintptr_t)px_state_p; - - intr_print_banner(); - - for (x = 0; x < PX_MAX_ENTRIES; x++) { - (void) mdb_vread(&px_state_p, sizeof (uintptr_t), - (uintptr_t)start_addr); - - start_addr += sizeof (uintptr_t); - - /* Read if anything is there */ - if (mdb_vread(&px_state, sizeof (px_t), - (uintptr_t)px_state_p) == -1) { - continue; - } - - wsp->walk_addr = (uintptr_t)px_state.px_ib_p; - intr_px_print_items(wsp); - } - - return (WALK_DONE); -} - -static int -intr_niumx_walk_step(mdb_walk_state_t *wsp) -{ - niumx_devstate_t *niumx_state_p; - niumx_devstate_t niumx_state; - uintptr_t start_addr; - char name[MODMAXNAMELEN + 1]; - struct dev_info dev; - intr_info_t info; - int i; - - /* Read start of state structure array */ - if (mdb_vread(&niumx_state_p, sizeof (uintptr_t), - (uintptr_t)wsp->walk_addr) == -1) { - mdb_warn("intr: failed to read the initial niumx_state_p " - "structure\n"); - return (WALK_ERR); - } - - /* Figure out how many items are here */ - start_addr = (uintptr_t)niumx_state_p; - - while (mdb_vread(&niumx_state_p, sizeof (uintptr_t), - (uintptr_t)start_addr) >= 0) { - - start_addr += sizeof (uintptr_t); - - /* Read if anything is there */ - if (mdb_vread(&niumx_state, sizeof (niumx_devstate_t), - (uintptr_t)niumx_state_p) == -1) { - return (WALK_DONE); - } - - for (i = 0; i < NIUMX_MAX_INTRS; i++) { - if (niumx_state.niumx_ihtable[i].ih_sysino == 0) - continue; - - if (niumx_state.niumx_ihtable[i].ih_dip == 0) - continue; - - bzero((void *)&info, sizeof (intr_info_t)); - - info.shared = 0; - - (void) mdb_devinfo2driver( - (uintptr_t)niumx_state.niumx_ihtable[i].ih_dip, - name, sizeof (name)); - - (void) mdb_ddi_pathname( - (uintptr_t)niumx_state.niumx_ihtable[i].ih_dip, - info.pathname, sizeof (info.pathname)); - - /* Get instance */ - if (mdb_vread(&dev, sizeof (struct dev_info), - (uintptr_t)niumx_state.niumx_ihtable[i].ih_dip) == - -1) { - mdb_warn("intr: failed to read DIP " - "structure\n"); - - return (WALK_DONE); - } - - /* Make sure the name doesn't over run */ - (void) mdb_snprintf(info.driver_name, - sizeof (info.driver_name), "%s", name); - - info.instance = dev.devi_instance; - info.inum = niumx_state.niumx_ihtable[i].ih_inum; - info.intr_type = DDI_INTR_TYPE_FIXED; - info.num = 0; - info.intr_state = niumx_state.niumx_ihtable[i].ih_state; - info.ino_ino = i; - info.mondo = niumx_state.niumx_ihtable[i].ih_sysino; - info.pil = niumx_state.niumx_ihtable[i].ih_pri; - info.cpuid = niumx_state.niumx_ihtable[i].ih_cpuid; - - intr_print_elements(info); - } - } - - return (WALK_DONE); -} - -static void -intr_pci_print_items(mdb_walk_state_t *wsp) -{ - ib_t ib; - ib_ino_info_t ino; - ib_ino_pil_t ipil; - ih_t ih; - int count; - char name[MODMAXNAMELEN + 1]; - struct dev_info dev; - intr_info_t info; - - if (mdb_vread(&ib, sizeof (ib_t), - (uintptr_t)wsp->walk_addr) == -1) { - mdb_warn("intr: failed to read pci interrupt block " - "structure\n"); - return; - } - - /* Read in ib_ino_info_t structure at address */ - if (mdb_vread(&ino, sizeof (ib_ino_info_t), - (uintptr_t)ib.ib_ino_lst) == -1) { - /* Nothing here to read from */ - return; - } - - do { - if (mdb_vread(&ipil, sizeof (ib_ino_pil_t), - (uintptr_t)ino.ino_ipil_p) == -1) { - mdb_warn("intr: failed to read pci interrupt " - "ib_ino_pil_t structure\n"); - return; - } - - do { - if (mdb_vread(&ih, sizeof (ih_t), - (uintptr_t)ipil.ipil_ih_start) == -1) { - mdb_warn("intr: failed to read pci interrupt " - "ih_t structure\n"); - return; - } - - count = 0; - - do { - bzero((void *)&info, sizeof (intr_info_t)); - - if ((ino.ino_ipil_size > 1) || - (ipil.ipil_ih_size > 1)) { - info.shared = 1; - } - - (void) mdb_devinfo2driver((uintptr_t)ih.ih_dip, - name, sizeof (name)); - - (void) mdb_ddi_pathname((uintptr_t)ih.ih_dip, - info.pathname, sizeof (info.pathname)); - - /* Get instance */ - if (mdb_vread(&dev, sizeof (struct dev_info), - (uintptr_t)ih.ih_dip) == -1) { - mdb_warn("intr: failed to read DIP " - "structure\n"); - return; - } - - /* Make sure the name doesn't over run */ - (void) mdb_snprintf(info.driver_name, - sizeof (info.driver_name), "%s", name); - - info.instance = dev.devi_instance; - info.inum = ih.ih_inum; - info.intr_type = DDI_INTR_TYPE_FIXED; - info.num = 0; - info.intr_state = ih.ih_intr_state; - info.ino_ino = ino.ino_ino; - info.mondo = ino.ino_mondo; - info.pil = ipil.ipil_pil; - info.cpuid = ino.ino_cpuid; - - intr_print_elements(info); - count++; - - (void) mdb_vread(&ih, sizeof (ih_t), - (uintptr_t)ih.ih_next); - - } while (count < ipil.ipil_ih_size); - - } while (mdb_vread(&ipil, sizeof (ib_ino_pil_t), - (uintptr_t)ipil.ipil_next_p) != -1); - - } while (mdb_vread(&ino, sizeof (ib_ino_info_t), - (uintptr_t)ino.ino_next_p) != -1); -} - -static void -intr_px_print_items(mdb_walk_state_t *wsp) -{ - px_ib_t ib; - px_ino_t ino; - px_ino_pil_t ipil; - px_ih_t ih; - int count; - char name[MODMAXNAMELEN + 1]; - struct dev_info dev; - intr_info_t info; - devinfo_intr_t intr_p; - - if (mdb_vread(&ib, sizeof (px_ib_t), wsp->walk_addr) == -1) { - return; - } - - /* Read in px_ino_t structure at address */ - if (mdb_vread(&ino, sizeof (px_ino_t), - (uintptr_t)ib.ib_ino_lst) == -1) { - /* Nothing here to read from */ - return; - } - - do { /* ino_next_p loop */ - if (mdb_vread(&ipil, sizeof (px_ino_pil_t), - (uintptr_t)ino.ino_ipil_p) == -1) { - continue; - } - - do { /* ipil_next_p loop */ - if (mdb_vread(&ih, sizeof (px_ih_t), - (uintptr_t)ipil.ipil_ih_start) == -1) { - continue; - } - - count = 0; - - do { /* ipil_ih_size loop */ - bzero((void *)&info, sizeof (intr_info_t)); - - (void) mdb_devinfo2driver((uintptr_t)ih.ih_dip, - name, sizeof (name)); - - (void) mdb_ddi_pathname((uintptr_t)ih.ih_dip, - info.pathname, sizeof (info.pathname)); - - /* Get instance */ - if (mdb_vread(&dev, sizeof (struct dev_info), - (uintptr_t)ih.ih_dip) == -1) { - mdb_warn("intr: failed to read DIP " - "structure\n"); - return; - } - - /* Make sure the name doesn't over run */ - (void) mdb_snprintf(info.driver_name, - sizeof (info.driver_name), "%s", name); - - info.instance = dev.devi_instance; - info.inum = ih.ih_inum; - - /* - * Read the type used, keep PCIe messages - * separate. - */ - (void) mdb_vread(&intr_p, - sizeof (devinfo_intr_t), - (uintptr_t)dev.devi_intr_p); - - if (ih.ih_rec_type != MSG_REC) { - info.intr_type = - intr_p.devi_intr_curr_type; - } - - if ((ino.ino_ipil_size > 1) || - (ipil.ipil_ih_size > 1)) { - info.shared = 1; - } - - info.num = ih.ih_msg_code; - info.intr_state = ih.ih_intr_state; - info.ino_ino = ino.ino_ino; - info.mondo = ino.ino_sysino; - info.pil = ipil.ipil_pil; - info.cpuid = ino.ino_cpuid; - - intr_print_elements(info); - count++; - - (void) mdb_vread(&ih, sizeof (px_ih_t), - (uintptr_t)ih.ih_next); - - } while (count < ipil.ipil_ih_size); - - } while ((ipil.ipil_next_p != NULL) && - (mdb_vread(&ipil, sizeof (px_ino_pil_t), - (uintptr_t)ipil.ipil_next_p) != -1)); - - } while ((ino.ino_next_p != NULL) && (mdb_vread(&ino, sizeof (px_ino_t), - (uintptr_t)ino.ino_next_p) != -1)); -} - -static char * -intr_get_intr_type(uint16_t type) -{ - switch (type) { - case DDI_INTR_TYPE_FIXED: - return ("Fixed"); - case DDI_INTR_TYPE_MSI: - return ("MSI"); - case DDI_INTR_TYPE_MSIX: - return ("MSI-X"); - default: - return ("PCIe"); - } -} - -static void -intr_print_banner(void) -{ - if (!detailed) { - mdb_printf("\n%<u>\tDevice\t" - " Type\t" - " MSG #\t" - " State\t" - " INO\t" - " Mondo\t" - " Shared\t" - " Pil\t" - " CPU %</u>" - "\n"); - } -} - -static void -intr_print_elements(intr_info_t info) -{ - if (!detailed) { - mdb_printf(" %11s#%d\t", info.driver_name, info.instance); - mdb_printf(" %s\t", intr_get_intr_type(info.intr_type)); - if (info.intr_type == DDI_INTR_TYPE_FIXED) { - mdb_printf(" --- \t"); - } else { - mdb_printf(" %4d\t", info.num); - } - mdb_printf(" %2s\t", - info.intr_state ? "enbl" : "disbl"); - mdb_printf(" 0x%x\t", info.ino_ino); - mdb_printf(" 0x%x\t", info.mondo); - mdb_printf(" %5s\t", - info.shared ? "yes" : "no"); - mdb_printf(" %4d\t", info.pil); - mdb_printf(" %3d \n", info.cpuid); - } else { - mdb_printf("\n-------------------------------------------\n"); - mdb_printf("Device:\t\t%s\n", info.driver_name); - mdb_printf("Instance:\t%d\n", info.instance); - mdb_printf("Path:\t\t%s\n", info.pathname); - mdb_printf("Inum:\t\t%d\n", info.inum); - mdb_printf("Interrupt Type:\t%s\n", - intr_get_intr_type(info.intr_type)); - if (info.intr_type == DDI_INTR_TYPE_MSI) { - mdb_printf("MSI Number:\t%d\n", info.num); - } else if (info.intr_type == DDI_INTR_TYPE_MSIX) { - mdb_printf("MSI-X Number:\t%d\n", info.num); - } else if (!info.intr_type) { - mdb_printf("PCIe Message #:\t%d\n", info.num); - } - - mdb_printf("Shared Intr:\t%s\n", - info.shared ? "yes" : "no"); - mdb_printf("State:\t\t%d (%s)\n", info.intr_state, - info.intr_state ? "Enabled" : "Disabled"); - mdb_printf("INO:\t\t0x%x\n", info.ino_ino); - mdb_printf("Mondo:\t\t0x%x\n", info.mondo); - mdb_printf("Pil:\t\t%d\n", info.pil); - mdb_printf("CPU:\t\t%d\n", info.cpuid); - } -} - -/*ARGSUSED*/ -static void -intr_walk_fini(mdb_walk_state_t *wsp) -{ - /* Nothing to do here */ -} - -/*ARGSUSED*/ -static int -intr_intr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - detailed = 0; - - if (mdb_getopts(argc, argv, 'd', MDB_OPT_SETBITS, TRUE, &detailed, - NULL) != argc) - return (DCMD_USAGE); - - if (!(flags & DCMD_ADDRSPEC)) { - if (mdb_walk_dcmd("interrupts", "interrupts", argc, argv) - == -1) { - mdb_warn("can't walk pci/px buffer entries\n"); - return (DCMD_ERR); - } - return (DCMD_OK); - } - - return (DCMD_OK); -} - -/* - * MDB module linkage information: - */ - -static const mdb_dcmd_t dcmds[] = { - { "interrupts", "[-d]", "display the interrupt info registered with " - "the PCI/PX nexus drivers", intr_intr }, - { NULL } -}; - -static const mdb_walker_t walkers[] = { - { "interrupts", "walk PCI/PX interrupt structures", - intr_walk_init, intr_walk_step, intr_walk_fini }, - { NULL } -}; - -static const mdb_modinfo_t modinfo = { - MDB_API_VERSION, dcmds, walkers -}; - -const mdb_modinfo_t * -_mdb_init(void) -{ - return (&modinfo); -} diff --git a/usr/src/cmd/mdb/sparc/v7/Makefile b/usr/src/cmd/mdb/sparc/v7/Makefile deleted file mode 100644 index 0635907080..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -include ../../Makefile.common - -MODULES = \ - $(COMMON_MODULES_PROC) \ - $(COMMON_MODULES_PROC_32BIT) - -SUBDIRS = mdb $(MODULES) - -include ../../Makefile.subdirs - -.PARALLEL: $(SUBDIRS) diff --git a/usr/src/cmd/mdb/sparc/v7/dof/Makefile b/usr/src/cmd/mdb/sparc/v7/dof/Makefile deleted file mode 100644 index bbe3ee6aca..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/dof/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = dof.so -MDBTGT = raw - -MODSRCS = dof.c dof_names.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module - -MODSRCS_DIR = ../../../common/modules/dtrace - -LDLIBS += -ldtrace -CLEANFILES += dof_names.c - -dof_names.c: $(MODSRCS_DIR)/mkdof.sh $(SRC)/uts/common/sys/dtrace.h - sh $(MODSRCS_DIR)/mkdof.sh < $(SRC)/uts/common/sys/dtrace.h > $@ diff --git a/usr/src/cmd/mdb/sparc/v7/libavl/Makefile b/usr/src/cmd/mdb/sparc/v7/libavl/Makefile deleted file mode 100644 index a109e5fb66..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/libavl/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = libavl.so -MDBTGT = proc - -MODSRCS = libavl.c \ - avl.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v7/libc/Makefile b/usr/src/cmd/mdb/sparc/v7/libc/Makefile deleted file mode 100644 index 7d6318e87f..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/libc/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. -# - -MODULE = libc.so -MDBTGT = proc - -MODSRCS_DIR = ../../../common/modules/genunix - -MODSRCS = \ - libc.c \ - findstack.c \ - findstack_subr.c - -include ../../../../Makefile.cmd - -CPPFLAGS += -I$(SRC)/lib/libc/inc -CPPFLAGS += -I$(MODSRCS_DIR) - -include ../../Makefile.sparcv7 -include ../../../Makefile.module - -dmod/$(MODULE) := LDLIBS += -lavl - diff --git a/usr/src/cmd/mdb/sparc/v7/libfknsmb/Makefile b/usr/src/cmd/mdb/sparc/v7/libfknsmb/Makefile deleted file mode 100644 index 0fccef0c8c..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/libfknsmb/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# Copyright 2017 Nexenta Systems, Inc. All rights reserved. -# - -MODULE = libfknsmb.so -MDBTGT = proc - -MODSRCS = nsmb.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module - -MODSRCS_DIR = ../../../common/modules/nsmb - -# Note: need our sys includes _before_ ENVCPPFLAGS, proto etc. -CPPFLAGS.first += -I$(SRC)/lib/smbclnt/libfknsmb/common -CPPFLAGS.first += -I$(SRC)/lib/libfakekernel/common - -CPPFLAGS += -I$(SRC)/uts/common/fs/smbclnt/ -CPPFLAGS += -I$(SRC)/uts/common -CPPFLAGS += -D_FAKE_KERNEL - -CSTD= $(CSTD_GNU99) diff --git a/usr/src/cmd/mdb/sparc/v7/libfksmbfs/Makefile b/usr/src/cmd/mdb/sparc/v7/libfksmbfs/Makefile deleted file mode 100644 index 9fbce2342b..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/libfksmbfs/Makefile +++ /dev/null @@ -1,55 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# Copyright 2017 Nexenta Systems, Inc. All rights reserved. -# - -MODULE = libfksmbfs.so -MDBTGT = proc - -MODSRCS = smbfs.c avl.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module - -MODSRCS_DIR = ../../../common/modules/smbfs -GENUNIX_DIR = ../../../common/modules/genunix - -# Note: need our sys includes _before_ ENVCPPFLAGS, proto etc. -CPPFLAGS.first += -I$(SRC)/lib/smbsrv/libfksmbsrv/common -CPPFLAGS.first += -I$(SRC)/lib/libfakekernel/common - -CPPFLAGS += -I$(SRC)/uts/common/fs/smbclnt/ -CPPFLAGS += -I$(SRC)/uts/common - -CSTD= $(CSTD_GNU99) - -dmod/%.o: $(GENUNIX_DIR)/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -dmod/%.ln: $(GENUNIX_DIR)/%.c - $(LINT.c) -c $< diff --git a/usr/src/cmd/mdb/sparc/v7/libfksmbsrv/Makefile b/usr/src/cmd/mdb/sparc/v7/libfksmbsrv/Makefile deleted file mode 100644 index a7d454669d..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/libfksmbsrv/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# Copyright 2013 Nexenta Systems, Inc. All rights reserved. -# Copyright 2015 Gary Mills -# Copyright 2019 Peter Tribble. -# - -MODULE = libfksmbsrv.so -MDBTGT = proc - -MODSRCS = smbsrv.c smbsrv_pcap.c list.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module - -MODSRCS_DIR = ../../../common/modules/smbsrv -GENUNIX_DIR = ../../../common/modules/genunix - -# Note: need our sys includes _before_ ENVCPPFLAGS, proto etc. -CPPFLAGS.first += -I../../../../../lib/smbsrv/libfksmbsrv/common -CPPFLAGS.first += -I../../../../../lib/libfakekernel/common - -CPPFLAGS += -I../../../../../uts/common - -CSTD= $(CSTD_GNU99) - -dmod/%.o: $(GENUNIX_DIR)/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) diff --git a/usr/src/cmd/mdb/sparc/v7/libmlsvc/Makefile b/usr/src/cmd/mdb/sparc/v7/libmlsvc/Makefile deleted file mode 100644 index 715093e443..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/libmlsvc/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# Copyright 2018 Nexenta Systems, Inc. All rights reserved. -# Copyright 2019 Peter Tribble. -# - -MODULE = libmlsvc.so -MDBTGT = proc - -MODSRCS = mlsvc.c smb_ht.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module - -MODSRCS_DIR = ../../../common/modules/libmlsvc - -# CPPFLAGS += -I$(SRC)/lib/smbsrv/libmlsvc -CPPFLAGS += -I$(SRC)/uts/common - -CSTD= $(CSTD_GNU99) diff --git a/usr/src/cmd/mdb/sparc/v7/libnvpair/Makefile b/usr/src/cmd/mdb/sparc/v7/libnvpair/Makefile deleted file mode 100644 index ec17a948ab..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/libnvpair/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = libnvpair.so -MDBTGT = proc - -MODSRCS = libnvpair.c \ - nvpair.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v7/libproc/Makefile b/usr/src/cmd/mdb/sparc/v7/libproc/Makefile deleted file mode 100644 index e8782a568a..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/libproc/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -MODULE = libproc.so -MDBTGT = proc - -MODSRCS_DIR = ../../../common/modules/libproc - -MODSRCS = libproc.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module - -CFLAGS += -I../../../../../lib/libproc/common -LINTFLAGS += -I../../../../../lib/libproc/common - -CERRWARN += $(CNOWARN_UNINIT) - -%.o: $(MODSRCS_DIR)/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.ln: $(MODSRCS_DIR)/%.c - $(LINT.c) -c $< diff --git a/usr/src/cmd/mdb/sparc/v7/libsysevent/Makefile b/usr/src/cmd/mdb/sparc/v7/libsysevent/Makefile deleted file mode 100644 index 5d70819eda..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/libsysevent/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = libsysevent.so -MDBTGT = proc - -MODSRCS = libsysevent.c \ - sysevent.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v7/libtopo/Makefile b/usr/src/cmd/mdb/sparc/v7/libtopo/Makefile deleted file mode 100644 index 988276028d..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/libtopo/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -MODULE = libtopo.so -MDBTGT = proc - -MODSRCS = libtopo.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module - -CPPFLAGS += -I$(SRC)/lib/fm/topo/libtopo/common -CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/cmd/mdb/sparc/v7/libumem/Makefile b/usr/src/cmd/mdb/sparc/v7/libumem/Makefile deleted file mode 100644 index c9ca51f625..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/libumem/Makefile +++ /dev/null @@ -1,61 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -MODULE = libumem.so -MDBTGT = proc - -MODSRCS_DIR = ../../../common/modules/genunix - -MODSRCS = \ - dist.c \ - kgrep.c \ - leaky.c \ - leaky_subr.c \ - libumem.c \ - misc.c \ - proc_kludges.c \ - umem.c - -include ../../../../Makefile.cmd - -CPPFLAGS += -I$(SRC)/lib/libumem/common -CPPFLAGS += -I$(SRC)/lib/libc/inc -CPPFLAGS += -I$(MODSRCS_DIR) - -include ../../Makefile.sparcv7 -include ../../../Makefile.module - -dmod/$(MODULE) := LDLIBS += -lproc -lm - -CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += $(CNOWARN_UNINIT) - -%.o: $(MODSRCS_DIR)/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.ln: $(MODSRCS_DIR)/%.c - $(LINT.c) -c $< diff --git a/usr/src/cmd/mdb/sparc/v7/libuutil/Makefile b/usr/src/cmd/mdb/sparc/v7/libuutil/Makefile deleted file mode 100644 index 2b0b2a5d7a..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/libuutil/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = libuutil.so -MDBTGT = proc - -MODSRCS_DIR = ../../../common/modules/libuutil - -MODSRCS = libuutil.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module - -%.o: $(MODSRCS_DIR)/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.ln: $(MODSRCS_DIR)/%.c - $(LINT.c) -c $< diff --git a/usr/src/cmd/mdb/sparc/v7/libzpool/Makefile b/usr/src/cmd/mdb/sparc/v7/libzpool/Makefile deleted file mode 100644 index 0e94002bd0..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/libzpool/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# Copyright (c) 2016 by Delphix. All rights reserved. -# - -MODULE = libzpool.so -MDBTGT = proc - -MODSRCS = zfs.c list.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module -include ../../../common/modules/zfs/Makefile.zfs - -MODSRCS_DIR = ../../../common/modules/zfs -GENUNIX_DIR = ../../../common/modules/genunix - -CPPFLAGS += -I../../../../../lib/libzpool/common \ - -I../../../../../uts/common/fs/zfs \ - -I../../../../../uts/common/fs/zfs/lua \ - -I../../../../../common/zfs - -CSTD= $(CSTD_GNU99) - -CERRWARN += -_gcc=-Wno-type-limits - -dmod/%.o: $(GENUNIX_DIR)/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) diff --git a/usr/src/cmd/mdb/sparc/v7/list/Makefile b/usr/src/cmd/mdb/sparc/v7/list/Makefile deleted file mode 100644 index 88c634f575..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/list/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. -# - -MODULE = list.so -MDBTGT = proc - -MODSRCS = listmod.c \ - list.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v7/mdb/Makefile b/usr/src/cmd/mdb/sparc/v7/mdb/Makefile deleted file mode 100644 index 714da5dcf4..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/mdb/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -SRCS = kvm_v7dep.c \ - kvm_v9dep.c \ - mdb_v9util.c \ - proc_isadep.c - -%.o: ../../mdb/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.ln: ../../mdb/%.c - $(LINT.c) -c $< - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.mdb - -CPPFLAGS += -I../../mdb - -install: all $(ISAEXEC) $(ROOTPROG32) $(ROOTLINK32) - -$(RM) $(ROOTPROG) - -$(LN) $(ISAEXEC) $(ROOTPROG) - -$(RM) $(ROOTLINK) - -$(LN) $(ISAEXEC) $(ROOTLINK) diff --git a/usr/src/cmd/mdb/sparc/v7/mdb_ds/Makefile b/usr/src/cmd/mdb/sparc/v7/mdb_ds/Makefile deleted file mode 100644 index cd6f64fb53..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/mdb_ds/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 1998-1999 by Sun Microsystems, Inc. -# All rights reserved. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = mdb_ds.so -MDBTGT = proc - -MODSRCS = mdb_ds.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v7/mdb_test/Makefile b/usr/src/cmd/mdb/sparc/v7/mdb_test/Makefile deleted file mode 100644 index ae437218ea..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/mdb_test/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 1999 by Sun Microsystems, Inc. -# All rights reserved. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = mdb_test.so -MDBTGT = proc - -MODSRCS = mdb_test.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v7/svc.configd/Makefile b/usr/src/cmd/mdb/sparc/v7/svc.configd/Makefile deleted file mode 100644 index 09e4d5de19..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/svc.configd/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = svc.configd.so -MDBTGT = proc - -MODSRCS_DIR = ../../../common/modules/svc.configd - -MODSRCS = configd.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module - -CPPFLAGS += -I$(SRC)/cmd/svc/configd -I$(SRC)/cmd/svc/common -I$(SRC)/common/svc - -%.o: $(MODSRCS_DIR)/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.ln: $(MODSRCS_DIR)/%.c - $(LINT.c) -c $< diff --git a/usr/src/cmd/mdb/sparc/v7/svc.startd/Makefile b/usr/src/cmd/mdb/sparc/v7/svc.startd/Makefile deleted file mode 100644 index ca2900b4e7..0000000000 --- a/usr/src/cmd/mdb/sparc/v7/svc.startd/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = svc.startd.so -MDBTGT = proc - -MODSRCS_DIR = ../../../common/modules/svc.startd - -MODSRCS = startd.c - -include ../../../../Makefile.cmd -include ../../Makefile.sparcv7 -include ../../../Makefile.module - -CPPFLAGS += -I$(SRC)/cmd/svc/startd -I$(SRC)/lib/librestart/common - -%.o: $(MODSRCS_DIR)/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.ln: $(MODSRCS_DIR)/%.c - $(LINT.c) -c $< diff --git a/usr/src/cmd/mdb/sparc/v9/Makefile b/usr/src/cmd/mdb/sparc/v9/Makefile deleted file mode 100644 index 944f39ea26..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -include ../../Makefile.common - -MODULES = \ - $(COMMON_MODULES_PROC) \ - $(COMMON_MODULES_PROC_64BIT) - $(COMMON_MODULES_KVM) \ - intr \ - ssd - -# -# a "$(MODULES): kmdb" rule would seem to do the trick but, for some reason, -# it serializes $(MODULES). -# -SUBDIRS = mdb mdb_ks kmdb libstandctf libstand .WAIT $(MODULES) - -include ../../Makefile.subdirs - -.PARALLEL: $(SUBDIRS) diff --git a/usr/src/cmd/mdb/sparc/v9/Makefile.kmdb b/usr/src/cmd/mdb/sparc/v9/Makefile.kmdb deleted file mode 100644 index 32fc72077b..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/Makefile.kmdb +++ /dev/null @@ -1,59 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" -# - -ARCHOPTS = -D__sparcv9cpu -D__sparcv9 - -ASFLAGS += -I$(ROOT)/usr/include/v9 -CPPFLAGS += -I$(ROOT)/usr/include/v9 - -PROMINCDIRS += $(SRC)/uts/sun4u - -KMDBML += \ - client_handler.s \ - kaif_handlers.s \ - kaif_invoke.s \ - kaif_resume.s \ - kaif_startup.s \ - kmdb_setcontext.s \ - kmdb_start.s \ - kmdb_v9asmutil.s - -KMDBSRCS += \ - mdb_v9util.c - -REGOFFUSERS = \ - kaif_resume.o \ - kaif_startup.o - -CTXOFFUSERS = \ - kmdb_setcontext.o - -$(REGOFFUSERS) $(REGOFFUSERS:%.o=%.ln): kaif_off.h - -$(CTXOFFUSERS) $(CTXOFFUSERS:%.o=%.ln): kmdb_context_off.h - diff --git a/usr/src/cmd/mdb/sparc/v9/arp/Makefile b/usr/src/cmd/mdb/sparc/v9/arp/Makefile deleted file mode 100644 index 0e0b290b84..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/arp/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = arp.so -MDBTGT = kvm - -MODSRCS = arp.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/cpc/Makefile b/usr/src/cmd/mdb/sparc/v9/cpc/Makefile deleted file mode 100644 index 73dd98ba15..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/cpc/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 2000 by Sun Microsystems, Inc. -# All rights reserved. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = cpc.so -MDBTGT = kvm - -MODSRCS = cpc.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/crypto/Makefile b/usr/src/cmd/mdb/sparc/v9/crypto/Makefile deleted file mode 100644 index 4d78098d53..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/crypto/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = crypto.so -MDBTGT = kvm - -MODSRCS = impl.c spi.c common.c sched_impl.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/dof/Makefile b/usr/src/cmd/mdb/sparc/v9/dof/Makefile deleted file mode 100644 index 63a6c78fe3..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/dof/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = dof.so -MDBTGT = raw - -MODSRCS = dof.c dof_names.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -MODSRCS_DIR = ../../../common/modules/dtrace - -LDLIBS += -ldtrace -CLEANFILES += dof_names.c - -dof_names.c: $(MODSRCS_DIR)/mkdof.sh $(SRC)/uts/common/sys/dtrace.h - sh $(MODSRCS_DIR)/mkdof.sh < $(SRC)/uts/common/sys/dtrace.h > $@ diff --git a/usr/src/cmd/mdb/sparc/v9/dtrace/Makefile b/usr/src/cmd/mdb/sparc/v9/dtrace/Makefile deleted file mode 100644 index 75b057c0b6..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/dtrace/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = dtrace.so -MDBTGT = kvm - -MODSRCS = dtrace.c dof.c dof_names.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -MODULE_BUILD_TYPE = mdb -MODSRCS_DIR = ../../../common/modules/dtrace - -CPPFLAGS += -I$(SRC)/uts/sun4u -LDLIBS += -ldtrace -lm -CLEANFILES += dof_names.c - -dof_names.c: $(MODSRCS_DIR)/mkdof.sh $(SRC)/uts/common/sys/dtrace.h - sh $(MODSRCS_DIR)/mkdof.sh < $(SRC)/uts/common/sys/dtrace.h > $@ diff --git a/usr/src/cmd/mdb/sparc/v9/emlxs/Makefile b/usr/src/cmd/mdb/sparc/v9/emlxs/Makefile deleted file mode 100644 index 5568695140..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/emlxs/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -MODULE = emlxs.so -MDBTGT = kvm - -MODSRCS = emlxs.c - -EMLXSBASE = ../../../../../uts/common/sys/fibre-channel/fca/emlxs - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -I$(EMLXSBASE) diff --git a/usr/src/cmd/mdb/sparc/v9/fcip/Makefile b/usr/src/cmd/mdb/sparc/v9/fcip/Makefile deleted file mode 100644 index 9d270aa8e6..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/fcip/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -MODULE = fcip.so -MDBTGT = kvm - -MODSRCS = fcip.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -I$(SRC)/uts/common - -LINTFLAGS64 += -erroff=E_STATIC_UNUSED - -CERRWARN += -_gcc=-Wno-unused-function diff --git a/usr/src/cmd/mdb/sparc/v9/fcp/Makefile b/usr/src/cmd/mdb/sparc/v9/fcp/Makefile deleted file mode 100644 index d99e81c6be..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/fcp/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -MODULE = fcp.so -MDBTGT = kvm - -MODSRCS = fcp.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -I$(SRC)/uts/common diff --git a/usr/src/cmd/mdb/sparc/v9/fctl/Makefile b/usr/src/cmd/mdb/sparc/v9/fctl/Makefile deleted file mode 100644 index 28fd247a1c..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/fctl/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -MODULE = fctl.so -MDBTGT = kvm - -MODSRCS = fctl.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -I$(SRC)/uts/common - -LINTFLAGS64 += -erroff=E_STATIC_UNUSED -erroff=E_FUNC_VAR_UNUSED -LINTFLAGS64 += -erroff=E_PRECEDENCE_CONFUSION -LINTFLAGS64 += -erroff=E_SEC_FORBIDDEN_WARN_CFTIME -LINTFLAGS64 += -erroff=E_FUNC_SET_NOT_USED -LINTFLAGS64 += -erroff=E_FUNC_ARG_UNUSED -LINTFLAGS64 += -erroff=E_SEC_SPRINTF_UNBOUNDED_COPY - -CERRWARN += -_gcc=-Wno-unused-function -CERRWARN += -_gcc=-Wno-unused-variable -CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/cmd/mdb/sparc/v9/genunix/Makefile b/usr/src/cmd/mdb/sparc/v9/genunix/Makefile deleted file mode 100644 index 8bfb17c607..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/genunix/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -MODULE = genunix.so -MDBTGT = kvm - -include ../../../common/modules/genunix/Makefile.files - -COMMONSRCS = \ - $(GENUNIX_SRCS) - -KMODSRCS = \ - $(COMMONSRCS) - -MODSRCS = \ - $(COMMONSRCS) \ - gcore.c \ - typegraph.c - -# -# This signals that $(KMODSRCS) != $(MODSRCS). Typegraph is not usable under -# kmdb. As such, we don't bother compiling it. -KMOD_SOURCES_DIFFERENT=$(POUND_SIGN) - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -dmod/$(MODULE) := LDLIBS += -lm -lproc - -# -# We are not actually hardwiring some dependency on sun4u, we just need to -# include sys/param.h with _MACHDEP defined, and this forces the inclusion of -# machparam.h, even though we don't use anything there. This is a temporary -# kludge until we invent -DDONTINCLUDEMACHPARAM or something. -# -CPPFLAGS += -I$(SRC)/uts/sun4u - -# Needed to include c2/audit.h (from cred.h) -CPPFLAGS += -I$(SRC)/uts/common -# Needed to find include file mutex_impl.h -CPPFLAGS += -I$(SRC)/uts/sparc/v9 - -CERRWARN += -_gcc=-Wno-char-subscripts -CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += $(CNOWARN_UNINIT) -CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-type-limits - -LINTFLAGS64 += -erroff=E_EMPTY_TRANSLATION_UNIT - -MODSRCS_DIR = ../../../sparc/modules/genunix diff --git a/usr/src/cmd/mdb/sparc/v9/hook/Makefile b/usr/src/cmd/mdb/sparc/v9/hook/Makefile deleted file mode 100644 index 1c2c6453a9..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/hook/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = hook.so -MDBTGT = kvm - -MODSRCS = hook.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/idm/Makefile b/usr/src/cmd/mdb/sparc/v9/idm/Makefile deleted file mode 100644 index cf5e9e82ff..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/idm/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# - -MODULE = idm.so -MDBTGT = kvm - -MODSRCS = idm.c - -ISCSITBASE = ../../../../../uts/common/io/comstar/port/iscsit -ISCSIBASE = ../../../../../uts/common/io/scsi/adapters/iscsi -ISERBASE = ../../../../../uts/common - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -I$(ISCSITBASE) -CPPFLAGS += -I$(ISCSIBASE) -CPPFLAGS += -I$(ISERBASE) - -CERRWARN += $(CNOWARN_UNINIT) diff --git a/usr/src/cmd/mdb/sparc/v9/intr/Makefile b/usr/src/cmd/mdb/sparc/v9/intr/Makefile deleted file mode 100644 index 7cf910bb13..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/intr/Makefile +++ /dev/null @@ -1,75 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2010 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -MODULE = intr.so -MDBTGT = kvm - -MODSRCS = intr.c - -MDB_DIR= $(ROOT)/usr/lib/mdb/kvm/sparcv9 -MDB_INTR=intr.so -MDB_PCIPSY=pcipsy.so -MDB_PCISCH=pcisch.so -MDB_PX=px.so -MDB_NIUMX=niumx.so - -KMDB_DIR= $(ROOT)/kernel/kmdb/sparcv9 -KMDB_INTR=intr -KMDB_PCIPSY=pcipsy -KMDB_PCISCH=pcisch -KMDB_PX=px -KMDB_NIUMX=niumx - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -I$(SRC)/uts/common -CPPFLAGS += -I$(SRC)/uts/sun4 -CPPFLAGS += -I$(SRC)/uts/sun4/io/px -CPPFLAGS += -I$(SRC)/uts/sun4u -CPPFLAGS += -I$(SRC)/uts/sun4v/io/niumx -CPPFLAGS += -I$(SRC)/uts/sparc/v9 - -MODSRCS_DIR = ../../../sparc/modules/intr - -install: all - -$(RM) $(MDB_DIR)/$(MDB_PCIPSY) - -$(RM) $(MDB_DIR)/$(MDB_PCISCH) - -$(RM) $(MDB_DIR)/$(MDB_PX) - -$(RM) $(MDB_DIR)/$(MDB_NIUMX) - -cd $(MDB_DIR); $(SYMLINK) $(MDB_INTR) $(MDB_PCIPSY) - -cd $(MDB_DIR); $(SYMLINK) $(MDB_INTR) $(MDB_PCISCH) - -cd $(MDB_DIR); $(SYMLINK) $(MDB_INTR) $(MDB_PX) - -cd $(MDB_DIR); $(SYMLINK) $(MDB_INTR) $(MDB_NIUMX) - -$(RM) $(KMDB_DIR)/$(KMDB_PCIPSY) - -$(RM) $(KMDB_DIR)/$(KMDB_PCISCH) - -$(RM) $(KMDB_DIR)/$(KMDB_PX) - -$(RM) $(KMDB_DIR)/$(KMDB_NIUMX) - -cd $(KMDB_DIR); $(SYMLINK) $(KMDB_INTR) $(KMDB_PCIPSY) - -cd $(KMDB_DIR); $(SYMLINK) $(KMDB_INTR) $(KMDB_PCISCH) - -cd $(KMDB_DIR); $(SYMLINK) $(KMDB_INTR) $(KMDB_PX) - -cd $(KMDB_DIR); $(SYMLINK) $(KMDB_INTR) $(KMDB_NIUMX) diff --git a/usr/src/cmd/mdb/sparc/v9/ip/Makefile b/usr/src/cmd/mdb/sparc/v9/ip/Makefile deleted file mode 100644 index 7d5ab01461..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/ip/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -MODULE = ip.so -MDBTGT = kvm - -MODSRCS = ip.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -I$(SRC)/uts/common/inet diff --git a/usr/src/cmd/mdb/sparc/v9/ipc/Makefile b/usr/src/cmd/mdb/sparc/v9/ipc/Makefile deleted file mode 100644 index bb5ab76ef0..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/ipc/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 1999-2000 by Sun Microsystems, Inc. -# All rights reserved. -# - -MODULE = ipc.so -MDBTGT = kvm - -MODSRCS = ipc.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/cmd/mdb/sparc/v9/ipp/Makefile b/usr/src/cmd/mdb/sparc/v9/ipp/Makefile deleted file mode 100644 index daf786871f..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/ipp/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2001-2002 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -MODULE = ipp.so -MDBTGT = kvm - -MODSRCS = ipp.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CERRWARN += $(CNOWARN_UNINIT) diff --git a/usr/src/cmd/mdb/sparc/v9/kmdb/Makefile b/usr/src/cmd/mdb/sparc/v9/kmdb/Makefile deleted file mode 100644 index 587f618343..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/kmdb/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" -# - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../Makefile.kmdb.64 -include ../../../Makefile.kmdb - -STANDLIBS += $(ROOT)/usr/lib/sparcv9/libstanddisasm.so - -all: kmdb_modlinktest.o -lint: FRC - -# -# Uncomment the following line to enable trap accounting. A DTLB translation -# will be added for the trap table, and each handler installed by KMDB will use -# its padding to keep a trap count. See kaif_handlers.s. -# -#TRAPCOUNT = -DKMDB_TRAPCOUNT - -CPPFLAGS += -I../../mdb -I.. -I$(SRC)/uts/sun4 -I$(SRC)/uts/sun4u $(TRAPCOUNT) -ASFLAGS += -I$(SRC)/uts/sun4 -I$(SRC)/uts/sun4u $(TRAPCOUNT) - -install: all - -FRC: diff --git a/usr/src/cmd/mdb/sparc/v9/kmdb/client_handler.s b/usr/src/cmd/mdb/sparc/v9/kmdb/client_handler.s deleted file mode 100644 index 8cceef4bd5..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/kmdb/client_handler.s +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#if !defined(__lint) -#include <sys/asm_linkage.h> -#include <sys/privregs.h> -#endif - -/* - * The interface for a client programs that call the 64-bit romvec OBP - */ - -#if defined(__lint) -/* ARGSUSED */ -int -client_handler(void *cif_handler, void *arg_array) -{ - return (0); -} -#else /* __lint */ - - ENTRY(client_handler) - save %sp, -SA64(MINFRAME64), %sp ! 32 bit frame, 64 bit sized - mov %i1, %o0 -1: - rdpr %pstate, %l4 ! Get the present pstate value - andn %l4, PSTATE_AM, %l6 - wrpr %l6, 0, %pstate ! Set PSTATE_AM = 0 - jmpl %i0, %o7 ! Call cif handler - nop - wrpr %l4, 0, %pstate ! Just restore - ret ! Return result ... - restore %o0, %g0, %o0 ! delay; result in %o0 - SET_SIZE(client_handler) - -#endif /* __lint */ diff --git a/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_asmutil.h b/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_asmutil.h deleted file mode 100644 index 8d1e19e897..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_asmutil.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -#ifndef _KAIF_ASMUTIL_H -#define _KAIF_ASMUTIL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include "mach_asmutil.h" - -#ifdef _ASM - -/* - * Each cpusave buffer has an area set aside for a ring buffer of breadcrumbs. - * The following macros manage the buffer. - */ - -/* Advance the ring buffer */ -#define ADVANCE_CRUMB_POINTER(cpusave, tmp1, tmp2) \ - ld [cpusave + KRS_CURCRUMBIDX], tmp1; \ - cmp tmp1, KAIF_NCRUMBS - 1; \ - bge 1f; \ - /* Advance the pointer and index */ \ - add tmp1, 1, tmp1; \ - st tmp1, [cpusave + KRS_CURCRUMBIDX]; \ - ldx [cpusave + KRS_CURCRUMB], tmp1; \ - ba 2f; \ - add tmp1, KRM_SIZE, tmp1; \ -1: /* Reset the pointer and index */ \ - st %g0, [cpusave + KRS_CURCRUMBIDX]; \ - add cpusave, KRS_CRUMBS, tmp1; \ -2: stx tmp1, [cpusave + KRS_CURCRUMB]; \ - /* Clear the new crumb */ \ - set KRM_SIZE, tmp2; \ -3: subcc tmp2, 8, tmp2; \ - bg 3b; \ - stx %g0, [tmp1 + tmp2] - -/* Set a value in the current breadcrumb buffer */ -#define ADD_CRUMB(cpusave, offset, value, tmp) \ - ldx [cpusave + KRS_CURCRUMB], tmp; \ - stx value, [tmp + offset]; - -#define ADD_CRUMB_CONST(cpusave, offset, value, tmp1, tmp2) \ - ldx [cpusave + KRS_CURCRUMB], tmp1; \ - mov value, tmp2; \ - stx tmp2, [tmp1 + offset] - -#define ADD_CRUMB_FLAG(cpusave, flag, tmp1, tmp2, tmp3) \ - ldx [cpusave + KRS_CURCRUMB], tmp1; \ - ld [tmp1 + KRM_FLAG], tmp2; \ - set flag, tmp3; \ - or tmp2, tmp3, tmp2; \ - st tmp2, [tmp1 + KRM_FLAG] - -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _KAIF_ASMUTIL_H */ diff --git a/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_handlers.s b/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_handlers.s deleted file mode 100644 index a90f7b2e4f..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_handlers.s +++ /dev/null @@ -1,328 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 <sys/asm_linkage.h> -#include <sys/machasi.h> -#include <sys/machtrap.h> -#include <sys/privregs.h> -#include <sys/mmu.h> -#include <vm/mach_sfmmu.h> - -#if defined(sun4v) && !defined(lint) -#include <sys/machparam.h> -#endif - -#if defined(sun4v) && defined(KMDB_TRAPCOUNT) -/* - * The sun4v implemenations of the fast miss handlers are larger than those - * of their sun4u kin. This is unfortunate because there is not enough space - * remaining in the respective trap table entries for this debug feature. - */ -#error "KMDB_TRAPCOUNT not supported on sun4v" -#endif - -/* - * This file contains the trap handlers that will be copied to kmdb's trap - * table. See kaif_activate.c for the code that does the actual copying. - * - * The handlers have a debugging feature, enabled when KMDB_TRAPCOUNT is - * defined, which allows them to keep a running count of the number of times - * a given trap has occurred. The counter is stored in the padding at the end - * of the handler. Write access is of course required to allow the values to - * be updated, so KMDB_TRAPCOUNT also enables the installation of DTLB entries - * for each trap table page. Finally, the code in this file is copied into - * the actual location used by the handler, so we can't perform compile-time - * counter location calculations. The calculations are instead performed at - * run-time, as A) we generally already derive the table location as part of - * the trap processing and B) simplicity is more of a concern than is speed. - */ - -#if defined(lint) -#include <kmdb/kaif.h> - -void -kaif_hdlr_dmiss(void) -{ -} - -void -kaif_itlb_handler(void) -{ -} - -#else /* lint */ - -#ifdef sun4v - -#define GET_MMU_D_ADDR_CTX(daddr, ctx) \ - MMU_FAULT_STATUS_AREA(ctx); \ - ldx [ctx + MMFSA_D_ADDR], daddr; \ - ldx [ctx + MMFSA_D_CTX], ctx - -#define GET_MMU_I_ADDR_CTX(iaddr, ctx) \ - MMU_FAULT_STATUS_AREA(ctx); \ - ldx [ctx + MMFSA_I_ADDR], iaddr; \ - ldx [ctx + MMFSA_I_CTX], ctx - -/* - * KAIF_ITLB_STUFF - * derived from ITLB_STUFF in uts/sun4v/vm/mach_sfmmu.h - * - * Load ITLB entry - * - * In: - * tte = reg containing tte - * ouch = branch target label used if hcall fails (sun4v only) - * scr1, scr2, scr3, scr4 = scratch registers (must not be %o0-%o3) - */ -#define KAIF_ITLB_STUFF(tte, ouch, scr1, scr2, scr3, scr4) \ - mov %o0, scr1; \ - mov %o1, scr2; \ - mov %o2, scr3; \ - mov %o3, scr4; \ - MMU_FAULT_STATUS_AREA(%o2); \ - ldx [%o2 + MMFSA_I_ADDR], %o0; \ - ldx [%o2 + MMFSA_I_CTX], %o1; \ - srlx %o0, PAGESHIFT, %o0; \ - sllx %o0, PAGESHIFT, %o0; \ - mov tte, %o2; \ - mov MAP_ITLB, %o3; \ - ta MMU_MAP_ADDR; \ - /* BEGIN CSTYLED */ \ - brnz,a,pn %o0, ouch; \ - nop; \ - /* END CSTYLED */ \ - mov scr1, %o0; \ - mov scr2, %o1; \ - mov scr3, %o2; \ - mov scr4, %o3 - -/* - * KAIF_DTLB_STUFF - * derived from DTLB_STUFF in uts/sun4v/vm/mach_sfmmu.h - * - * Load DTLB entry - * - * In: - * tte = reg containing tte - * ouch = branch target label used if hcall fails (sun4v only) - * scr1, scr2, scr3, scr4 = scratch registers (must not be %o0-%o3) - */ -#define KAIF_DTLB_STUFF(tte, ouch, scr1, scr2, scr3, scr4) \ - mov %o0, scr1; \ - mov %o1, scr2; \ - mov %o2, scr3; \ - mov %o3, scr4; \ - MMU_FAULT_STATUS_AREA(%o2); \ - ldx [%o2 + MMFSA_D_ADDR], %o0; \ - ldx [%o2 + MMFSA_D_CTX], %o1; \ - srlx %o0, PAGESHIFT, %o0; \ - sllx %o0, PAGESHIFT, %o0; \ - mov tte, %o2; \ - mov MAP_DTLB, %o3; \ - ta MMU_MAP_ADDR; \ - /* BEGIN CSTYLED */ \ - brnz,a,pn %o0, ouch; \ - nop; \ - /* END CSTYLED */ \ - mov scr1, %o0; \ - mov scr2, %o1; \ - mov scr3, %o2; \ - mov scr4, %o3 - -#else /* sun4v */ - -#define GET_MMU_D_ADDR_CTX(daddr, ctx) \ - mov MMU_TAG_ACCESS, ctx; \ - ldxa [ctx]ASI_DMMU, daddr; \ - sllx daddr, TAGACC_CTX_LSHIFT, ctx; \ - srlx ctx, TAGACC_CTX_LSHIFT, ctx - -#define GET_MMU_I_ADDR_CTX(iaddr, ctx) \ - rdpr %tpc, iaddr; \ - ldxa [%g0]ASI_IMMU, ctx; \ - srlx ctx, TTARGET_CTX_SHIFT, ctx - -#define KAIF_DTLB_STUFF(tte, ouch, scr1, scr2, scr3, scr4) \ - DTLB_STUFF(tte, scr1, scr2, scr3, scr4) - -#define KAIF_ITLB_STUFF(tte, ouch, scr1, scr2, scr3, scr4) \ - ITLB_STUFF(tte, scr1, scr2, scr3, scr4) - -#endif /* sun4v */ - -/* - * KAIF_CALL_KDI_VATOTTE - * - * Use kdi_vatotte to look up the tte. We don't bother stripping the - * context, as it won't change the tte we get. - * - * The two instruction at patch_lbl are modified during runtime - * by kaif to point to kdi_vatotte - * - * Clobbers all globals. - * Returns tte in %g1 if successful, otherwise 0 in %g1 - * Leaves address of next instruction following this macro in scr1 - */ -#define KAIF_CALL_KDI_VATOTTE(addr, ctx, patch_lbl, scr0, scr1) \ - .global patch_lbl; \ -patch_lbl: \ - sethi %hi(0), scr0; \ - or scr0, %lo(0), scr0; \ - jmpl scr0, scr1; \ - add scr1, 8, scr1 - - - ENTRY_NP(kaif_hdlr_dmiss) - GET_MMU_D_ADDR_CTX(%g1, %g2) - - KAIF_CALL_KDI_VATOTTE(%g1, %g2, kaif_hdlr_dmiss_patch, %g3, %g7) -0: brz %g1, 1f - nop - - /* - * kdi_vatotte gave us a TTE to use. Load it up and head back - * into the world, but first bump a counter. - */ - -#ifdef KMDB_TRAPCOUNT /* Trap counter. See top comment */ - ldx [%g7 + .count-0b], %g2 - add %g2, 1, %g2 - stx %g2, [%g7 + .count-0b] -#endif - - KAIF_DTLB_STUFF(%g1, 1f, %g2, %g3, %g4, %g5) - retry - -1: /* - * kdi_vatotte didn't give us a tte, which is unfortunate. We're - * going to need to jump into the debugger so as to allow it to - * handle the trap. The debugger itself isn't locked into the TLB, - * so we may well incur a TLB miss while trying to get into it. As - * such, we're going to switch off the MMU globals before setting foot - * into the debugger, thus allowing a TL>1 miss to be handled without - * clobbering our state. We'll also save off the tag just in case the - * world ends and someone wants to find out what happened. - * - * We will only reach this point at TL=1, as kdi_vatotte will always - * find the TTE for the debugger without missing. - */ - -#ifdef KMDB_TRAPCOUNT /* Trap address "counter". */ - GET_MMU_D_ADDR(%g2, %g3) - stx %g2, [%g7 + .daddr-0b] - stx %g1, [%g7 + .ecode-0b] -#endif - - sethi %hi(kaif_dtrap), %g1 - jmp %g1 + %lo(kaif_dtrap) - nop - /* NOTREACHED */ - -#ifdef KMDB_TRAPCOUNT - .align 8 -.count: .xword 0 /* counter goes here */ -.daddr: .xword 0 /* miss address goes here */ -.ecode: .xword 0 /* sun4v: g1 contains err code */ -#endif - - .align 32*4 /* force length to 32 instr. */ - SET_SIZE(kaif_hdlr_dmiss) - - - - ENTRY_NP(kaif_hdlr_imiss) - GET_MMU_I_ADDR_CTX(%g1, %g2) - - KAIF_CALL_KDI_VATOTTE(%g1, %g2, kaif_hdlr_imiss_patch, %g3, %g7) -0: brz %g1, 1f - nop - - /* - * kdi_vatotte gave us a TTE to use. Load it up and head back - * into the world, but first bump a counter. - */ -#ifdef KMDB_TRAPCOUNT /* Trap counter. See top comment */ - ldx [%g7 + .count-0b], %g2 - add %g2, 1, %g2 - stx %g2, [%g7 + .count-0b] -#endif - - KAIF_ITLB_STUFF(%g1, 1f, %g2, %g3, %g4, %g5) - retry - -1: /* - * kdi_vatotte didn't give us a tte, which is unfortunate. We're - * going to need to jump into the debugger so as to allow it to - * handle the trap. The debugger itself isn't locked into the TLB, - * so we may well incur a TLB miss while trying to get into it. As - * such, we're going to switch off the MMU globals before setting foot - * into the debugger, thus allowing a TL>1 miss to be handled without - * clobbering our state. - * - * We will only reach this point at TL=1, as kdi_vatotte will always - * find the TTE for the debugger without missing. - */ - - sethi %hi(kaif_dtrap), %g1 - jmp %g1 + %lo(kaif_dtrap) - nop - /* NOTREACHED */ - -#ifdef KMDB_TRAPCOUNT - .align 8 -.count: .xword 0 -#endif - - .align 32*4 /* force length to 32 instr. */ - SET_SIZE(kaif_hdlr_imiss) - - - - ENTRY_NP(kaif_hdlr_generic) -#ifdef KMDB_TRAPCOUNT /* Trap counter. See top comment */ -0: rd %pc, %g3 - ldx [%g3 + .count-0b], %g4 - add %g4, 1, %g4 - stx %g4, [%g3 + .count-0b] -#endif - - sethi %hi(kaif_dtrap), %g1 - jmp %g1 + %lo(kaif_dtrap) - nop - /* NOTREACHED */ - -#ifdef KMDB_TRAPCOUNT - .align 8 -.count: .xword 0 /* counter goes here */ -#endif - - .align 32*4 /* force length to 32 instr. */ - SET_SIZE(kaif_hdlr_generic) - -#endif /* lint */ diff --git a/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_invoke.s b/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_invoke.s deleted file mode 100644 index 15da85dcf6..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_invoke.s +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/asm_linkage.h> - -#include <mdb/mdb_kreg.h> - -/* - * Kernel function call invocation - */ - -#if !defined(__lint) - - .section RODATA - .align 8 - - /* - * A jump table containing the addresses for register argument copy - * code. - */ -copyargs: - .xword cp0arg - .xword cp1arg - .xword cp2arg - .xword cp3arg - .xword cp4arg - .xword cp5arg -copyargsend: - .xword cp6arg - -#endif /* __lint */ - -#if defined(__lint) -/*ARGSUSED*/ -uintptr_t -kaif_invoke(uintptr_t funcva, uint_t argc, const uintptr_t *argv, - kreg_t g6, kreg_t g7) -{ - return (0); -} -#else - - ENTRY_NP(kaif_invoke) - - save %sp, -SA(MINFRAME), %sp - - /* - * Will registers suffice, or do we need to put excess args (>6) on the - * stack? - */ - sub %i1, 6, %i1 ! %i1 is now num regs over 6 (if any) - brgz,pn %i1, savestackargs - sllx %i1, 3, %i1 ! (argc - 6) * 8 - - /* - * We have fewer than six arguments. Below, starting at the cp6arg - * label, we've got code that'll copy these arguments to the out - * registers in descending order (%o5 is copied, then %o4, and so on). - * We only want to move valid arguments, so we'll jump into this copy - * code just before it copies our highest arg. If we have four args, - * for example, we'll jump to cp4arg. - * - * %i6 is now a negative word-scaled offset, which we can use to - * retrieve the appropriate address from the jump table. We start at - * bottom of the table, and let the negative offset jump back to the - * correct location. If we have four arguments, %i1 will be -16. - * Starting from copyargs+48 (the address of the last slot), we get - * copyargs+32, which contains the address (cp4arg) to be used to copy - * four arguments. - */ - setx copyargsend, %l1, %l0 - ldx [%l0 + %i1], %l0 - jmp %l0 - nop - -savestackargs: - /* - * We have more than six arguments, and will thus need to allocate space - * for the seventh and beyond on the stack. %i1 is the number of bytes - * needed to hold the seventh and higher arguments. - */ - - /* Allocate swap space - %i1 rounded up to STACK_ALIGN */ - add %i1, STACK_ALIGN/2, %g1 - and %g1, -STACK_ALIGN, %g1 - sub %sp, %g1, %sp - - add %i2, 6*8, %l0 ! %l0 is &argv[6] - add %sp, STACK_BIAS+MINFRAME, %l1 ! %l1 is base of stack reg save - - /* - * Copy arguments to the stack. %i1 is the offset from the seventh arg - * in argv and the offset from the base of the stack save area. - */ - sub %i1, 8, %i1 -1: - ldx [%l0 + %i1], %l2 - stx %l2, [%l1 + %i1] - brnz,pt %i1, 1b - sub %i1, 8, %i1 - - /* - * Copy the register arguments. The argc <= 6 case will be jumping to - * one of these labels. - */ -cp6arg: ldx [%i2 + 5*8], %o5 -cp5arg: ldx [%i2 + 4*8], %o4 -cp4arg: ldx [%i2 + 3*8], %o3 -cp3arg: ldx [%i2 + 2*8], %o2 -cp2arg: ldx [%i2 + 1*8], %o1 -cp1arg: ldx [%i2 + 0*8], %o0 -cp0arg: - - mov %g6, %l0 - mov %i3, %g6 ! Restore PROC_REG for kernel call - - mov %g7, %l1 - mov %i4, %g7 ! Restore THREAD_REG for kernel call - - jmpl %i0, %o7 ! Make call - nop - - mov %l0, %g6 - mov %l1, %g7 - - ret - restore %g0, %o0, %o0 - - SET_SIZE(kaif_invoke) - -#endif diff --git a/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_regs.h b/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_regs.h deleted file mode 100644 index 1d583c58d9..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_regs.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -#ifndef _KAIF_REGS_H -#define _KAIF_REGS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _ASM -#include <sys/types.h> -#include <sys/regset.h> -#include <sys/stack.h> -#include <sys/kdi_impl.h> - -#include <mdb/mdb_kreg_impl.h> -#include <mdb/mdb_target.h> -#include <mdb/mdb.h> -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define KAIF_CPU_STKSZ ((MINFRAME64 * 20) + STACK_ALIGN64) - -#define KAIF_NCRUMBS 5 - -#define KAIF_CRUMB_SRC_OBP 1 -#define KAIF_CRUMB_SRC_IVEC 2 -#define KAIF_CRUMB_SRC_MAIN 3 - -#define KAIF_CRUMB_F_MAIN_OBPWAPT 0x01 -#define KAIF_CRUMB_F_MAIN_OBPPENT 0x02 -#define KAIF_CRUMB_F_MAIN_NORMAL 0x04 - -#define KAIF_CRUMB_F_IVEC_REENTER 0x08 -#define KAIF_CRUMB_F_IVEC_INOBP 0x10 -#define KAIF_CRUMB_F_IVEC_NORMAL 0x20 - -#define KAIF_CRUMB_F_OBP_NORMAL 0x40 -#define KAIF_CRUMB_F_OBP_REVECT 0x80 - -#ifndef _ASM - -/* - * We maintain a ring buffer of bread crumbs for debugging purposes. The - * current buffer pointer is advanced along the ring with each intercepted - * trap (debugger entry, invalid memory access, etc). The structure must have a - * size equal to a multiple of 8. - */ -typedef struct kaif_crumb { - uint64_t krm_src; - uint64_t krm_pc; - uint64_t krm_tt; - uint32_t krm_flag; - uint32_t krm_pad; -} kaif_crumb_t; - -/* Keep in sync with kaif_regs.in */ -typedef struct kaif_cpusave { - mdb_tgt_gregset_t krs_gregs; /* Saved registers */ - struct rwindow *krs_rwins; /* Saved register windows */ - kfpu_t krs_fpregs; /* Saved FP registers */ - - kreg_t krs_tstate; /* Saved %tstate */ - kreg_t krs_mmu_pcontext; /* Context # at kmdb entry */ - - uint_t krs_cpu_state; /* KAIF_CPU_STATE_* */ - uint_t krs_cpu_flushed; /* Have caches been flushed? */ - uint_t krs_cpu_id; /* this CPU's ID */ - uint_t krs_cpu_acked; /* for slave to ack master */ - - uint64_t krs_lsucr_save; /* LSUCR for wapt step */ - uint32_t krs_instr_save; /* OBP instr for wapt step */ - - /* Bread crumb ring buffer */ - uint_t krs_curcrumbidx; /* Current krs_crumbs idx */ - kaif_crumb_t *krs_curcrumb; /* Current crumb */ - kaif_crumb_t krs_crumbs[KAIF_NCRUMBS]; /* Crumbs */ - - char krs_cpustack[KAIF_CPU_STKSZ]; -} kaif_cpusave_t; -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _KAIF_REGS_H */ diff --git a/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_resume.s b/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_resume.s deleted file mode 100644 index bb00ccda54..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_resume.s +++ /dev/null @@ -1,183 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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" - -/* - * System-resumption code. kaif_resume is called whenever the world, as a whole - * or merely a single CPU, is to be resumed. - */ - -#if !defined(__lint) -#include <sys/asm_linkage.h> -#include <sys/trap.h> -#include <sys/machtrap.h> -#include <sys/mmu.h> -#include <sys/machasi.h> -#define _KERNEL -#include <sys/privregs.h> -#undef _KERNEL -#include <sys/machthread.h> -#include <sys/machparam.h> -#endif - -#if defined(__lint) -#include <sys/ddi.h> -#include <sys/sunddi.h> -#endif - -#include <mdb/mdb_kreg.h> -#include <kmdb/kaif_asmutil.h> -#include <kmdb/kaif_off.h> -#include <kmdb/kaif.h> - -#if defined(__lint) -/*ARGSUSED*/ -void -kaif_resume(int work_required) -{ -} -#else /* __lint */ - - /* - * Used to start the world back up, as a whole or in part (single-step). - * Arguments: - * %l5 - the CPU-specific gregs save area - * %l6 - the CPU-specific save area - */ - ENTRY_NP(kaif_resume) - - /* globals only from here on out */ - mov %l5, %g5 - mov %l6, %g6 - - /* - * To resume the world, we reverse what we did in startup - */ - - /* FP state */ - add %g6, KRS_FPREGS, %g4 ! %g4 = &cpusave[this_cpuid].krs_fpregs - - ldx [%g4 + FPU_FPRS], %g2 - btst FPRS_FEF, %g2 ! was fp enabled? - bz,pt %icc, 1f ! nope drive on... - wr %g2, %fprs ! restore %fprs regardless - - LOAD_FPREGS(%g4) - ldx [%g4 + FPU_FSR], %fsr - -1: - /* Register windows */ - GET_NWIN(%g1, %g4); ! %g1 is scratch, %g4 set to nwin-1 - wrpr %g4, %cleanwin - - sub %g4, 1, %g1 - wrpr %g1, %cansave - - wrpr %g0, %otherwin - wrpr %g0, %canrestore - wrpr %g0, %cwp - clr %g2 - - ldx [%g6 + KRS_RWINS], %g3 ! %g3 = &cpusave[this_cpuid].krs_wins - -1: - RESTORE_V9WINDOW(%g3) - add %g2, 1, %g2 - add %g3, RWIN_SIZE, %g3 - cmp %g2, %g4 - ble 1b - wrpr %g2, %cwp - - /* Restore various privileged registers */ - ldx [%g5 + KREG_OFF(KREG_CWP)], %g4 - wrpr %g4, %cwp - ldx [%g5 + KREG_OFF(KREG_OTHERWIN)], %g4 - wrpr %g4, %otherwin - ldx [%g5 + KREG_OFF(KREG_CLEANWIN)], %g4 - wrpr %g4, %cleanwin - ldx [%g5 + KREG_OFF(KREG_CANSAVE)], %g4 - wrpr %g4, %cansave - ldx [%g5 + KREG_OFF(KREG_CANRESTORE)], %g4 - wrpr %g4, %canrestore - ldx [%g5 + KREG_OFF(KREG_WSTATE)], %g4 - wrpr %g4, %wstate - - ldx [%g5 + KREG_OFF(KREG_Y)], %g4 - wr %g4, %y - - ldx [%g5 + KREG_OFF(KREG_PIL)], %g4 - wrpr %g4, %pil - - /* Set up the return from the trap */ - wrpr %g0, 1, %tl - - /* - * Restore the MMU primary context. - */ - mov MMU_PCONTEXT, %g3 - ldx [%g6 + KRS_MMU_PCONTEXT], %g4 - KAIF_DEMAP_TLB_ALL(%g2) - stxa %g4, [%g3]ASI_MMU_CTX - membar #Sync - - ldx [%g6 + KRS_TSTATE], %g4 - wrpr %g4, %tstate - - ldx [%g5 + KREG_OFF(KREG_PC)], %g4 - wrpr %g4, %tpc - - ldx [%g5 + KREG_OFF(KREG_NPC)], %g4 - wrpr %g4, %tnpc - - /* - * If we're here because of the debugger trap (most likely from - * kaif_entry), we don't want to jump back to %tpc, since it - * is likely to be the ta that brought us here in the first place. - * We'll test for it here, and we'll leave %xcc untouched until - * the end when we're about to return. - */ - ldx [%g5 + KREG_OFF(KREG_TT)], %g4 - wrpr %g4, %tt - cmp %g4, ST_KMDB_TRAP|T_SOFTWARE_TRAP - - /* Restore saved globals */ - ldx [%g5 + KREG_OFF(KREG_G1)], %g1 - ldx [%g5 + KREG_OFF(KREG_G2)], %g2 - ldx [%g5 + KREG_OFF(KREG_G3)], %g3 - ldx [%g5 + KREG_OFF(KREG_G4)], %g4 - ldx [%g5 + KREG_OFF(KREG_G6)], %g6 - ldx [%g5 + KREG_OFF(KREG_G7)], %g7 - be %xcc, 1f ! the trap type check, above - ldx [%g5 + KREG_OFF(KREG_G5)], %g5 - - retry -1: - done - - SET_SIZE(kaif_resume) - -#endif /* __lint */ diff --git a/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_startup.s b/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_startup.s deleted file mode 100644 index e93274e121..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/kmdb/kaif_startup.s +++ /dev/null @@ -1,952 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. - */ - -#if !defined(__lint) -#include <sys/asm_linkage.h> -#include <sys/trap.h> -#include <sys/mmu.h> -#include <sys/machasi.h> -#include <sys/intreg.h> -#define _KERNEL -#include <sys/privregs.h> -#undef _KERNEL -#include <sys/machthread.h> -#include <sys/machtrap.h> -#include <sys/machparam.h> -#endif - -#include <mdb/mdb_kreg_impl.h> -#include <kmdb/kaif_regs.h> -#include <kmdb/kaif_off.h> -#include <kmdb/kaif.h> -#include <kmdb/kaif_asmutil.h> - -#define KAIF_CPU_INDEX \ - set mdb, %g1; \ - ldx [%g1 + MDB_KDI], %g1; \ - ldx [%g1 + MKDI_CPU_INDEX], %g1; \ - set 1f, %g7; \ - jmp %g1; \ - nop; \ -1: - -#define KAIF_CPU_GETADDR_TL1 \ - set kaif_cpusave_getaddr, %g6; \ - sethi %hi(1f), %g7; \ - jmp %g6; \ - or %g7, %lo(1f), %g7; \ -1: - -#define KAIF_COPY_KREG(src, tgt, idx, tmp) \ - ldx [src + KREG_OFF(idx)], tmp; \ - stx tmp, [tgt + KREG_OFF(idx)] - -#ifndef sun4v -/* - * Creates a new primary context register value by copying the nucleus page - * size bits to the primary context page size bits and setting the primary - * context to zero. The updated value is stored in the ctx parameter. - */ -#define KAIF_MAKE_NEW_CTXREG(ctx, tmp) \ - srlx ctx, CTXREG_NEXT_SHIFT, ctx ; \ - sllx ctx, CTXREG_NEXT_SHIFT, ctx; \ - sllx ctx, 3, tmp; \ - srlx tmp, CTXREG_NEXT_SHIFT, tmp; \ - sllx tmp, CTXREG_EXT_SHIFT, tmp; \ - or ctx, tmp, ctx; \ - srlx ctx, CTXREG_NEXT_SHIFT + 3, tmp; \ - sllx tmp, CTXREG_EXT_SHIFT, tmp; \ - or ctx, tmp, ctx -#endif /* sun4v */ - -#if !defined(__lint) - - /* - * Calculate the address of the save area for the current CPU. This - * would be a macro, but for need to call platform-specific CPU ID - * routines. The kernel provides, via the KDI, a TL=1-safe "function" - * for CPU ID retrieval, which we call here. The retrieval code returns - * the ID in %g1, and is allowed to clobber %g2. It also assumes that - * the return address is in %g7. - * - * Arguments: - * %g7 - return address - * Returns: - * %g6 - address of save area - * - * %g4 will be preserved. - */ - ENTRY_NP(kaif_cpusave_getaddr) - - mov %g7, %g5 ! we'll need %g7 for the ID retriever - KAIF_CPU_INDEX ! index returned in %g1, clobbers %g2, %g7 - - set KRS_SIZE, %g2 - mulx %g1, %g2, %g2 - set kaif_cpusave, %g6 - ldx [%g6], %g6 - - jmp %g5 ! return to caller-provided address - add %g6, %g2, %g6 - - SET_SIZE(kaif_cpusave_getaddr) - - /* - * Save volatile state - state that won't be available when we switch - * back to TL=0. We're currently at TL=1, and are on either the - * alternate or interrupt globals, so we'll need to do a bit of a - * dance in order to save the normal globals. - * - * NOTE: This routine and kaif_trap_obp must be equivalent. - * - * Parameters: - * %g7 - return address - * %g6 - cpusave area - * %g4 - the %pstate value to get us back to our current globals set - * %g4 not applicable on sun4v as it uses %gl - */ - - ENTRY_NP(kaif_save_tl1_state) - - add %g6, KRS_GREGS + GREG_KREGS, %g5 - - rdpr %tstate, %g2 - stx %g2, [%g6 + KRS_TSTATE] - rdpr %tpc, %g2 - stx %g2, [%g5 + KREG_OFF(KREG_PC)] - rdpr %tnpc, %g2 - stx %g2, [%g5 + KREG_OFF(KREG_NPC)] - rdpr %tt, %g2 - stx %g2, [%g5 + KREG_OFF(KREG_TT)] - - /* - * Switch over to the normal globals, so we can save them. We'll need - * our gregs pointer and the return %pstate value, so stash them in - * registers that will be available to us on both sides. - * - * NOTE: Global register sets is selected by %gl register in sun4v. - * There is no PSTATE.AG bit in sun4v to select global set. - * - Normal globals is the set when %gl = 0. - * - TL1 globals is the set when %gl = 1. - */ - SWITCH_TO_NORMAL_GLOBALS(); /* saves %o5 and %o4 */ - stx %g1, [%o5 + KREG_OFF(KREG_G1)] - stx %g2, [%o5 + KREG_OFF(KREG_G2)] - stx %g3, [%o5 + KREG_OFF(KREG_G3)] - stx %g4, [%o5 + KREG_OFF(KREG_G4)] - stx %g5, [%o5 + KREG_OFF(KREG_G5)] - stx %g6, [%o5 + KREG_OFF(KREG_G6)] - stx %g7, [%o5 + KREG_OFF(KREG_G7)] - - /* - * Restore saved %o registers and return. - */ - SWITCH_TO_TL1_GLOBALS_AND_RET(); /* restores %o5 and %o4 */ - SET_SIZE(kaif_save_tl1_state) - - /* - * Save the remaining state, and prepare to enter the debugger. - */ - - ENTRY_NP(kaif_trap_common) - - /* Make sure the world is as it should be */ - wrpr %g0, PTSTATE_KERN_COMMON, %pstate - wrpr %g0, %tl - - SET_GL(0); - set 1f, %g7 - set kaif_cpusave_getaddr, %g6 - jmp %g6 - nop -1: /* CPU save area address is now in %g6 */ - add %g6, KRS_GREGS + GREG_KREGS, %g5 - - ldx [%g5 + KREG_OFF(KREG_PC)], %g4 - ADD_CRUMB(%g6, KRM_PC, %g4, %g1) - ldx [%g5 + KREG_OFF(KREG_TT)], %g4 - ADD_CRUMB(%g6, KRM_TT, %g4, %g1) - - /* - * The %tba is special. With normal entry, we're on the same trap table - * the kernel is using (this could be OBP's table if we're early enough - * in the boot process). We want to save it, but we don't want to - * switch to OBP's table just yet, as we need to ensure that only one - * CPU uses OBP's table at a time. We do this by waiting until we've - * selected the master before switching. - * - * Single-step is a bit different. Everything about the CPU's state is - * as it should be, with the exception of %tba. We need to step on - * OBP's trap table, so we didn't restore %tba during resume. The save - * state area still contains the real %tba value - the one we had when - * we first entered the debugger. We don't want to clobber that, so - * we'll only save %tba if we're not stepping. - */ - - set kaif_master_cpuid, %g1 - ld [%g1], %g1 - ld [%g6 + KRS_CPU_ID], %g2 - cmp %g1, %g2 - be 1f - nop - - rdpr %tba, %g2 - stx %g2, [%g5 + KREG_OFF(KREG_TBA)] - -1: - /* Update the PIL to 15 to block out most interrupts */ - rdpr %pil, %g4 - stx %g4, [%g5 + KREG_OFF(KREG_PIL)] - wrpr %g0, 15, %pil - - rd %y, %g4 - stx %g4, [%g5 + KREG_OFF(KREG_Y)] - - /* - * Save window state and windows - */ - rdpr %cwp, %g4 - stx %g4, [%g5 + KREG_OFF(KREG_CWP)] - rdpr %otherwin, %g4 - stx %g4, [%g5 + KREG_OFF(KREG_OTHERWIN)] - rdpr %cleanwin, %g4 - stx %g4, [%g5 + KREG_OFF(KREG_CLEANWIN)] - rdpr %cansave, %g4 - stx %g4, [%g5 + KREG_OFF(KREG_CANSAVE)] - rdpr %canrestore, %g4 - stx %g4, [%g5 + KREG_OFF(KREG_CANRESTORE)] - rdpr %wstate, %g4 - stx %g4, [%g5 + KREG_OFF(KREG_WSTATE)] - - GET_NWIN(%g1, %g4); ! %g1 is scratch, %g4 set to nwin-1 - - wrpr %g4, %cleanwin - - sub %g4, 1, %g1 - wrpr %g1, %cansave - wrpr %g0, %otherwin - wrpr %g0, %canrestore - wrpr %g0, %cwp - - clr %g2 - ldx [%g6 + KRS_RWINS], %g3 -1: SAVE_V9WINDOW(%g3) - inc %g2 - add %g3, RWIN_SIZE, %g3 - cmp %g2, %g4 - ble 1b - wrpr %g2, %cwp - - /* - * Save FP state - */ - add %g6, KRS_FPREGS, %g4 - rd %fprs, %g1 - stx %g1, [%g4 + FPU_FPRS] - btst FPRS_FEF, %g1 ! is FP enabled? - bz %icc, 1f ! if not, don't save FP regs - wr %g0, FPRS_FEF, %fprs ! enable FP - - STORE_FPREGS(%g4) - stx %fsr, [%g4 + FPU_FSR] - -1: /* - * We're almost done saving state. Go back to the starting window, and - * switch to the CPU-specific stack. We'll use this stack to finish - * saving state, and for the next stage of debugger startup/resumption, - * when we designate the master. The slaves will continue to run on - * this stack until released or turned into masters. - */ - ldx [%g5 + KREG_OFF(KREG_CWP)], %g4 - wrpr %g4, %cwp - - set KRS_CPUSTACK + KAIF_CPU_STKSZ - 1, %g1 - add %g1, %g6, %g1 - and %g1, -STACK_ALIGN64, %g1 - sub %g1, SA64(MINFRAME) + V9BIAS64, %sp - clr %fp - save %sp, -SA64(MINFRAME64), %sp - - /* - * We'll need to access cpusave and gregs for our final state-saving, - * so stash them where they won't be clobbered by function calls. - */ - mov %g6, %l6 - mov %g5, %l5 - - /* - * Now that we have a stack, we can save %stick. %stick isn't present - * on all of our target machines, so we have to use the KDI to fetch the - * current value (if any). We save %tick here too, because they get - * lonely if separated. - */ - rd %tick, %g4 - stx %g4, [%l5 + KREG_OFF(KREG_TICK)] - - call kmdb_kdi_get_stick - add %l5, KREG_OFF(KREG_STICK), %o0 - brnz %o0, 1f - nop - - /* - * We found %stick. Set the %stick-found flag. - */ - ld [%l5 + GREG_FLAGS], %g1 - or %g1, MDB_V9GREG_F_STICK_VALID, %g1 - st %g1, [%l5 + GREG_FLAGS] - -1: /* - * Enter the next phase of debugger startup - */ - call kaif_debugger_entry - mov %l6, %o0 - - ba,a kaif_resume ! expects valid %l5, %l6 - - /*NOTREACHED*/ - - SET_SIZE(kaif_trap_common) - -#endif /* !__lint */ - - /* - * The primary debugger-entry routine. This routine is the trap handler - * for programmed entry, watchpoints, and breakpoints, and is entered at - * TL=1, on the kernel's trap table, with PSTATE.AG set. It is used in - * the following cases: - * - * 1. (common case) - intentional entry by a CPU intending to be the - * master. The CPU may have encountered a watchpoint, a breakpoint, - * or a programmed entry trap, and is *NOT* coming from OBP. The CPU - * is allowed direct entry into the debugger. - * - * 2. A CPU was cross-called into kaif_slave_entry while executing in - * OBP. The CPU was released, but a programmed entry trap was - * activated, designed to be encountered when the cross-called CPU - * returned from OBP. The CPU is allowed to enter the debugger. We - * don't know how many other CPUs need the PROM-return trap, so we'll - * leave it active until everyone arrives. - * - * The remaining cases deal with instances where OBP got in the way. - * We can't allow a CPU into the debugger if it is currently executing - * in OBP, as chaos would ensue (OBP isn't re-entrant). As such, we - * have to ask the CPU to come back when it has finished with OBP (or - * vice versa). Depending on the circumstances, we'll need to dance - * around it. - * - * 3. A bystander CPU runs into the PROM-return trap described above - * before being cross-called. We'll let it into the debugger now, as - * it would have ended up here anyway. - * - * 4. An innocent CPU encounters a watchpoint while executing in OBP. - * We can't let the CPU into the debugger for the reasons given - * above, so we'll need to ignore the watchpoint. We disable - * watchpoints, place a programmed-entry trap at %npc, and release - * the CPU. - * - * 5. The stepping CPU described in case 4 encounters the programmed- - * entry trap. We'll remove the trap, re-enable watchpoints, and - * send the CPU on its way. - * - * 6. Someone encounters a breakpoint or a programmed-entry trap in OBP. - * We can step through watchpoints, as the text hasn't been touched. - * With breakpoints and programmed-entry traps, however, chances are - * high that someone replaced an instruction in the text with the - * trap instruction. We don't know where they stashed the - * (presumably) saved instruction, so we can't step through it. This - * is a very unlikely scenario, so we're going to throw up our hands, - * and will attempt to trigger a panic. - */ - -#if defined(__lint) -void -kaif_ktrap(void) -{ -} -#else /* __lint */ - - ENTRY_NP(kaif_ktrap) - - set 1f, %g7 - set kaif_cpusave_getaddr, %g6 - jmp %g6 - nop -1: /* CPU save area address is now in %g6 */ - - ADVANCE_CRUMB_POINTER(%g6, %g1, %g2) - ADD_CRUMB_CONST(%g6, KRM_SRC, KAIF_CRUMB_SRC_MAIN, %g1, %g2) - - rdpr %tpc, %g2 - set OFW_START_ADDR, %g1 - cmp %g2, %g1 - bl main_not_in_obp - nop - - set OFW_END_ADDR, %g1 - cmp %g2, %g1 - bg main_not_in_obp - nop - - /* - * The CPU was in OBP when it encountered the trap that sent it here. - * See cases 3-6 above. - */ - rdpr %tt, %g4 - cmp %g4, T_PA_WATCHPOINT - be main_obp_wapt - - cmp %g4, T_VA_WATCHPOINT - be main_obp_wapt - - cmp %g4, T_SOFTWARE_TRAP|ST_KMDB_TRAP - be main_obp_progent - - cmp %g4, T_SOFTWARE_TRAP|ST_BREAKPOINT - be main_obp_breakpoint - nop - - /* This shouldn't happen - all valid traps should be checked above */ -1: ldx [%g0], %g0 - ba,a 1b - - /* Cases 1 and 2 - head into the debugger, via the state-saver */ -main_not_in_obp: - ADD_CRUMB_FLAG(%g6, KAIF_CRUMB_F_MAIN_NORMAL, %g1, %g2, %g3) - - /* A formality - we know we came from kernel context */ - mov MMU_PCONTEXT, %g3 - ldxa [%g3]ASI_MMU_CTX, %g2 ! ASI_MMU_CTX == ASI_DMMU for sun4u - stx %g2, [%g6 + KRS_MMU_PCONTEXT] - -#ifndef sun4v - /* - * If OBP supports preserving the Solaris kernel context register, - * then shift the nucleus bits into the primary and set context to 0, - * Otherwise, flush TLBs and clear the entire context register since - * OBP will clear it without flushing on entry to OBP. - */ - sethi %hi(kmdb_prom_preserve_kctx), %g4 - ld [%g4 + %lo(kmdb_prom_preserve_kctx)], %g4 - brz %g4, 1f - nop - /* - * Move nucleus context page size bits into primary context page size - * and set context to 0. Use %g4 as a temporary. - */ - KAIF_MAKE_NEW_CTXREG(%g2, %g4) ! new context reg in %g2 - - stxa %g2, [%g3]ASI_MMU_CTX - membar #Sync - ba 2f - nop -1: -#endif /* sun4v */ - /* - * Flush TLBs and clear primary context register. - */ - KAIF_DEMAP_TLB_ALL(%g4) - stxa %g0, [%g3]ASI_MMU_CTX ! ASI_MMU_CTX == ASI_DMMU for sun4u - membar #Sync -2: - - set kaif_trap_common, %g7 - - KAIF_SAVE_TL1_STATE(); - /*NOTREACHED*/ - - /* Case 4 - watchpoint in OBP - step over it */ -main_obp_wapt: - ADD_CRUMB_FLAG(%g6, KAIF_CRUMB_F_MAIN_OBPWAPT, %g1, %g2, %g3) - -#ifndef sun4v - /* Turn off watchpoints */ - ldxa [%g0]ASI_LSU, %g4 - stx %g4, [%g6 + KRS_LSUCR_SAVE] - setx KAIF_LSUCTL_WAPT_MASK, %g1, %g3 - andn %g4, %g3, %g4 - stxa %g4, [%g0]ASI_LSU -#endif /* sun4v */ - - /* - * SPARC only supports data watchpoints, and we know that only certain - * types of instructions, none of which include branches, can trigger - * memory reads. As such, we can simply place a breakpoint at %npc. - */ - rdpr %tnpc, %g4 - ld [%g4], %g3 - st %g3, [%g6 + KRS_INSTR_SAVE] - set 0x91d0207d, %g3 ! ta ST_KMDB_TRAP - st %g3, [%g4] - flush %g4 - membar #Sync - - /* Back into the pool */ - retry - - /* Case 5 - programmed entry from wapt step - restore and resume */ -main_obp_progent: - ADD_CRUMB_FLAG(%g6, KAIF_CRUMB_F_MAIN_OBPPENT, %g1, %g2, %g3) - - rdpr %tpc, %g4 - ld [%g6 + KRS_INSTR_SAVE], %g3 - brz %g3, main_obp_fail ! we don't have any open wapt steps - nop - - st %g3, [%g4] - membar #Sync - st %g0, [%g6 + KRS_INSTR_SAVE] - - /* XXX I$ invalidate? */ - -#ifndef sun4v - ldx [%g6 + KRS_LSUCR_SAVE], %g4 - stxa %g4, [%g0]ASI_LSU -#endif /* sun4v */ - - /* Restored - throw it back */ - retry - - /* Case 6 - breakpoint or unclaimed programmed entry */ -main_obp_breakpoint: -main_obp_fail: - ldx [%g0], %g0 - ba,a main_obp_fail - - SET_SIZE(kaif_ktrap) - -#endif /* __lint */ - - /* - * The target for slave-stopping cross calls. This routine is entered at - * TL=1, on the kernel's trap table, with PSTATE.IG set. CPUs entering - * this handler will fall into one of the following categories: - * - * 1. (common case) - the CPU was not executing in OBP when it entered - * this routine. It will be allowed direct entry into the debugger. - * - * 2. The CPU had already entered the debugger, and was spinning in the - * slave loop (at TL=0) when it was cross-called by the debugger's - * world-stopper. This could happen if two CPUs encountered - * breakpoints simultaneously, triggering a race to become master. - * One would lose, and would already be in the slave loop when the - * master started trying to stop the world. The CPU is already where - * it is supposed to be, so we ignore the trap. - * - * 3. The CPU was executing in OBP. We can't allow it to go directly - * into OBP (see the kaif_ktrap comment), but we want to grab it when - * it leaves OBP. Arm the PROM-return programmed entry trap and - * release the CPU. - */ - -#if defined(__lint) -void -kaif_slave_entry(void) -{ -} -#else /* __lint */ - - ENTRY_NP(kaif_slave_entry) - - /* - * We may have arrived from userland. We need to be in kernel context - * before we can save state, so we'll stash the current value in %g4 - * until we've calculated the save address and have decided that we're - * heading into the debugger. - * - * %g4 is used to hold the entry MMU context until we decide whether to - * return or re-enter the debugger. - */ - mov MMU_PCONTEXT, %g3 - ldxa [%g3]ASI_MMU_CTX, %g4 - -#ifndef sun4v - /* - * If OBP supports preserving the Solaris kernel context register, - * then shift the nucleus bits into the primary and set context to 0, - * Otherwise, flush TLBs and clear the entire context register since - * OBP will clear it without flushing on entry to OBP. - */ - sethi %hi(kmdb_prom_preserve_kctx), %g1 - ld [%g1 + %lo(kmdb_prom_preserve_kctx)], %g1 - brz %g1, 1f - nop - /* - * Move nucleus context page size bits into primary context page size - * and set context to 0. Use %g2 as a temporary. - */ - mov %g4, %g2 - KAIF_MAKE_NEW_CTXREG(%g2, %g1) ! new context reg in %g2 - - stxa %g2, [%g3]ASI_MMU_CTX - membar #Sync - ba 2f - nop -1: -#endif /* sun4v */ - /* - * Flush TLBs and clear primary context register. - */ - KAIF_DEMAP_TLB_ALL(%g1) - stxa %g0, [%g3]ASI_MMU_CTX - membar #Sync -2: - - set 1f, %g7 - set kaif_cpusave_getaddr, %g6 - jmp %g6 ! is not to alter %g4 - nop -1: /* CPU save area address is now in %g6 */ - - ADVANCE_CRUMB_POINTER(%g6, %g1, %g2) - ADD_CRUMB_CONST(%g6, KRM_SRC, KAIF_CRUMB_SRC_IVEC, %g1, %g2) - - ld [%g6 + KRS_CPU_STATE], %g5 - cmp %g5, KAIF_CPU_STATE_NONE - be,a ivec_not_already_in_debugger - - /* Case 2 - CPU was already stopped, so ignore this cross call */ - ADD_CRUMB_FLAG(%g6, KAIF_CRUMB_F_IVEC_REENTER, %g1, %g2, %g3) - - /* Restore MMU_PCONTEXT, which we set on the way in */ - mov MMU_PCONTEXT, %g3 - KAIF_DEMAP_TLB_ALL(%g2) - stxa %g4, [%g3]ASI_MMU_CTX - membar #Sync - - retry - -ivec_not_already_in_debugger: - brnz %g4, ivec_not_in_obp /* OBP runs in kernel context */ - nop - - /* Were we in OBP's memory range? */ - rdpr %tpc, %g2 - set OFW_START_ADDR, %g1 - cmp %g2, %g1 - bl ivec_not_in_obp - nop - - set OFW_END_ADDR, %g1 - cmp %g2, %g1 - bg ivec_not_in_obp - nop - - /* Case 3 - CPU in OBP - arm return trap, release the CPU */ - ADD_CRUMB_FLAG(%g6, KAIF_CRUMB_F_IVEC_INOBP, %g1, %g2, %g3) - - set kaif_promexitarmp, %g1 - ldx [%g1], %g1 - mov 1, %g2 - st %g2, [%g1] - - /* We were already in kernel context, so no need to restore it */ - - retry - - /* Case 1 - head into debugger, via the state-saver */ -ivec_not_in_obp: - ADD_CRUMB_FLAG(%g6, KAIF_CRUMB_F_IVEC_NORMAL, %g1, %g2, %g3) - - stx %g4, [%g6 + KRS_MMU_PCONTEXT] - - set kaif_trap_common, %g7 - - KAIF_SAVE_TL1_STATE_SLAVE(); - - /*NOTREACHED*/ - - SET_SIZE(kaif_slave_entry) - -#endif - - /* - * The trap handler used when we're on OBP's trap table, which is used - * during initial system startup, while the debugger itself is - * executing, and when we're single-stepping. When a trap occurs that - * it can't handle, OBP will execute our Forth word (kmdb_callback). - * Our word saves TL1 state, much as kaif_save_tl1_state does for the - * other handlers. kmdb_callback will then cause control to be - * transferred to this routine. - * - * CPUs entering this routine will fall into the following categories: - * - * 1. The system is booting, and we encountered a trap that OBP couldn't - * handle. We save the CPU's state, and let it into the debugger. - * - * 2. We were single-stepping this CPU, causing it to encounter one of - * the breakpoint traps we installed for stepping. We save the CPU's - * state, and let it back into the debugger. - * - * 3. We took a trap while executing in the debugger. Before saving - * this CPU's state in the CPU-specific save area, we will let the - * debugger handle the trap. If the trap resulted from a debugger - * problem, and if the user decides to use the debugger to debug - * itself, we'll overwrite the existing state with the state saved - * by the Forth word, after which we'll let the CPU enter the - * debugger. - * - * NOTE: The Forth word and the copying code here *must* be kept - * in sync with kaif_save_tl1_state. - */ - -#if defined(__lint) -void -kaif_trap_obp(void) -{ -} -#else /* __lint */ - - ENTRY_NP(kaif_trap_obp) - - set 1f, %g7 - set kaif_cpusave_getaddr, %g6 - jmp %g6 - nop -1: /* CPU save area address is now in %g6 */ - add %g6, KRS_GREGS + GREG_KREGS, %g5 - - ADVANCE_CRUMB_POINTER(%g6, %g1, %g2) - ADD_CRUMB_CONST(%g6, KRM_SRC, KAIF_CRUMB_SRC_OBP, %g1, %g2) - ADD_CRUMB_FLAG(%g6, KAIF_CRUMB_F_OBP_NORMAL, %g1, %g2, %g3) - - set kaif_cb_save, %g4 - add %g4, KRS_GREGS + GREG_KREGS, %g4 - ldx [%g4 + KREG_OFF(KREG_PC)], %g1 - ADD_CRUMB(%g6, KRM_PC, %g1, %g2) - ldx [%g4 + KREG_OFF(KREG_TT)], %g1 - ADD_CRUMB(%g6, KRM_TT, %g1, %g2) - - ALTENTRY(kaif_trap_obp_saved) - - /* - * Are we here because of a trap we took while running the debugger, or - * because of one we took while executing kernel code? - */ - set kaif_dseg, %g1 - ldx [%g1], %g1 - cmp %sp, %g1 - bl obp_normal_entry - nop - - set kaif_dseg_lim, %g1 - ldx [%g1], %g1 - cmp %sp, %g1 - bg obp_normal_entry - nop - - /* - * The debugger fault code will need access to saved copies of the outs - * and %y if the user elects to panic. We'll also need the saved outs if - * they decide to debug the fault with the debugger, as we'll have - * trashed the outs while asking the user how to handle the fault. - */ - set kaif_cb_save, %g4 - add %g4, KRS_GREGS + GREG_KREGS, %g4 - rd %y, %g2 - stx %g2, [%g4 + KREG_OFF(KREG_Y)] - stx %o0, [%g4 + KREG_OFF(KREG_O0)] - stx %o1, [%g4 + KREG_OFF(KREG_O1)] - stx %o2, [%g4 + KREG_OFF(KREG_O2)] - stx %o3, [%g4 + KREG_OFF(KREG_O3)] - stx %o4, [%g4 + KREG_OFF(KREG_O4)] - stx %o5, [%g4 + KREG_OFF(KREG_O5)] - stx %o6, [%g4 + KREG_OFF(KREG_O6)] - stx %o7, [%g4 + KREG_OFF(KREG_O7)] - - /* - * Receipt of an XIR while on the debugger's stack is likely to mean - * that something has gone very wrong in the debugger. Our safest - * course of action is to bail out to OBP, thus preserving as much state - * as we can. - */ - ldx [%g4 + KREG_OFF(KREG_TT)], %g1 - cmp %g1, T_XIR - bne 1f - nop - - call prom_enter_mon - nop - -1: - /* - * We're still on the debugger's stack, as we were when we took the - * fault. Re-arm the Forth word and transfer control to the debugger. - */ - call kaif_prom_rearm - nop - - KAIF_CPU_INDEX ! index returned in %g1, clobbers %g2, %g7 - mov %g1, %o4 - - set kaif_cb_save, %g5 - ldx [%g5 + KREG_OFF(KREG_TT)], %o0 - ldx [%g5 + KREG_OFF(KREG_PC)], %o1 - ldx [%g5 + KREG_OFF(KREG_NPC)], %o2 - call kmdb_dpi_handle_fault - mov %sp, %o3 - - /* - * If we return from kmdb_dpi_handle_fault, the trap was due to a - * problem in the debugger, and the user has elected to diagnose it - * using the debugger. When we pass back into the normal kaif_trap_obp - * flow, we'll save the debugger fault state over the state saved when - * we initially entered the debugger. Debugger fault handling trashed - * the out registers, so we'll need to restore them before returning - * to the normal flow. - */ - - set kaif_cb_save, %g4 - ldx [%g4 + KREG_OFF(KREG_O0)], %o0 - ldx [%g4 + KREG_OFF(KREG_O1)], %o1 - ldx [%g4 + KREG_OFF(KREG_O2)], %o2 - ldx [%g4 + KREG_OFF(KREG_O3)], %o3 - ldx [%g4 + KREG_OFF(KREG_O4)], %o4 - ldx [%g4 + KREG_OFF(KREG_O5)], %o5 - ldx [%g4 + KREG_OFF(KREG_O6)], %o6 - ldx [%g4 + KREG_OFF(KREG_O7)], %o7 - -obp_normal_entry: - - set 1f, %g7 - set kaif_cpusave_getaddr, %g6 - jmp %g6 - nop -1: /* CPU save area address is now in %g6 */ - add %g6, KRS_GREGS + GREG_KREGS, %g5 - - /* - * Register state has been saved in kaif_cb_save. Now that we're sure - * we're going into the debugger using this state, copy it to the CPU- - * specific save area. - */ - - set kaif_cb_save, %g4 - add %g4, KRS_GREGS + GREG_KREGS, %g3 - - KAIF_COPY_KREG(%g3, %g5, KREG_PC, %g1) - KAIF_COPY_KREG(%g3, %g5, KREG_NPC, %g1) - KAIF_COPY_KREG(%g3, %g5, KREG_G1, %g1) - KAIF_COPY_KREG(%g3, %g5, KREG_G2, %g1) - KAIF_COPY_KREG(%g3, %g5, KREG_G3, %g1) - KAIF_COPY_KREG(%g3, %g5, KREG_G4, %g1) - KAIF_COPY_KREG(%g3, %g5, KREG_G5, %g1) - KAIF_COPY_KREG(%g3, %g5, KREG_G6, %g1) - KAIF_COPY_KREG(%g3, %g5, KREG_G7, %g1) - KAIF_COPY_KREG(%g3, %g5, KREG_TT, %g1) - - ldx [%g4 + KRS_TSTATE], %g1 - stx %g1, [%g6 + KRS_TSTATE] - - /* A formality */ - mov MMU_PCONTEXT, %g3 - ldxa [%g3]ASI_MMU_CTX, %g2 - stx %g2, [%g6 + KRS_MMU_PCONTEXT] - -#ifndef sun4v - /* - * If OBP supports preserving the Solaris kernel context register, - * then shift the nucleus bits into the primary and set context to 0, - * Otherwise, flush TLBs and clear the entire context register since - * OBP will clear it without flushing on entry to OBP. - */ - sethi %hi(kmdb_prom_preserve_kctx), %g4 - ld [%g4 + %lo(kmdb_prom_preserve_kctx)], %g4 - brz %g4, 1f - nop - /* - * Move nucleus context page size bits into primary context page size - * and set context to 0. Use %g4 as a temporary. - */ - KAIF_MAKE_NEW_CTXREG(%g2, %g4) ! new context reg in %g2 - - stxa %g2, [%g3]ASI_MMU_CTX - membar #Sync - ba 2f - nop -1: -#endif /* sun4v */ - /* - * Flush TLBs and clear primary context register. - */ - KAIF_DEMAP_TLB_ALL(%g4) - stxa %g0, [%g3]ASI_MMU_CTX ! ASI_MMU_CTX == ASI_DMMU for sun4u - membar #Sync -2: - - ba,a kaif_trap_common - - SET_SIZE(kaif_trap_obp_saved) - SET_SIZE(kaif_trap_obp) - -#endif /* __lint */ - -#if defined(lint) -void -kaif_dtrap_dprot(void) -{ -} -#else /* lint */ - - /* - * This routine is used to handle all "failed" traps. A trap is - * considered to have failed if it was not able to return to the code - * that caused the trap. A DTLB miss handler, for example, fails if - * it can't find a translation for a given address. Some traps always - * fail, because the thing that caused the trap is an actual problem - * that can't be resolved by the handler. Examples of these include - * alignment and DTLB protection faults. - */ - - ENTRY_NP(kaif_dtrap) - - SET_PSTATE_COMMON_AG(%g1); - SET_GL(1); /* set %gl = 1 */ - - KAIF_CPU_GETADDR_TL1 /* uses label 1, %g1, %g2, %g7, ret in %g6 */ - - ADVANCE_CRUMB_POINTER(%g6, %g1, %g2) - ADD_CRUMB_CONST(%g6, KRM_SRC, KAIF_CRUMB_SRC_OBP, %g1, %g2) - ADD_CRUMB_FLAG(%g6, KAIF_CRUMB_F_OBP_REVECT, %g1, %g2, %g3) - - rdpr %tt, %g1 - ADD_CRUMB(%g6, KRM_TT, %g1, %g2) - rdpr %tpc, %g1 - ADD_CRUMB(%g6, KRM_PC, %g1, %g2) - - set kaif_cb_save, %g6 - - set 1f, %g7 - ba kaif_save_tl1_state - rdpr %pstate, %g4 - -1: wrpr %g0, PTSTATE_KERN_COMMON, %pstate - wrpr %g0, %tl - SET_GL(0); - - ba kaif_trap_obp_saved - nop - - SET_SIZE(kaif_dtrap) - -#endif /* lint */ diff --git a/usr/src/cmd/mdb/sparc/v9/kmdb/kmdb_setcontext.s b/usr/src/cmd/mdb/sparc/v9/kmdb/kmdb_setcontext.s deleted file mode 100644 index 50063af935..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/kmdb/kmdb_setcontext.s +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/asm_linkage.h> -#include <sys/regset.h> - -#if defined(__lint) -#include <ucontext.h> -#endif - -#include "kmdb_context_off.h" - -#define UC_GREG(name) (UC_MCTX + MCTX_GREGS + (name * MCTX_GREGS_INCR)) - -#if defined(__lint) -/*ARGSUSED*/ -int -kmdb_setcontext(ucontext_t *ucp) -{ - return (0); -} -#else - - ENTRY(kmdb_setcontext) - flushw - - mov %o0, %g7 - - ldx [%g7 + UC_GREG(REG_O0)], %o0 - ldx [%g7 + UC_GREG(REG_O1)], %o1 - ldx [%g7 + UC_GREG(REG_O2)], %o2 - ldx [%g7 + UC_GREG(REG_O3)], %o3 - ldx [%g7 + UC_GREG(REG_O4)], %o4 - ldx [%g7 + UC_GREG(REG_O5)], %o5 - ldx [%g7 + UC_GREG(REG_O6)], %o6 - ldx [%g7 + UC_GREG(REG_O7)], %o7 - - ldx [%g7 + UC_GREG(REG_G1)], %g1 - ldx [%g7 + UC_GREG(REG_G2)], %g2 - ldx [%g7 + UC_GREG(REG_G3)], %g3 - ldx [%g7 + UC_GREG(REG_G4)], %g4 - ldx [%g7 + UC_GREG(REG_G5)], %g5 - ldx [%g7 + UC_GREG(REG_G6)], %g6 - - /* ick */ - ldx [%g7 + UC_GREG(REG_PC)], %l0 - jmp %l0 - ldx [%g7 + UC_GREG(REG_G7)], %g7 - - SET_SIZE(kmdb_setcontext) - -#endif diff --git a/usr/src/cmd/mdb/sparc/v9/kmdb/kmdb_start.s b/usr/src/cmd/mdb/sparc/v9/kmdb/kmdb_start.s deleted file mode 100644 index 92b50f7406..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/kmdb/kmdb_start.s +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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" - -#include <sys/asm_linkage.h> -#include <sys/privregs.h> - -#if defined(__lint) -#include <kmdb/kmdb_start.h> -#endif - -#include <kmdb/kaif_asmutil.h> - -/* - * This routine is called for the initial trip into the debugger. We need - * to switch over to the debugger stack (which we also need to initialize) - * before entering the debugger. Subsequent re-entries will longjmp their - * way in. - */ -#if defined(__lint) -void -kmdb_first_start(void) -{ -} -#else /* __lint */ - - ENTRY(kmdb_first_start) - - GET_NWIN(%g1, %g2); /* %g1 is scratch, %g2 set to nwin-1 */ - sub %g2, 1, %g2 - - wrpr %g2, %cansave - wrpr %g0, %canrestore - - set kmdb_main_stack, %g1 - ldx [%g1], %g1 - - set kmdb_main_stack_size, %g2 - ldx [%g2], %g2 - - add %g1, %g2, %g1 - sub %g1, 1, %g1 - and %g1, -STACK_ALIGN64, %g1 - sub %g1, SA64(MINFRAME) + V9BIAS64, %sp - - mov 0, %fp - save %sp, -SA64(MINFRAME64), %sp - - /* start the debugger */ - call kmdb_main - nop - - SET_SIZE(kmdb_first_start) -#endif - diff --git a/usr/src/cmd/mdb/sparc/v9/kmdb/kmdb_v9asmutil.s b/usr/src/cmd/mdb/sparc/v9/kmdb/kmdb_v9asmutil.s deleted file mode 100644 index 11b6c0abbb..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/kmdb/kmdb_v9asmutil.s +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#if defined(__lint) -#include <sys/types.h> -#include <kmdb/kmdb_asmutil.h> -#endif - -#include <sys/asm_linkage.h> - -#if defined(__lint) -/*ARGSUSED*/ -uintptr_t -cas(uintptr_t *rs1, uintptr_t rs2, uintptr_t rd) -{ - return (0); -} -#else - - ENTRY(cas) - casx [%o0], %o1, %o2 - retl - mov %o2, %o0 - SET_SIZE(cas) - -#endif - -#if defined(__lint) -/*ARGSUSED*/ -void -flush_windows(void) -{ -} -#else - - ENTRY(flush_windows) - save - flushw - restore - retl - nop - SET_SIZE(flush_windows) - -#endif - -#if defined(__lint) -/*ARGSUSED*/ -void -membar_producer(void) -{ -} -#else - - /* - * US I has a problem with membars in the delay slot. We don't care - * about performance here, so for safety's sake, we'll assume that all - * the world's an US I. - */ - ENTRY(membar_producer) - membar #StoreStore - retl - nop - SET_SIZE(membar_producer) - -#endif - -#if defined(__lint) -/*ARGSUSED*/ -uint64_t -rdasi(uint32_t asi, uintptr_t va) -{ - return (0); -} -#else - - ENTRY_NP(rdasi) - rd %asi, %o3 - wr %o0, %asi - ldxa [%o1]%asi, %o0 - retl - wr %o3, %asi - SET_SIZE(rdasi) - -#endif - -#if defined(__lint) -/*ARGSUSED*/ -void -wrasi(uint32_t asi, uintptr_t va, uint64_t val) -{ -} -#else - - ENTRY_NP(wrasi) - rd %asi, %o3 - wr %o0, %asi - stxa %o2, [%o1]%asi - retl - wr %o3, %asi - SET_SIZE(wrasi) - -#endif diff --git a/usr/src/cmd/mdb/sparc/v9/krtld/Makefile b/usr/src/cmd/mdb/sparc/v9/krtld/Makefile deleted file mode 100644 index 41f26285c6..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/krtld/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 1998-2000 by Sun Microsystems, Inc. -# All rights reserved. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = krtld.so -MDBTGT = kvm - -MODSRCS = krtld.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/libavl/Makefile b/usr/src/cmd/mdb/sparc/v9/libavl/Makefile deleted file mode 100644 index 7785db8110..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libavl/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = libavl.so -MDBTGT = proc - -MODSRCS = libavl.c \ - avl.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/libc/Makefile b/usr/src/cmd/mdb/sparc/v9/libc/Makefile deleted file mode 100644 index 76ae7461f7..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libc/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. -# - -MODULE = libc.so -MDBTGT = proc - -MODSRCS_DIR = ../../../common/modules/genunix - -MODSRCS = \ - libc.c \ - findstack.c \ - findstack_subr.c - -include ../../../../Makefile.cmd - -CPPFLAGS += -I$(SRC)/lib/libc/inc -CPPFLAGS += -I$(MODSRCS_DIR) - -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -dmod/$(MODULE) := LDLIBS += -lavl - diff --git a/usr/src/cmd/mdb/sparc/v9/libfknsmb/Makefile b/usr/src/cmd/mdb/sparc/v9/libfknsmb/Makefile deleted file mode 100644 index f3f7829e4e..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libfknsmb/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# Copyright 2017 Nexenta Systems, Inc. All rights reserved. -# - -MODULE = libfknsmb.so -MDBTGT = proc - -MODSRCS = nsmb.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -MODSRCS_DIR = ../../../common/modules/nsmb - -# Note: need our sys includes _before_ ENVCPPFLAGS, proto etc. -CPPFLAGS.first += -I$(SRC)/lib/smbclnt/libfknsmb/common -CPPFLAGS.first += -I$(SRC)/lib/libfakekernel/common - -CPPFLAGS += -I$(SRC)/uts/common/fs/smbclnt/ -CPPFLAGS += -I$(SRC)/uts/common -CPPFLAGS += -D_FAKE_KERNEL - -CSTD= $(CSTD_GNU99) diff --git a/usr/src/cmd/mdb/sparc/v9/libfksmbfs/Makefile b/usr/src/cmd/mdb/sparc/v9/libfksmbfs/Makefile deleted file mode 100644 index 0be2b8711f..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libfksmbfs/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# Copyright 2017 Nexenta Systems, Inc. All rights reserved. -# - -MODULE = libfksmbfs.so -MDBTGT = proc - -MODSRCS = smbfs.c avl.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -MODSRCS_DIR = ../../../common/modules/smbfs -GENUNIX_DIR = ../../../common/modules/genunix - -# Note: need our sys includes _before_ ENVCPPFLAGS, proto etc. -CPPFLAGS.first += -I$(SRC)/lib/smbsrv/libfksmbsrv/common -CPPFLAGS.first += -I$(SRC)/lib/libfakekernel/common - -CPPFLAGS += -I$(SRC)/uts/common/fs/smbclnt/ -CPPFLAGS += -I$(SRC)/uts/common - -CSTD= $(CSTD_GNU99) - -dmod/%.o: $(GENUNIX_DIR)/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -dmod/%.ln: $(GENUNIX_DIR)/%.c - $(LINT.c) -c $< diff --git a/usr/src/cmd/mdb/sparc/v9/libfksmbsrv/Makefile b/usr/src/cmd/mdb/sparc/v9/libfksmbsrv/Makefile deleted file mode 100644 index 4be3d997e0..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libfksmbsrv/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# Copyright 2013 Nexenta Systems, Inc. All rights reserved. -# Copyright 2015 Gary Mills -# Copyright 2019 Peter Tribble. -# - -MODULE = libfksmbsrv.so -MDBTGT = proc - -MODSRCS = smbsrv.c smbsrv_pcap.c list.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -MODSRCS_DIR = ../../../common/modules/smbsrv -GENUNIX_DIR = ../../../common/modules/genunix - -# Note: need our sys includes _before_ ENVCPPFLAGS, proto etc. -CPPFLAGS.first += -I../../../../../lib/smbsrv/libfksmbsrv/common -CPPFLAGS.first += -I../../../../../lib/libfakekernel/common - -CPPFLAGS += -I../../../../../uts/common - -CSTD= $(CSTD_GNU99) - -dmod/%.o: $(GENUNIX_DIR)/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) diff --git a/usr/src/cmd/mdb/sparc/v9/libmlsvc/Makefile b/usr/src/cmd/mdb/sparc/v9/libmlsvc/Makefile deleted file mode 100644 index 01d5ede4eb..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libmlsvc/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# Copyright 2018 Nexenta Systems, Inc. All rights reserved. -# Copyright 2019 Peter Tribble. -# - -MODULE = libmlsvc.so -MDBTGT = proc - -MODSRCS = mlsvc.c smb_ht.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -MODSRCS_DIR = ../../../common/modules/libmlsvc - -# CPPFLAGS += -I$(SRC)/lib/smbsrv/libmlsvc -CPPFLAGS += -I$(SRC)/uts/common - -CSTD= $(CSTD_GNU99) diff --git a/usr/src/cmd/mdb/sparc/v9/libnvpair/Makefile b/usr/src/cmd/mdb/sparc/v9/libnvpair/Makefile deleted file mode 100644 index 4e4840ea6e..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libnvpair/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = libnvpair.so -MDBTGT = proc - -MODSRCS = libnvpair.c \ - nvpair.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/libproc/Makefile b/usr/src/cmd/mdb/sparc/v9/libproc/Makefile deleted file mode 100644 index bc50e68808..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libproc/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -MODULE = libproc.so -MDBTGT = proc - -MODSRCS_DIR = ../../../common/modules/libproc - -MODSRCS = libproc.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CFLAGS64 += -I../../../../../lib/libproc/common -LINTFLAGS64 += -I../../../../../lib/libproc/common - -CERRWARN += $(CNOWARN_UNINIT) - -%.o: $(MODSRCS_DIR)/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.ln: $(MODSRCS_DIR)/%.c - $(LINT.c) -c $< diff --git a/usr/src/cmd/mdb/sparc/v9/libpython/Makefile b/usr/src/cmd/mdb/sparc/v9/libpython/Makefile deleted file mode 100644 index cd237fd5c1..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libpython/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2010 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -include $(SRC)/Makefile.master - -MODULE = libpython$(PYTHON3_VERSION).so -MDBTGT = proc -MODULE_NAME = libpython - -MODSRCS_DIR = ../../../common/modules/libpython - -MODSRCS = libpython.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -%.o := CPPFLAGS += $(PYCPPFLAGS) -%.ln := CPPFLAGS += $(PYLNFLAGS) -LINTFLAGS += -erroff=E_MACRO_REDEFINED - -dmod/$(MODULE) := LDLIBS += -lproc - -%.o: $(MODSRCS_DIR)/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.ln: $(MODSRCS_DIR)/%.c - $(LINT.c) -c $< diff --git a/usr/src/cmd/mdb/sparc/v9/libstand/Makefile b/usr/src/cmd/mdb/sparc/v9/libstand/Makefile deleted file mode 100644 index 7083c9643d..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libstand/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -# - -SRCS += \ - setjmp.s - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../Makefile.kmdb.64 -include ../../../Makefile.libstand - -%.o: %.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -%.o: %.s - $(COMPILE.s) -o $@ $< diff --git a/usr/src/cmd/mdb/sparc/v9/libstand/setjmp.s b/usr/src/cmd/mdb/sparc/v9/libstand/setjmp.s deleted file mode 100644 index fb2fdc6e8d..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libstand/setjmp.s +++ /dev/null @@ -1,173 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#if defined(__lint) -#include <setjmp.h> -#endif - -#include <sys/asm_linkage.h> - -/* - * This is a copy of the setjmp (and longjmp) code used in libc. Note that - * we use sigsetjmp as an alias for setjmp, with a corresponding alias between - * siglongjmp and longjmp. We can do this because there aren't any signals - * in kmdb (with the possible exception of the smoke signals the machine will - * emit when we break something). We can also use a sigjmp_buf as a jmp_buf, - * since the latter is smaller than the former. - */ - -#if !defined(__lint) -JB_FLAGS = (0*8) ! offsets in jmpbuf (see sigsetjmp.c) -JB_SP = (1*8) ! words 5 through 11 are unused! -JB_PC = (2*8) -JB_FP = (3*8) -JB_I7 = (4*8) -#endif - -/* - * setjmp(buf_ptr) - * buf_ptr points to a twelve word array (jmp_buf) - */ - -#if defined(__lint) -/* ARGSUSED */ -int -setjmp(jmp_buf env) -{ - return (0); -} - -/* ARGSUSED */ -int -sigsetjmp(sigjmp_buf env, int savemask) -{ - return (0); -} -#else /* __lint */ - - ENTRY(setjmp) - ALTENTRY(sigsetjmp) - clr [%o0 + JB_FLAGS] ! clear flags (used by sigsetjmp) - stx %sp, [%o0 + JB_SP] ! save caller's sp - add %o7, 8, %o1 ! compute return pc - stx %o1, [%o0 + JB_PC] ! save pc - stx %fp, [%o0 + JB_FP] ! save fp - stx %i7, [%o0 + JB_I7] ! save %i7 - flushw - retl - clr %o0 ! return (0) - - SET_SIZE(setjmp) -#endif /* __lint */ - -/* - * longjmp(buf_ptr, val) - * buf_ptr points to a jmpbuf which has been initialized by setjmp. - * val is the value we wish to return to setjmp's caller - * - * We flush the register file to the stack by doing a kernel call. - * This is necessary to ensure that the registers we want to - * pick up are stored on the stack, and that subsequent restores - * will function correctly. - * - * sp, fp, and %i7, the caller's return address, are all restored - * to the values they had at the time of the call to setjmp(). All - * other locals, ins and outs are set to potentially random values - * (as per the man page). This is sufficient to permit the correct - * operation of normal code. - * - * Actually, the above description is not quite correct. If the routine - * that called setjmp() has not altered the sp value of their frame we - * will restore the remaining locals and ins to the values these - * registers had in the this frame at the time of the call to longjmp() - * (not setjmp()!). This is intended to help compilers, typically not - * C compilers, that have some registers assigned to fixed purposes, - * and that only alter the values of these registers on function entry - * and exit. - * - * Since a C routine could call setjmp() followed by alloca() and thus - * alter the sp this feature will typically not be helpful for a C - * compiler. - * - * Note also that because the caller of a routine compiled "flat" (without - * register windows) assumes that their ins and locals are preserved, - * routines that call setjmp() must not be flat. - */ - -#if defined(__lint) -/* ARGSUSED */ -void -longjmp(jmp_buf env, int val) -{ -} - -/* ARGSUSED */ -void -siglongjmp(sigjmp_buf env, int val) -{ -} -#else /* __lint */ - - ENTRY(longjmp) - ALTENTRY(siglongjmp) - - /* flush all reg windows to the stack. */ - save - flushw - restore - nop - - ldx [%o0 + JB_SP], %o2 ! sp in %o2 until safe to puke there - ldx [%o2 + STACK_BIAS], %l0 ! restore locals and ins if we can - ldx [%o2 + (1*8) + STACK_BIAS], %l1 - ldx [%o2 + (2*8) + STACK_BIAS], %l2 - ldx [%o2 + (3*8) + STACK_BIAS], %l3 - ldx [%o2 + (4*8) + STACK_BIAS], %l4 - ldx [%o2 + (5*8) + STACK_BIAS], %l5 - ldx [%o2 + (6*8) + STACK_BIAS], %l6 - ldx [%o2 + (7*8) + STACK_BIAS], %l7 - ldx [%o2 + (8*8) + STACK_BIAS], %i0 - ldx [%o2 + (9*8) + STACK_BIAS], %i1 - ldx [%o2 + (10*8) + STACK_BIAS], %i2 - ldx [%o2 + (11*8) + STACK_BIAS], %i3 - ldx [%o2 + (12*8) + STACK_BIAS], %i4 - ldx [%o2 + (13*8) + STACK_BIAS], %i5 - ldx [%o0 + JB_FP], %fp ! restore fp - mov %o2, %sp ! restore sp - ldx [%o0 + JB_I7], %i7 ! restore %i7 - ldx [%o0 + JB_PC], %o3 ! get new return pc - tst %o1 ! is return value 0? - bnz 1f ! no - leave it alone - sub %o3, 8, %o7 ! normalize return (for adb) (dly slot) - mov 1, %o1 ! yes - set it to one -1: - retl - mov %o1, %o0 ! return (val) - - SET_SIZE(longjmp) -#endif /* __lint */ diff --git a/usr/src/cmd/mdb/sparc/v9/libstandctf/Makefile b/usr/src/cmd/mdb/sparc/v9/libstandctf/Makefile deleted file mode 100644 index 285568dcf2..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libstandctf/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../Makefile.kmdb.64 -include ../../../Makefile.libstandctf diff --git a/usr/src/cmd/mdb/sparc/v9/libsysevent/Makefile b/usr/src/cmd/mdb/sparc/v9/libsysevent/Makefile deleted file mode 100644 index 8c3633fbb4..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libsysevent/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = libsysevent.so -MDBTGT = proc - -MODSRCS = libsysevent.c \ - sysevent.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/libtopo/Makefile b/usr/src/cmd/mdb/sparc/v9/libtopo/Makefile deleted file mode 100644 index b0adeeeae2..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libtopo/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -MODULE = libtopo.so -MDBTGT = proc - -MODSRCS = libtopo.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -I$(SRC)/lib/fm/topo/libtopo/common -CERRWARN += -_gcc=-Wno-parentheses diff --git a/usr/src/cmd/mdb/sparc/v9/libumem/Makefile b/usr/src/cmd/mdb/sparc/v9/libumem/Makefile deleted file mode 100644 index dbb51cd96f..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libumem/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -MODULE = libumem.so -MDBTGT = proc - -MODSRCS_DIR = ../../../common/modules/genunix - -COMMONSRCS = \ - dist.c \ - libumem.c \ - misc.c \ - umem.c - -KMODSRCS = \ - $(COMMONSRCS) - -MODSRCS = \ - $(COMMONSRCS) \ - kgrep.c \ - leaky.c \ - leaky_subr.c \ - proc_kludges.c - -# -# This signals that $(KMODSRCS) != $(MODSRCS). There are certain features of -# the libumem dmod, such as leak detection, that we cannot yet use in the kmod. -# In most cases, the inability to use a given function is due to that function's -# dependance on libproc interfaces - interfaces which are not present in kmdb. -KMOD_SOURCES_DIFFERENT=$(POUND_SIGN) - -include ../../../../Makefile.cmd - -CPPFLAGS += -I$(SRC)/lib/libumem/common -CPPFLAGS += -I$(SRC)/lib/libc/inc -CPPFLAGS += -I$(MODSRCS_DIR) - -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -dmod/$(MODULE) := LDLIBS += -lproc -lm - -CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += $(CNOWARN_UNINIT) - -%.o: $(MODSRCS_DIR)/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.ln: $(MODSRCS_DIR)/%.c - $(LINT.c) -c $< - -# -# This module is somewhat unusual in that it is a proc-style dmod. proc dmods -# are not normally built both for mdb and kmdb. These overrides build it as a -# proc dmod and as a kvm kmod. -TARGETS = $(TARGETS_proc) $(TARGETS_kvm_kmdb) -ROOTTGTS = $(ROOTTGTS_proc) diff --git a/usr/src/cmd/mdb/sparc/v9/libuutil/Makefile b/usr/src/cmd/mdb/sparc/v9/libuutil/Makefile deleted file mode 100644 index 052a66dc34..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libuutil/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = libuutil.so -MDBTGT = proc - -MODSRCS_DIR = ../../../common/modules/libuutil - -MODSRCS = libuutil.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -%.o: $(MODSRCS_DIR)/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.ln: $(MODSRCS_DIR)/%.c - $(LINT.c) -c $< diff --git a/usr/src/cmd/mdb/sparc/v9/libzpool/Makefile b/usr/src/cmd/mdb/sparc/v9/libzpool/Makefile deleted file mode 100644 index eba6fbfd5b..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/libzpool/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# Copyright (c) 2016 by Delphix. All rights reserved. -# - -MODULE = libzpool.so -MDBTGT = proc - -MODSRCS = zfs.c list.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module -include ../../../common/modules/zfs/Makefile.zfs - -MODSRCS_DIR = ../../../common/modules/zfs -GENUNIX_DIR = ../../../common/modules/genunix - -CPPFLAGS += -I../../../../../lib/libzpool/common \ - -I../../../../../uts/common/fs/zfs \ - -I../../../../../uts/common/fs/zfs/lua \ - -I../../../../../common/zfs - -CSTD= $(CSTD_GNU99) - -CERRWARN += -_gcc=-Wno-type-limits - -dmod/%.o: $(GENUNIX_DIR)/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) diff --git a/usr/src/cmd/mdb/sparc/v9/list/Makefile b/usr/src/cmd/mdb/sparc/v9/list/Makefile deleted file mode 100644 index db1490f81f..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/list/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. -# - -MODULE = list.so -MDBTGT = proc - -MODSRCS = listmod.c \ - list.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/lofs/Makefile b/usr/src/cmd/mdb/sparc/v9/lofs/Makefile deleted file mode 100644 index d3fc85bd28..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/lofs/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 1998-2000 by Sun Microsystems, Inc. -# All rights reserved. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = lofs.so -MDBTGT = kvm - -MODSRCS = lofs.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/logindmux/Makefile b/usr/src/cmd/mdb/sparc/v9/logindmux/Makefile deleted file mode 100644 index e985835707..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/logindmux/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 1998-2000 by Sun Microsystems, Inc. -# All rights reserved. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = logindmux.so -MDBTGT = kvm - -MODSRCS = logindmux.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/mac/Makefile b/usr/src/cmd/mdb/sparc/v9/mac/Makefile deleted file mode 100644 index 1456211245..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/mac/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -MODULE = mac.so -MDBTGT = kvm - -MODSRCS = mac.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/mdb/Makefile b/usr/src/cmd/mdb/sparc/v9/mdb/Makefile deleted file mode 100644 index 83ad176eb3..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/mdb/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -SRCS = kvm_v9dep.c \ - mdb_v9util.c \ - proc_isadep.c - -%.o: ../../mdb/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.ln: ../../mdb/%.c - $(LINT.c) -c $< - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.mdb - -CPPFLAGS += -I../../mdb - -install: all $(ISAEXEC) $(ROOTPROG64) $(ROOTLINK64) - -$(RM) $(ROOTPROG) - -$(LN) $(ISAEXEC) $(ROOTPROG) - -$(RM) $(ROOTLINK) - -$(LN) $(ISAEXEC) $(ROOTLINK) diff --git a/usr/src/cmd/mdb/sparc/v9/mdb_ds/Makefile b/usr/src/cmd/mdb/sparc/v9/mdb_ds/Makefile deleted file mode 100644 index 9c260d2318..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/mdb_ds/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = mdb_ds.so -MDBTGT = proc - -MODSRCS = mdb_ds.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -# -# This module is somewhat unusual in that it is a proc-style dmod. proc dmods -# are not normally built both for mdb and kmdb. These overrides build it as a -# proc dmod and as a kvm kmod. -TARGETS = $(TARGETS_proc) $(TARGETS_kvm_kmdb) -ROOTTGTS = $(ROOTTGTS_proc) $(ROOTTGTS_kvm_kmdb) diff --git a/usr/src/cmd/mdb/sparc/v9/mdb_ks/Makefile b/usr/src/cmd/mdb/sparc/v9/mdb_ks/Makefile deleted file mode 100644 index d7181ecfc0..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/mdb_ks/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -# -# In the mdb world, mdb_ks is delivered as a dmod, albeit one with special -# powers. Various other dmods use symbols provided by mdb_ks, through the -# magic of dynamic linking. In the kmdb world, however, things are different. -# kmdb dmods are not allowed to consume symbols exported by anything other -# than the kmdb module. In order to allow other kmdb dmods to use the mdb_ks -# symbols, we link mdb_ks into kmdb. -# - -MODULE = mdb_ks.so -MDBTGT = kvm - -MODSRCS = mdb_ks.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module -include ../../../Makefile.mdb_ks - -# -# We are not actually hardwiring some dependency on sun4u, we just need to -# include sys/param.h with _MACHDEP defined, and this forces the inclusion of -# machparam.h, even though we don't use anything there. This is a temporary -# kludge until we invent -DDONTINCLUDEMACHPARAM or something. -# -CPPFLAGS += -I$(SRC)/uts/sun4u diff --git a/usr/src/cmd/mdb/sparc/v9/mdb_test/Makefile b/usr/src/cmd/mdb/sparc/v9/mdb_test/Makefile deleted file mode 100644 index 19f5bb3f3b..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/mdb_test/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = mdb_test.so -MDBTGT = proc - -MODSRCS = mdb_test.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -# -# This module is somewhat unusual in that this dmod is a proc-style dmod. proc -# dmods are not normally built both for mdb and kmdb. These overrides build -# this dmod as a proc dmod and as a kvm kmod. -TARGETS = $(TARGETS_proc) $(TARGETS_kvm_kmdb) -ROOTTGTS = $(ROOTTGTS_proc) diff --git a/usr/src/cmd/mdb/sparc/v9/mm/Makefile b/usr/src/cmd/mdb/sparc/v9/mm/Makefile deleted file mode 100644 index c49f4f4484..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/mm/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# -# -# This file and its contents are supplied under the terms of the -# Common Development and Distribution License ("CDDL"), version 1.0. -# You may only use this file in accordance with the terms of version -# 1.0 of the CDDL. -# -# A full copy of the text of the CDDL should have accompanied this -# source. A copy of the CDDL is also available via the Internet at -# http://www.illumos.org/license/CDDL. -# - -# -# Copyright (c) 2015, Joyent, Inc. All rights reserved. -# - -MODULE = mm.so -MDBTGT = kvm - -MODSRCS = mm.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/mpt_sas/Makefile b/usr/src/cmd/mdb/sparc/v9/mpt_sas/Makefile deleted file mode 100644 index 0dfa0293e4..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/mpt_sas/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. - -MODULE = mpt_sas.so -MDBTGT = kvm - -MODSRCS = mpt_sas.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -I$(SRC)/uts/common - -CERRWARN += -_gcc=-Wno-trigraphs diff --git a/usr/src/cmd/mdb/sparc/v9/mr_sas/Makefile b/usr/src/cmd/mdb/sparc/v9/mr_sas/Makefile deleted file mode 100644 index 87ae53bddd..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/mr_sas/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -MODULE = mr_sas.so -MDBTGT = kvm - -MODSRCS = mr_sas.c - -MRSASBASE = ../../../../../uts/common/io/mr_sas - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -I$(SRC)/uts/common -CPPFLAGS += -I$(SRC)/uts/common/sys/scsi -CPPFLAGS += -I$(SRC)/uts/common/sys/scsi/adapters -CPPFLAGS += -I$(MRSASBASE) -CPPFLAGS += -D KMDB_MODULE diff --git a/usr/src/cmd/mdb/sparc/v9/neti/Makefile b/usr/src/cmd/mdb/sparc/v9/neti/Makefile deleted file mode 100644 index 8879100579..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/neti/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = neti.so -MDBTGT = kvm - -MODSRCS = neti.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/nsmb/Makefile b/usr/src/cmd/mdb/sparc/v9/nsmb/Makefile deleted file mode 100644 index 42560d80aa..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/nsmb/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2011 Nexenta Systems, Inc. All rights reserved. -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. - -MDBTGT = kvm -MODULE = nsmb.so -MODSRCS_DIR = ../../../common/modules/nsmb -MODSRCS = nsmb.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 - -# This kmod goes in /usr/kernel/kmdb -ROOTKMOD = $(ROOT)/usr/kernel/kmdb$(MACHMODDIR) - -include ../../../Makefile.module - -CPPFLAGS += -I$(SRC)/uts/common/fs/smbclnt -CPPFLAGS += -I$(SRC)/uts/common - -CSTD= $(CSTD_GNU99) - -# maybe not the best place for this, but -# we need to create this directory. -$(ROOTKMOD): - $(INS.dir) diff --git a/usr/src/cmd/mdb/sparc/v9/pmcs/Makefile b/usr/src/cmd/mdb/sparc/v9/pmcs/Makefile deleted file mode 100644 index 5ca8d43850..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/pmcs/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -MODULE = pmcs.so -MDBTGT = kvm - -MODSRCS = pmcs.c - -include $(SRC)/cmd/Makefile.cmd -include $(SRC)/cmd/Makefile.cmd.64 -include $(SRC)/cmd/mdb/sparc/Makefile.sparcv9 -include $(SRC)/cmd/mdb/Makefile.module - -CSTD = $(CSTD_GNU99) - -CPPFLAGS += -I$(SRC)/uts/common - -CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-char-subscripts -CERRWARN += $(CNOWARN_UNINIT) diff --git a/usr/src/cmd/mdb/sparc/v9/ptm/Makefile b/usr/src/cmd/mdb/sparc/v9/ptm/Makefile deleted file mode 100644 index 5505b13bea..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/ptm/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 1998-2000 by Sun Microsystems, Inc. -# All rights reserved. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = ptm.so -MDBTGT = kvm - -MODSRCS = ptm.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/qlc/Makefile b/usr/src/cmd/mdb/sparc/v9/qlc/Makefile deleted file mode 100644 index 9bfb4fe5b4..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/qlc/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -MODULE = qlc.so -MDBTGT = kvm - -MODSRCS = qlc.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -I$(SRC)/uts/common -CPPFLAGS += -I$(SRC)/uts/common/sys/fibre-channel -CPPFLAGS += -I$(SRC)/uts/common/sys/fibre-channel/fca/qlc -CPPFLAGS += -I$(SRC)/uts/common/sys/fibre-channel/impl - -CSTD= $(CSTD_GNU99) - -CERRWARN += -_gcc=-Wno-address diff --git a/usr/src/cmd/mdb/sparc/v9/random/Makefile b/usr/src/cmd/mdb/sparc/v9/random/Makefile deleted file mode 100644 index e30b562a48..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/random/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 2001 by Sun Microsystems, Inc. -# All rights reserved. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = random.so -MDBTGT = kvm - -MODSRCS = random.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/s1394/Makefile b/usr/src/cmd/mdb/sparc/v9/s1394/Makefile deleted file mode 100644 index 012dcbb76c..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/s1394/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 1999-2000 by Sun Microsystems, Inc. -# All rights reserved. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = s1394.so -MDBTGT = kvm - -MODSRCS = s1394.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -# Needed to #include <sys/1394/s1394.h> -CPPFLAGS += -I$(SRC)/uts/common diff --git a/usr/src/cmd/mdb/sparc/v9/scsi_vhci/Makefile b/usr/src/cmd/mdb/sparc/v9/scsi_vhci/Makefile deleted file mode 100644 index e6cf3712e9..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/scsi_vhci/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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" - -MODULE = scsi_vhci.so -MDBTGT = kvm - -MODSRCS = scsi_vhci.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/sctp/Makefile b/usr/src/cmd/mdb/sparc/v9/sctp/Makefile deleted file mode 100644 index 22be709f5f..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/sctp/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = sctp.so -MDBTGT = kvm - -MODSRCS = sctp.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 - -CPPFLAGS += -I$(SRC)/uts/common/inet - -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/sd/Makefile b/usr/src/cmd/mdb/sparc/v9/sd/Makefile deleted file mode 100644 index abd12c3a82..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/sd/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2002 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#pragma ident "%Z%%M% %I% %E% SMI" - -MODULE = sd.so -MDBTGT = kvm - -MODSRCS = sd.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/smbfs/Makefile b/usr/src/cmd/mdb/sparc/v9/smbfs/Makefile deleted file mode 100644 index b89fc0cc1d..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/smbfs/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2011 Nexenta Systems, Inc. All rights reserved. -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. - -MDBTGT = kvm -MODULE = smbfs.so -MODSRCS_DIR = ../../../common/modules/smbfs -MODSRCS = smbfs.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 - -# This kmod goes in /usr/kernel/kmdb -ROOTKMOD = $(ROOT)/usr/kernel/kmdb$(MACHMODDIR) - -include ../../../Makefile.module - -CPPFLAGS += -I$(SRC)/uts/common/fs/smbclnt -CPPFLAGS += -I$(SRC)/uts/common - -CSTD= $(CSTD_GNU99) - -# maybe not the best place for this, but -# we need to create this directory. -$(ROOTKMOD): - $(INS.dir) diff --git a/usr/src/cmd/mdb/sparc/v9/smbsrv/Makefile b/usr/src/cmd/mdb/sparc/v9/smbsrv/Makefile deleted file mode 100644 index 2aa9026ab8..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/smbsrv/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# Copyright 2015 Nexenta Systems, Inc. All rights reserved. -# - -MODULE = smbsrv.so -MDBTGT = kvm - -# -# This signals that $(KMODSRCS) != $(MODSRCS). Dump to a pcap file -# is not available in kmdb, so don't bother compiling that code. -KMOD_SOURCES_DIFFERENT=$(POUND_SIGN) - -KMODSRCS = smbsrv.c -MODSRCS = smbsrv.c smbsrv_pcap.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 - -ROOTKMOD = $(ROOT)/usr/kernel/kmdb$(MACHMODDIR) - -include ../../../Makefile.module - -CSTD= $(CSTD_GNU99) - -$(ROOTKMOD): - $(INS.dir) diff --git a/usr/src/cmd/mdb/sparc/v9/sockfs/Makefile b/usr/src/cmd/mdb/sparc/v9/sockfs/Makefile deleted file mode 100644 index 9e65a6282b..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/sockfs/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. - -MODULE = sockfs.so -MDBTGT = kvm - -MODSRCS = sockfs.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/specfs/Makefile b/usr/src/cmd/mdb/sparc/v9/specfs/Makefile deleted file mode 100644 index 49e48378ac..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/specfs/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = specfs.so -MDBTGT = kvm - -MODSRCS = specfs.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module diff --git a/usr/src/cmd/mdb/sparc/v9/sppp/Makefile b/usr/src/cmd/mdb/sparc/v9/sppp/Makefile deleted file mode 100644 index 42c31eb723..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/sppp/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 2000-2001 by Sun Microsystems, Inc. -# All rights reserved. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = sppp.so -MDBTGT = kvm - -MODSRCS = sppp.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -I../../../../../uts/common/io/ppp diff --git a/usr/src/cmd/mdb/sparc/v9/srpt/Makefile b/usr/src/cmd/mdb/sparc/v9/srpt/Makefile deleted file mode 100644 index 987cdbf5b4..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/srpt/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -MODULE = srpt.so -MDBTGT = kvm - -MODSRCS = srpt.c - -UTSBASE = ../../../../../uts -COMSTARBASE = $(UTSBASE)/common/io/comstar -SRPTBASE = $(COMSTARBASE)/port/srpt - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -I$(UTSBASE)/common -I$(UTSBASE)/common/sys -I$(SRPTBASE) - -CSTD= $(CSTD_GNU99) diff --git a/usr/src/cmd/mdb/sparc/v9/ssd/Makefile b/usr/src/cmd/mdb/sparc/v9/ssd/Makefile deleted file mode 100644 index 27997d136d..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/ssd/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#pragma ident "%Z%%M% %I% %E% SMI" - -MODULE = ssd.so -MDBTGT = kvm - -MODSRCS = sd.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -MODSRCS_DIR = ../../../common/modules/sd - -CPPFLAGS += -D__fibre diff --git a/usr/src/cmd/mdb/sparc/v9/stmf/Makefile b/usr/src/cmd/mdb/sparc/v9/stmf/Makefile deleted file mode 100644 index 322af28c87..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/stmf/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -MODULE = stmf.so -MDBTGT = kvm - -MODSRCS = stmf.c - -COMSTARBASE = ../../../../../uts/common/io/comstar - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -erroff=E_NON_CONST_INIT -CPPFLAGS += -I$(COMSTARBASE)/port/fct -I$(COMSTARBASE)/stmf diff --git a/usr/src/cmd/mdb/sparc/v9/stmf_sbd/Makefile b/usr/src/cmd/mdb/sparc/v9/stmf_sbd/Makefile deleted file mode 100644 index d7fa4d8769..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/stmf_sbd/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. -# - -MODULE = stmf_sbd.so -MDBTGT = kvm - -MODSRCS = stmf_sbd.c - -UTSBASE = ../../../../../uts -COMSTARBASE = $(UTSBASE)/common/io/comstar -STMFSBDBASE = $(COMSTARBASE)/lu/stmf_sbd - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -I$(UTSBASE)/common -I$(UTSBASE)/common/sys -I$(STMFSBDBASE) - -CSTD= $(CSTD_GNU99) diff --git a/usr/src/cmd/mdb/sparc/v9/ufs/Makefile b/usr/src/cmd/mdb/sparc/v9/ufs/Makefile deleted file mode 100644 index af42f8c31d..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/ufs/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -MODULE = ufs.so -MDBTGT = kvm - -MODSRCS = ufs.c ufs_log.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CERRWARN += -_gcc=-Wno-trigraphs diff --git a/usr/src/cmd/mdb/sparc/v9/usba/Makefile b/usr/src/cmd/mdb/sparc/v9/usba/Makefile deleted file mode 100644 index 08f959fa6a..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/usba/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = usba.so -MDBTGT = kvm - -MODSRCS = usb.c usba.c prtusb.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module - -CPPFLAGS += -I../../../../../uts/common diff --git a/usr/src/cmd/mdb/sparc/v9/zfs/Makefile b/usr/src/cmd/mdb/sparc/v9/zfs/Makefile deleted file mode 100644 index b105a86b4f..0000000000 --- a/usr/src/cmd/mdb/sparc/v9/zfs/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# Copyright (c) 2016 by Delphix. All rights reserved. -# - -MODULE = zfs.so -MDBTGT = kvm - -MODSRCS = zfs.c - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../Makefile.sparcv9 -include ../../../Makefile.module -include ../../../common/modules/zfs/Makefile.zfs - -CPPFLAGS += -I../../../../../uts/common/fs/zfs -CPPFLAGS += -I../../../../../uts/common/fs/zfs/lua -CPPFLAGS += -I../../../../../common/zfs - -CSTD= $(CSTD_GNU99) - -CERRWARN += -_gcc=-Wno-type-limits diff --git a/usr/src/cmd/mdb/sun4u/Makefile b/usr/src/cmd/mdb/sun4u/Makefile deleted file mode 100644 index 809fb5b456..0000000000 --- a/usr/src/cmd/mdb/sun4u/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -SUBDIRS = modules v9 -include ../Makefile.subdirs - -modules: v9 diff --git a/usr/src/cmd/mdb/sun4u/Makefile.kmdb b/usr/src/cmd/mdb/sun4u/Makefile.kmdb deleted file mode 100644 index dc58c5e066..0000000000 --- a/usr/src/cmd/mdb/sun4u/Makefile.kmdb +++ /dev/null @@ -1,113 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -PROMSRCS += \ - prom_2path.c \ - prom_devname.c \ - prom_devtype.c \ - prom_enter.c \ - prom_env.c \ - prom_exit.c \ - prom_fb.c \ - prom_getchar.c \ - prom_init.c \ - prom_inpath.c \ - prom_interp.c \ - prom_io.c \ - prom_mmu.c \ - prom_node.c \ - prom_outpath.c \ - prom_panic.c \ - prom_phandle.c \ - prom_printf.c \ - prom_prop.c \ - prom_putchar.c \ - prom_sparc.c \ - prom_stdin.c \ - prom_stdout.c \ - prom_string.c - -KMDBSRCS += \ - kaif.c \ - kaif_activate.c \ - kaif_start_isadep.c \ - kmdb_dpi_isadep.c \ - kmdb_fault_isadep.c \ - kmdb_kdi_isadep.c \ - kmdb_makecontext.c \ - kmdb_promif_isadep.c \ - kvm_isadep.c - -KMDBML += \ - kmdb_asmutil.s - -KCTLSRCS += \ - kctl_isadep.c - -KCTLML += \ - kctl_asm.s - -SACPPFLAGS = -D__sparc - -STANDLIBS += \ - ../../../sparc/v9/libstandctf/libstandctf.so \ - $(SRC)/lib/libumem/$(MACHDIR)/libstandumem.so \ - ../../../sparc/v9/libstand/libstand.a - -KMDBLIBS = $(STANDLIBS) ../../../sparc/v9/mdb_ks/kmod/mdb_ks - -MAPFILE_SOURCES = \ - $(MAPFILE_SOURCES_COMMON) \ - ../../../sparc/kmdb/kmdb_dpi_isadep.h \ - $(MAPFILE_SOURCES_$(MACH)) - -%.fth: $(SRC)/cmd/mdb/sparc/kmdb/%.fdbg - grep '^#' <$< >$(<F).c - grep -v '^#' <$< >$(<F).tmp - $(CC) $(CTFSTABSCFLAGS) $(CPPFLAGS) $(CCGDEBUG) -c -o $(<F).o $(<F).c - $(CTFCONVERT) $(CTFCVTFLAGS) $(<F).o - $(CTFSTABS) -t forth -i $(<F).tmp -o $@ $(<F).o - $(RM) $(<F).c $(<F).tmp $(<F).o - -%.o: ../../../../../psm/promif/ieee1275/common/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.o: ../../../../../psm/promif/ieee1275/sun4/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.o: ../../../../../psm/promif/ieee1275/sun4u/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.ln: ../../../../../psm/promif/ieee1275/common/%.c - $(LINT.c) -c $< - -%.ln: ../../../../../psm/promif/ieee1275/sun4/%.c - $(LINT.c) -c $< - -%.ln: ../../../../../psm/promif/ieee1275/sun4u/%.c - $(LINT.c) -c $< diff --git a/usr/src/cmd/mdb/sun4u/Makefile.sun4u b/usr/src/cmd/mdb/sun4u/Makefile.sun4u deleted file mode 100644 index d05b03f162..0000000000 --- a/usr/src/cmd/mdb/sun4u/Makefile.sun4u +++ /dev/null @@ -1,49 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -ROOTMOD = $(ROOT)/usr/platform/sun4u/lib/mdb/$(MDBTGT)$(MACHMODDIR) -ROOTKMOD = $(ROOT)/platform/sun4u/kernel/kmdb$(MACHMODDIR) - -$(ROOT)/usr/platform/sun4u/lib/mdb: - $(INS.dir) - -$(ROOT)/usr/platform/sun4u/lib/mdb/$(MDBTGT): $(ROOT)/usr/platform/sun4u/lib/mdb - $(INS.dir) - -$(ROOT)/usr/platform/sun4u/lib/mdb/$(MDBTGT)/sparcv9: \ - $(ROOT)/usr/platform/sun4u/lib/mdb/$(MDBTGT) - $(INS.dir) - -$(ROOT)/platform/sun4u/kernel: - $(INS.dir) - -$(ROOT)/platform/sun4u/kernel/kmdb: $(ROOT)/platform/sun4u/kernel - $(INS.dir) - -$(ROOT)/platform/sun4u/kernel/kmdb/sparcv9: $(ROOT)/platform/sun4u/kernel/kmdb - $(INS.dir) diff --git a/usr/src/cmd/mdb/sun4u/modules/Makefile b/usr/src/cmd/mdb/sun4u/modules/Makefile deleted file mode 100644 index 89fcbb34f0..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -include $(SRC)/Makefile.master - -SUBDIRS = unix lw8 serengeti opl - -include ../../Makefile.subdirs diff --git a/usr/src/cmd/mdb/sun4u/modules/lw8/Makefile b/usr/src/cmd/mdb/sun4u/modules/lw8/Makefile deleted file mode 100644 index 12a01065f6..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/lw8/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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" - -SUBDIRS = sgenv -include $(SRC)/cmd/mdb/Makefile.subdirs diff --git a/usr/src/cmd/mdb/sun4u/modules/lw8/sgenv/Makefile b/usr/src/cmd/mdb/sun4u/modules/lw8/sgenv/Makefile deleted file mode 100644 index b4b2522746..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/lw8/sgenv/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# ident "%Z%%M% %I% %E% SMI" -# - -SUBDIRS = v9 -include $(SRC)/cmd/mdb/Makefile.subdirs diff --git a/usr/src/cmd/mdb/sun4u/modules/lw8/sgenv/sgenv.c b/usr/src/cmd/mdb/sun4u/modules/lw8/sgenv/sgenv.c deleted file mode 100644 index cac7ef78b8..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/lw8/sgenv/sgenv.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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" - -#include <sys/time.h> -#include <sys/kstat.h> -#include <sys/mdb_modapi.h> - -#include <sys/sgenv.h> - - -/* - * This dcmd returns the values of the tunable variables in the Serengeti - * environmental driver (SGENV). - */ -/*ARGSUSED*/ -static int -sgenv_parameters(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - int mbox_wait_time; - int debug_flag; - - int err; - - if ((flags & DCMD_ADDRSPEC) || argc != 0) - return (DCMD_USAGE); - - mdb_printf("SGENV tunable parameters:\n"); - mdb_printf("=========================\n"); - - err = mdb_readvar(&mbox_wait_time, "sgenv_max_mbox_wait_time"); - if (err != -1) { - mdb_printf("sgenv_max_mbox_wait_time = %d seconds\n", - mbox_wait_time); - } - - err = mdb_readvar(&debug_flag, "sgenv_debug"); - if (err != -1) { - mdb_printf("sgenv_debug = 0x%x\n", debug_flag); - } - - return (DCMD_OK); -} - - -/* - * This dcmd prints the values of some of the module specific - * variables in the Serengeti environmental driver (SGENV). - */ -/*ARGSUSED*/ -static int -sgenv_variables(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - size_t env_cache_snapshot_size; - int env_cache_updated; - int env_writer_count; - - int board_cache_updated; - int board_count_snapshot; - int board_count; - int board_writer_count; - - int mbox_error_count; - - int rv; - - if ((flags & DCMD_ADDRSPEC) || argc != 0) - return (DCMD_USAGE); - - mdb_printf("\nSGENV module variables:\n"); - mdb_printf("=======================\n"); - - mdb_printf("\nEnvironmental variables:\n"); - mdb_printf("------------------------\n"); - rv = mdb_readvar(&env_cache_updated, "env_cache_updated"); - if (rv == sizeof (env_cache_updated)) { - mdb_printf("env_cache_updated\t\t= %s\n", - (env_cache_updated ? "TRUE": "FALSE")); - } - - rv = mdb_readvar(&env_writer_count, "env_writer_count"); - if (rv == sizeof (env_writer_count)) { - mdb_printf("env_writer_count\t\t= %d\n", env_writer_count); - } - - rv = mdb_readvar(&env_cache_snapshot_size, "env_cache_snapshot_size"); - if (rv == sizeof (env_cache_snapshot_size)) { - mdb_printf("env_cache_snapshot_size\t\t= %d\n", - env_cache_snapshot_size); - } - - mdb_printf("\nBoard info variables:\n"); - mdb_printf("---------------------\n"); - rv = mdb_readvar(&board_cache_updated, "board_cache_updated"); - if (rv == sizeof (board_cache_updated)) { - mdb_printf("board_cache_updated\t\t= %s\n", - (board_cache_updated ? "TRUE": "FALSE")); - } - - rv = mdb_readvar(&board_writer_count, "board_writer_count"); - if (rv == sizeof (board_writer_count)) { - mdb_printf("board_writer_count\t\t= %d\n", board_writer_count); - } - - rv = mdb_readvar(&board_count, "board_count"); - if (rv == sizeof (board_count)) { - mdb_printf("board_count\t\t\t= %d\n", board_count); - } - - rv = mdb_readvar(&board_count_snapshot, "board_count_snapshot"); - if (rv == sizeof (board_count_snapshot)) { - mdb_printf("board_count_snapshot\t\t= %d\n", - board_count_snapshot); - } - - mdb_printf("\nError variables:\n"); - mdb_printf("----------------\n"); - rv = mdb_readvar(&mbox_error_count, "sgenv_mbox_error_count"); - if (rv == sizeof (mbox_error_count)) { - mdb_printf("mbox_error_count\t\t= %d\n", mbox_error_count); - } - - mdb_printf("\n"); - - return (DCMD_OK); -} - -/*ARGSUSED2*/ -int -sgenv_env_sensor(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - env_sensor_t value; - - int rv; - - if ((flags & DCMD_ADDRSPEC) == 0) { - mdb_warn("sgenv_env_sensor: requires an address"); - return (DCMD_ERR); - } - - rv = mdb_vread(&value, sizeof (env_sensor_t), addr); - if (rv != sizeof (env_sensor_t)) { - mdb_warn("sgenv_env_sensor: Failed read on " - "address %ll#r", addr); - return (DCMD_ERR); - } - mdb_printf("---------- struct_env_sensor @ %ll#r ----------\n", addr); - - mdb_printf("sd_id: %29ll#x\n", value.sd_id); - mdb_printf("sd_value: %26lld\n", value.sd_value); - mdb_printf("sd_lo: %29lld\n", value.sd_lo); - mdb_printf("sd_hi: %29lld\n", value.sd_hi); - mdb_printf("sd_lo_warn: %24lld\n", value.sd_lo_warn); - mdb_printf("sd_hi_warn: %24lld\n", value.sd_hi_warn); - mdb_printf("sd_status: %25ll#x\n", value.sd_status); - - return (DCMD_OK); -} - -/* - * MDB module linkage information: - */ - -static const mdb_dcmd_t dcmds[] = {{ - "sgenv_parameters", - NULL, - "print environmental driver tunable parameters", - sgenv_parameters - }, { - "sgenv_variables", - NULL, - "print environmental driver variables", - sgenv_variables - }, { - "sgenv_env_sensor", - NULL, - "print contents of environmental sesnor", - sgenv_env_sensor }, - { NULL } -}; - -static const mdb_modinfo_t modinfo = { - MDB_API_VERSION, dcmds, NULL -}; - -const mdb_modinfo_t * -_mdb_init(void) -{ - return (&modinfo); -} diff --git a/usr/src/cmd/mdb/sun4u/modules/lw8/sgenv/v9/Makefile b/usr/src/cmd/mdb/sun4u/modules/lw8/sgenv/v9/Makefile deleted file mode 100644 index 0e8c162aa4..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/lw8/sgenv/v9/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = sgenv.so -MDBTGT = kvm - -MODSRCS = sgenv.c - -include $(SRC)/cmd/Makefile.cmd -include $(SRC)/cmd/Makefile.cmd.64 -include $(SRC)/cmd/mdb/sparc/Makefile.sparcv9 -include $(SRC)/cmd/mdb/sun4u/Makefile.sun4u -include $(SRC)/cmd/mdb/Makefile.module - -CPPFLAGS += -DMP -D_MACHDEP -CPPFLAGS += -I$(SRC)/uts/sun4u -CPPFLAGS += -I$(SRC)/uts/sfmmu -CPPFLAGS += -I$(SRC)/uts/sparc/v9 -CPPFLAGS += -I$(SRC)/uts/sun4u/lw8 -CPPFLAGS += -I$(SRC)/uts/sun4u/serengeti diff --git a/usr/src/cmd/mdb/sun4u/modules/opl/Makefile b/usr/src/cmd/mdb/sun4u/modules/opl/Makefile deleted file mode 100644 index b0ddcac771..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/opl/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -SUBDIRS = oplhwd -include $(SRC)/cmd/mdb/Makefile.subdirs diff --git a/usr/src/cmd/mdb/sun4u/modules/opl/oplhwd/Makefile b/usr/src/cmd/mdb/sun4u/modules/opl/oplhwd/Makefile deleted file mode 100644 index e4cf03b137..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/opl/oplhwd/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" -# - -SUBDIRS = v9 -include $(SRC)/cmd/mdb/Makefile.subdirs diff --git a/usr/src/cmd/mdb/sun4u/modules/opl/oplhwd/oplhwd.c b/usr/src/cmd/mdb/sun4u/modules/opl/oplhwd/oplhwd.c deleted file mode 100644 index 5bdea9bc81..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/opl/oplhwd/oplhwd.c +++ /dev/null @@ -1,663 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -#include <sys/mdb_modapi.h> -#include <sys/types.h> -#include <sys/dditypes.h> -#include <sys/fcode.h> -#include <sys/machcpuvar.h> -#include <sys/opl.h> -#include <sys/opl_cfg.h> - -static uintptr_t tmptr; - -/* - * print hardware descriptor - */ - -/* Verbosity bits */ -#define DUMP_HDR 0x00001 /* Header */ -#define DUMP_SB_STAT 0x00002 /* System Board Status */ -#define DUMP_DINFO 0x00004 /* Domain Information */ -#define DUMP_SB_INFO 0x00008 /* System Board Information */ -#define DUMP_CMU_CHAN 0x00010 /* CPU/Memory Channel */ -#define DUMP_CHIPS 0x00020 /* Phyiscal CPUs */ -#define DUMP_MEM 0x00040 /* Memory Information */ -#define DUMP_PCI_CH 0x00080 /* PCI Channel */ -#define DUMP_MEM_BANKS 0x00100 /* Memory Banks */ -#define DUMP_MEM_CHUNKS 0x00200 /* Memory Chunks */ -#define DUMP_MEM_DIMMS 0x00400 /* Memory DIMMS */ -#define DUMP_MEM_CS 0x00800 /* Memory CS */ -#define DUMP_CORES 0x01000 /* CPU Cores Information */ -#define DUMP_SCS 0x02000 /* SC Information */ -#define DUMP_MISSING 0x10000 /* Miscellenous Information */ -#define DUMP_COMP_NAME 0x20000 /* Component Name */ - - -/* A nice mix of most of what you want */ -#define DUMP_ALL (DUMP_HDR | DUMP_SB_STAT | DUMP_DINFO | \ - DUMP_SB_INFO | DUMP_CMU_CHAN | DUMP_CHIPS | \ - DUMP_MEM | DUMP_PCI_CH | DUMP_MEM_BANKS | \ - DUMP_CORES | DUMP_SCS) - - -#define DUMP_VERBOSE (DUMP_ALL | DUMP_MEM_CHUNKS | DUMP_MEM_CS) -#define DUMP_FULL (DUMP_VERBOSE | DUMP_MISSING | DUMP_COMP_NAME) - - -#define MIA(stat) ((stat) == HWD_STAT_MISS) -#define DONT_BOTHER(stat, v) (MIA(stat) && (v != HWD_STAT_PRESENT)) - -static char *hwd_stat_decode(int stat) -{ - switch (stat) { - case HWD_STAT_UNKNOWN: - return ("UNKNOWN"); - case HWD_STAT_PRESENT: - return ("PRESENT"); - case HWD_STAT_MISS: - return ("MISS"); - case HWD_STAT_MISCONFIG: - return ("MISCONFIG"); - case HWD_STAT_PASS: - return ("PASS"); - case HWD_STAT_FAIL: - return ("FAIL_XSCF"); - case HWD_STAT_FAIL_OBP: - return ("FAIL_OBP"); - case HWD_STAT_FAIL_OS: - return ("FAIL_OS"); - default: - return ("?"); - } -} - -static void -dumpmemhwd(hwd_memory_t *memp, int v, int mv) -{ - int i, j; - - mdb_printf("\nMemory:\tstart\t0x%llx\tsize\t0x%llx\tmirror mode %d\n", - memp->mem_start_address, memp->mem_size, memp->mem_mirror_mode); - mdb_printf("\tdivision mode\t0x%x\tpiece number\t0x%llx", - memp->mem_division_mode, memp->mem_piece_number); - mdb_printf("\tcs interleave %d\n", memp->mem_cs_interleave); - - /* banks */ - for (i = 0; i < HWD_BANKS_PER_CMU; i++) { - if (DONT_BOTHER(memp->mem_banks[i].bank_status, mv)) { - mdb_printf("\tBank %d\tstatus\t0x%x (%s)\n", - i, memp->mem_banks[i].bank_status, - hwd_stat_decode(memp->mem_banks[i].bank_status)); - continue; - } - mdb_printf("\tBank %d\tstatus\t0x%x (%s)\treg addr\t0x%llx\n", - i, memp->mem_banks[i].bank_status, - hwd_stat_decode(memp->mem_banks[i].bank_status), - memp->mem_banks[i].bank_register_address); - if (v & DUMP_MEM_BANKS) { - mdb_printf("\t\tcs status\t0x%x 0x%x\n", - memp->mem_banks[i].bank_cs_status[0], - memp->mem_banks[i].bank_cs_status[1]); - mdb_printf("\t\tMAC OCD\tDIMM OCDs\n"); - mdb_printf("\t\t%x\t%x %x %x %x %x %x %x %x\n", - memp->mem_banks[i].bank_mac_ocd, - memp->mem_banks[i].bank_dimm_ocd[0][0], - memp->mem_banks[i].bank_dimm_ocd[0][1], - memp->mem_banks[i].bank_dimm_ocd[1][0], - memp->mem_banks[i].bank_dimm_ocd[1][1], - memp->mem_banks[i].bank_dimm_ocd[2][0], - memp->mem_banks[i].bank_dimm_ocd[2][1], - memp->mem_banks[i].bank_dimm_ocd[3][0], - memp->mem_banks[i].bank_dimm_ocd[3][1]); - } - } - /* chunks */ - for (i = 0; i < HWD_MAX_MEM_CHUNKS; i++) { - if ((memp->mem_chunks[i].chnk_start_address == 0) && (mv != 1)) - continue; - mdb_printf("\tchunk %d\tstart\t0x%llx\tsize\t0x%llx\n", - i, memp->mem_chunks[i].chnk_start_address, - memp->mem_chunks[i].chnk_size); - } - /* dimms */ - for (i = 0; i < HWD_DIMMS_PER_CMU; i++) { - if (DONT_BOTHER(memp->mem_dimms[i].dimm_status, mv)) { - if (v & DUMP_MEM_DIMMS) - mdb_printf("\tDIMM %d\tstatus\t0x%x (%s)\n", - i, memp->mem_dimms[i].dimm_status, - hwd_stat_decode( - memp->mem_dimms[i].dimm_status)); - continue; - } - mdb_printf("\tDIMM %d\tstatus\t0x%x (%s)\tcapacity\t0x%llx\n", - i, memp->mem_dimms[i].dimm_status, - hwd_stat_decode(memp->mem_dimms[i].dimm_status), - memp->mem_dimms[i].dimm_capacity); - mdb_printf("\t\trank\t%x\tavailable capacity\t0x%llx\n", - memp->mem_dimms[i].dimm_rank, - memp->mem_dimms[i].dimm_available_capacity); - } - /* cs */ - for (i = 0; i < 2; i++) { - if (DONT_BOTHER(memp->mem_cs[i].cs_status, mv)) { - mdb_printf("\tCS %d:\tstatus\t0x%x (%s)\n", - i, memp->mem_cs[i].cs_status, - hwd_stat_decode(memp->mem_cs[i].cs_status)); - continue; - } - mdb_printf("\tCS %d:\tstatus\t0x%x (%s)\tavailable\t0x%llx\n", - i, memp->mem_cs[i].cs_status, - hwd_stat_decode(memp->mem_cs[i].cs_status), - memp->mem_cs[i].cs_available_capacity); - mdb_printf("\t\tno of dimms\t%x\tdimm capacity\t0x%llx\n", - memp->mem_cs[i].cs_number_of_dimms, - memp->mem_cs[i].cs_dimm_capacity); - mdb_printf("\t\tPA <-> MAC conversion\n\t\t"); - for (j = 0; j < 20; j++) - mdb_printf("%02x ", memp->mem_cs[i].cs_pa_mac_table[j]); - mdb_printf("\n\t\t"); - for (j = 20; j < 40; j++) - mdb_printf("%02x ", memp->mem_cs[i].cs_pa_mac_table[j]); - mdb_printf("\n\t\t"); - for (j = 40; j < 60; j++) - mdb_printf("%02x ", memp->mem_cs[i].cs_pa_mac_table[j]); - mdb_printf("\n\t\t"); - for (j = 60; j < 64; j++) - mdb_printf("%02x ", memp->mem_cs[i].cs_pa_mac_table[j]); - mdb_printf("\n"); - } -} - -/* ARGSUSED */ -static void -dumpchiphwd(hwd_cpu_chip_t *chipp, int ch, int v, int mv) -{ - int cp, co; - hwd_cpu_t *cpup; - hwd_core_t *corep; - - mdb_printf("\nChip %d:\tstatus\t0x%x (%s)\tportid\t%x\n", - ch, chipp->chip_status, hwd_stat_decode(chipp->chip_status), - chipp->chip_portid); - - if (MIA(chipp->chip_status)) - return; - - for (co = 0; co < HWD_CORES_PER_CPU_CHIP; co++) { - corep = &chipp->chip_cores[co]; - - mdb_printf("\tCore %d:\tstatus\t0x%x (%s)\tconfig\t0x%llx\n", - co, corep->core_status, - hwd_stat_decode(corep->core_status), - corep->core_config); - - if (MIA(corep->core_status)) - continue; - - if (v & DUMP_CORES) { - mdb_printf("\t\tfrequency\t0x%llx\tversion\t0x%llx\n", - corep->core_frequency, corep->core_version); - mdb_printf("\t\t(manuf/impl/mask: %x/%x/%x)\n", - corep->core_manufacturer, - corep->core_implementation, corep->core_mask); - mdb_printf("\t\t\tSize\tLinesize\tAssoc\n"); - mdb_printf("\t\tL1I$\t%x\t%x\t\t%x\n", - corep->core_l1_icache_size, - corep->core_l1_icache_line_size, - corep->core_l1_icache_associativity); - mdb_printf("\t\tL1D$\t%x\t%x\t\t%x\n", - corep->core_l1_dcache_size, - corep->core_l1_dcache_line_size, - corep->core_l1_dcache_associativity); - mdb_printf("\t\tL2$\t%x\t%x\t\t%x", - corep->core_l2_cache_size, - corep->core_l2_cache_line_size, - corep->core_l2_cache_associativity); - mdb_printf("\tsharing\t%x\n", - corep->core_l2_cache_sharing); - mdb_printf("\t\tITLB entries\t0x%x\tDTLB entries " - "0x%x\n", corep->core_num_itlb_entries, - corep->core_num_dtlb_entries); - } - - for (cp = 0; cp < HWD_CPUS_PER_CORE; cp++) { - cpup = &corep->core_cpus[cp]; - mdb_printf("\t\tCPU %d:\tstatus\t0x%x (%s)\tcpuid" - " = 0x%x\n", cp, cpup->cpu_status, - hwd_stat_decode(cpup->cpu_status), - cpup->cpu_cpuid); - if (v & DUMP_COMP_NAME) - mdb_printf("\t\t\tcomponent name:%s\n", - cpup->cpu_component_name); - } - } -} - -/* ARGSUSED */ -static void -dumppcihwd(hwd_pci_ch_t *pcip, int ch, int v, int mv) -{ - int lf; - hwd_leaf_t *leafp; - - mdb_printf("\nPCI CH %d:\tstatus\t0x%x (%s)\n", - ch, pcip->pci_status, hwd_stat_decode(pcip->pci_status)); - - for (lf = 0; lf < HWD_LEAVES_PER_PCI_CHANNEL; lf++) { - leafp = &pcip->pci_leaf[lf]; - - if (DONT_BOTHER(leafp->leaf_status, mv)) { - mdb_printf("\tleaf %d:\tstatus\t0x%x (%s)\n", - lf, leafp->leaf_status, - hwd_stat_decode(leafp->leaf_status)); - continue; - } - mdb_printf("\tleaf %d:\tstatus\t0x%x (%s)\tportid 0x%x", - lf, leafp->leaf_status, - hwd_stat_decode(leafp->leaf_status), leafp->leaf_port_id); - mdb_printf("\ttype0x%x\n)", - leafp->leaf_slot_type); - mdb_printf("\t\t\tOffset\t\tSize\n"); - mdb_printf("\t\tcfgio\t0x%llx\t0x%llx\t\t%x\n", - leafp->leaf_cfgio_offset, - leafp->leaf_cfgio_size); - mdb_printf("\t\tmem32\t0x%llx\t0x%llx\t\t%x\n", - leafp->leaf_mem32_offset, - leafp->leaf_mem32_size); - mdb_printf("\t\tmem64\t0x%llx\t0x%llx\t\t%x\n", - leafp->leaf_mem64_offset, - leafp->leaf_mem64_size); - } -} - -/* ARGSUSED */ -static void -dumpahwd(int bd, int v) -{ - opl_board_cfg_t boardcfg; - hwd_header_t hwd_hdr; - hwd_sb_status_t hwd_sb_status; - hwd_domain_info_t hwd_dinfo; - hwd_sb_t hwd_sb; - caddr_t statusp, dinfop, sbp = NULL; - - /* A flag for whether or not to dump stuff that is missing */ - int mv = 0; - - if (v & DUMP_MISSING) - mv = 1; - - bzero(&boardcfg, sizeof (opl_board_cfg_t)); - bzero(&hwd_hdr, sizeof (hwd_header_t)); - bzero(&hwd_sb_status, sizeof (hwd_sb_status_t)); - bzero(&hwd_dinfo, sizeof (hwd_domain_info_t)); - bzero(&hwd_sb, sizeof (hwd_sb_t)); - - - if (mdb_vread(&boardcfg, sizeof (opl_board_cfg_t), - tmptr + (bd * sizeof (opl_board_cfg_t))) == -1) { - mdb_warn("failed to read opl_board_cfg at %p", - (tmptr + (bd * sizeof (opl_board_cfg_t)))); - return; - } - - if (boardcfg.cfg_hwd == NULL) { - mdb_printf("Board %d has no HWD info\n", bd); - return; - } - - mdb_printf("Board %d:\thwd pointer\t%8llx\n", bd, boardcfg.cfg_hwd); - - /* We always need the header, for offsets */ - if (mdb_vread(&hwd_hdr, sizeof (hwd_header_t), - (uintptr_t)boardcfg.cfg_hwd) == -1) { - mdb_warn("failed to read hwd_header_t at %p\n", - boardcfg.cfg_hwd); - return; - } - - /* Figure out the inside pointers, in case we need them... */ - statusp = (caddr_t)boardcfg.cfg_hwd + hwd_hdr.hdr_sb_status_offset; - dinfop = (caddr_t)boardcfg.cfg_hwd + hwd_hdr.hdr_domain_info_offset; - sbp = (caddr_t)boardcfg.cfg_hwd + hwd_hdr.hdr_sb_info_offset; - - /* The sb data is what we will surely be dumping */ - if (mdb_vread(&hwd_sb, sizeof (hwd_sb_t), (uintptr_t)sbp) == -1) { - mdb_warn("failed to read hwd_sb_t at %p\n", sbp); - return; - } - - if (v & DUMP_HDR) { - /* Print the interesting stuff from the header */ - mdb_printf("\t\tversion\t%x.%x\tDID\t%x\tmagic\t0x%x\n\n", - hwd_hdr.hdr_version.major, hwd_hdr.hdr_version.minor, - hwd_hdr.hdr_domain_id, hwd_hdr.hdr_magic); - mdb_printf("\tstatus offset = 0x%x\t(addr=%llx)\n", - hwd_hdr.hdr_sb_status_offset, statusp); - mdb_printf("\tdomain offset = 0x%x\t(addr=%llx)\n", - hwd_hdr.hdr_domain_info_offset, dinfop); - mdb_printf("\tboard offset = 0x%x\t(addr=%llx)\n", - hwd_hdr.hdr_sb_info_offset, sbp); - } - - if (v & DUMP_SB_STAT) { - int i; - if (mdb_vread(&hwd_sb_status, sizeof (hwd_sb_status_t), - (uintptr_t)statusp) == -1) { - mdb_warn("failed to read hwd_sb_status_t at %p\n", - statusp); - return; - } - mdb_printf("\nSTATUS:\tBoard\tStatus\n"); - for (i = 0; i < HWD_SBS_PER_DOMAIN; i++) { - if (DONT_BOTHER(hwd_sb_status.sb_status[i], mv)) - continue; - mdb_printf("\t%d\t0x%x (%s)\n", i, - hwd_sb_status.sb_status[i], - hwd_stat_decode(hwd_sb_status.sb_status[i])); - } - } - - /* Domain Info */ - if (v & DUMP_DINFO) { - if (mdb_vread(&hwd_dinfo, sizeof (hwd_domain_info_t), - (uintptr_t)dinfop) == -1) { - mdb_warn("failed to read hwd_domain_info_t at %p\n", - dinfop); - return; - } - mdb_printf("\nDomain info:\tReset reason\t0x%x", - hwd_dinfo.dinf_reset_factor); - mdb_printf("\tHost ID 0x%x\n", hwd_dinfo.dinf_host_id); - mdb_printf("\tSystem freq\t0x%llx\tStick freq\t0x%llx\n", - hwd_dinfo.dinf_system_frequency, - hwd_dinfo.dinf_stick_frequency); - mdb_printf("\tSCF timeout \t0x%x\tModel info\t%x", - hwd_dinfo.dinf_scf_command_timeout, - hwd_dinfo.dinf_model_info); - if (hwd_dinfo.dinf_dr_status == 0) - mdb_printf("\tDR capable\n"); - else - mdb_printf("\tNOT DR capable (%x)\n", - hwd_dinfo.dinf_dr_status); - mdb_printf("\tMAC address\t%02x.%02x.%02x.%02x.%02x.%02x", - hwd_dinfo.dinf_mac_address[0], - hwd_dinfo.dinf_mac_address[1], - hwd_dinfo.dinf_mac_address[2], - hwd_dinfo.dinf_mac_address[3], - hwd_dinfo.dinf_mac_address[4], - hwd_dinfo.dinf_mac_address[5]); - mdb_printf("\tcpu_start_time\t0x%llx\n", - hwd_dinfo.dinf_cpu_start_time); - mdb_printf("\tcfg policy\t%x\tdiag lvl\t%x\tboot mode\t%x\n", - hwd_dinfo.dinf_config_policy, hwd_dinfo.dinf_diag_level, - hwd_dinfo.dinf_boot_mode); - mdb_printf("\tBanner name\t%s\n", - hwd_dinfo.dinf_banner_name); - mdb_printf("\tPlatform token\t%s\n", - hwd_dinfo.dinf_platform_token); - mdb_printf("\tFloating bd bitmap\t%04x\n", - hwd_dinfo.dinf_floating_board_bitmap); - mdb_printf("\tChassis Serial#\t%s\n", - hwd_dinfo.dinf_chassis_sn); - mdb_printf("\tBrand Control\t%d\n", - hwd_dinfo.dinf_brand_control); - - } - - /* SB info */ - if (v & DUMP_SB_INFO) { - mdb_printf("\nBoard:\tstatus =0x%x (%s)\tmode =0x%x (%s)\ - \tPSB =0x%x\n", hwd_sb.sb_status, - hwd_stat_decode(hwd_sb.sb_status), - hwd_sb.sb_mode, (hwd_sb.sb_mode == 0 ? "PSB" : "XSB"), - hwd_sb.sb_psb_number); - } - - /* CMU Chan info */ - if (v & DUMP_CMU_CHAN) { - hwd_cmu_chan_t *cmup; - cmup = &hwd_sb.sb_cmu.cmu_ch; - - mdb_printf("\nCMU CH: status\t0x%x (%s)\tportid=0x%x" - " LSB = 0x%x\n", - cmup->chan_status, hwd_stat_decode(cmup->chan_status), - cmup->chan_portid, ((cmup->chan_portid) >> 4)); - - if (v & DUMP_COMP_NAME) - mdb_printf("\tcomponent name:%s\n", - cmup->chan_component_name); - - /* scf_interface */ - mdb_printf("\tscf:\tstatus\t0x%x (%s)\n", - cmup->chan_scf_interface.scf_status, - hwd_stat_decode(cmup->chan_scf_interface.scf_status)); - if (v & DUMP_COMP_NAME) - mdb_printf("\t\tcomponent name:%s\n", - cmup->chan_scf_interface.scf_component_name); - - /* serial */ - mdb_printf("\tserial:\tstatus\t0x%x (%s)\n", - cmup->chan_serial.tty_status, - hwd_stat_decode(cmup->chan_serial.tty_status)); - if (v & DUMP_COMP_NAME) - mdb_printf("\t\tcomponent name:%s\n", - cmup->chan_serial.tty_component_name); - - /* fmem */ - mdb_printf("\tfmem[0]\tstatus\t0x%x (%s)", - cmup->chan_fmem[0].fmem_status, - hwd_stat_decode(cmup->chan_fmem[0].fmem_status)); - mdb_printf("\tused %x\tversion %x.%x.%x\n", - cmup->chan_fmem[0].fmem_used, - cmup->chan_fmem[0].fmem_version.fver_major, - cmup->chan_fmem[0].fmem_version.fver_minor, - cmup->chan_fmem[0].fmem_version.fver_local); - if (v & DUMP_COMP_NAME) - mdb_printf("\t\tcomponent name:%s\n", - cmup->chan_fmem[0].fmem_component_name); - mdb_printf("\tfmem[1]\tstatus\t0x%x (%s)", - cmup->chan_fmem[1].fmem_status, - hwd_stat_decode(cmup->chan_fmem[1].fmem_status)); - mdb_printf("\tused %x\tversion %x.%x.%x\n", - cmup->chan_fmem[1].fmem_used, - cmup->chan_fmem[1].fmem_version.fver_major, - cmup->chan_fmem[1].fmem_version.fver_minor, - cmup->chan_fmem[1].fmem_version.fver_local); - if (v & DUMP_COMP_NAME) - mdb_printf("\t\tcomponent name:%s\n", - cmup->chan_fmem[1].fmem_component_name); - - } - - /* CMU SC info */ - if (v & DUMP_SCS) { - hwd_sc_t *scp; - int sc; - - for (sc = 0; sc < HWD_SCS_PER_CMU; sc++) { - - scp = &hwd_sb.sb_cmu.cmu_scs[sc]; - - if (DONT_BOTHER(scp->sc_status, mv)) { - mdb_printf("\nSC %d:\tstatus\t0x%x (%s)\n", - sc, scp->sc_status, - hwd_stat_decode(scp->sc_status)); - } else { - mdb_printf("\nSC %d:\tstatus\t0x%x (%s)\t", - sc, scp->sc_status, - hwd_stat_decode(scp->sc_status)); - mdb_printf("register addr\t0x%llx\n", - scp->sc_register_address); - } - } - - } - - if (v & DUMP_MEM) - dumpmemhwd(&hwd_sb.sb_cmu.cmu_memory, v, mv); - - if (v & DUMP_CHIPS) { - int ch; - for (ch = 0; ch < HWD_CPU_CHIPS_PER_CMU; ch++) { - if (MIA(hwd_sb.sb_cmu.cmu_cpu_chips[ch].chip_status)) { - mdb_printf("\nChip %d: status\t0x%x (%s)\n", - ch, - hwd_sb.sb_cmu.cmu_cpu_chips[ch].chip_status, - "MISS"); - continue; - } - dumpchiphwd(&hwd_sb.sb_cmu.cmu_cpu_chips[ch], ch, v, - mv); - } - } - - if (v & DUMP_PCI_CH) { - int ch; - for (ch = 0; ch < HWD_CPU_CHIPS_PER_CMU; ch++) { - if (MIA(hwd_sb.sb_pci_ch[ch].pci_status)) { - mdb_printf("\nPCI CH %d:\tstatus\t0x%x (%s)\n", - ch, hwd_sb.sb_pci_ch[ch].pci_status, - "MISS"); - continue; - } - dumppcihwd(&hwd_sb.sb_pci_ch[ch], ch, v, mv); - } - } -} - -/* - * oplhwd dcmd - Print out the per-board HWD, nicely formatted. - */ -/*ARGSUSED*/ -static int -oplhwd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - int bdi; - uint64_t v_mode = DUMP_HDR; - uint_t obits = 0; - GElf_Sym tmsym; - uint64_t bdo; - - /* - * Either use the board number, or get an arg for it, or - * show all of them. - */ - - if (flags & DCMD_ADDRSPEC) { - bdi = addr; - } else { - bdi = -1; - } - - bdo = bdi; - if (mdb_getopts(argc, argv, - 'a', MDB_OPT_SETBITS, DUMP_FULL, &obits, /* All possible info */ - 'b', MDB_OPT_UINT64, &bdo, /* board number */ - 'd', MDB_OPT_SETBITS, DUMP_DINFO, &obits, /* domain info */ - 's', MDB_OPT_SETBITS, DUMP_SB_STAT, &obits, /* SB status */ - 'i', MDB_OPT_SETBITS, DUMP_SB_INFO, &obits, /* SB info */ - 'c', MDB_OPT_SETBITS, DUMP_CMU_CHAN, &obits, /* CMU chan */ - 'h', MDB_OPT_SETBITS, DUMP_CHIPS, &obits, /* chips */ - 'm', MDB_OPT_SETBITS, DUMP_MEM, &obits, /* memory */ - 'p', MDB_OPT_SETBITS, DUMP_PCI_CH, &obits, /* PCI chans */ - 'k', MDB_OPT_SETBITS, DUMP_MEM_BANKS, &obits, /* banks */ - 'o', MDB_OPT_SETBITS, DUMP_CORES, &obits, /* core details */ - 'r', MDB_OPT_SETBITS, DUMP_SCS, &obits, /* SC info */ - 'C', MDB_OPT_SETBITS, DUMP_COMP_NAME, &obits, /* SC info */ - 'v', MDB_OPT_SETBITS, DUMP_VERBOSE, &obits, /* all of the above */ - NULL) != argc) - return (DCMD_USAGE); - bdi = bdo; - v_mode |= obits; - - if (mdb_lookup_by_obj("opl_cfg", "opl_boards", &tmsym) == -1) { - mdb_warn("unable to reference opl_boards\n"); - return (DCMD_ERR); - } - - tmptr = (uintptr_t)tmsym.st_value; - mdb_printf("Board %d:\tboardcfg \t%8llx\n", 0, tmptr); - - if (bdi < 0) { - /* get active boards */ - for (bdi = 0; bdi < OPL_MAX_BOARDS; bdi++) - dumpahwd(bdi, v_mode); - } else { - dumpahwd(bdi, v_mode); - } - return (DCMD_OK); -} - -/* - * ::oplhwd help - */ -static void -oplhwd_help(void) -{ - mdb_printf("oplhwd will dump HWD only for a particular board" - " on which,"); - mdb_printf("an earlier DR operation has been executed.\n"); - mdb_printf("-b NUM \tlist oplhwd entry for a board\n" - "-s \t\tlist oplhwd entry with SB status\n" - "-d \t\tlist oplhwd entry with Domain info.\n" - "-i \t\tlist oplhwd entry with SB info.\n" - "-h \t\tlist oplhwd entry with Chips details\n" - "-o \t\tlist oplhwd entry with Core details\n" - "-m \t\tlist oplhwd entry with Memory info.\n" - "-k \t\tlist oplhwd entry with Memory Bank info.\n" - "-r \t\tlist oplhwd entry with SC info.\n" - "-c \t\tlist oplhwd entry with CMU channels\n" - "-p \t\tlist oplhwd entry with PCI channels\n" - "-a \t\tlist oplhwd entry with all possible info.\n" - "-C \t\tlist oplhwd entry with component names\n" - "-v \t\tlist oplhwd entry in verbose mode\n"); -} - -/* - * MDB module linkage information: - * - * We declare a list of structures describing our dcmds, and a function - * named _mdb_init to return a pointer to our module information. - */ - -static const mdb_dcmd_t dcmds[] = { - { "oplhwd", "?[ -b NUM ] [ -sdihomkrcp ] [ -a ] [ -C ] [ -v ]", - "dump hardware descriptor for SUNW,SPARC-Enterprise", - oplhwd, oplhwd_help }, - { NULL } -}; - -static const mdb_modinfo_t modinfo = { - MDB_API_VERSION, dcmds, NULL -}; - -const mdb_modinfo_t * -_mdb_init(void) -{ - return (&modinfo); -} diff --git a/usr/src/cmd/mdb/sun4u/modules/opl/oplhwd/v9/Makefile b/usr/src/cmd/mdb/sun4u/modules/opl/oplhwd/v9/Makefile deleted file mode 100644 index 61be014f1e..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/opl/oplhwd/v9/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = oplhwd.so -MDBTGT = kvm - -MODSRCS = oplhwd.c - -include $(SRC)/cmd/Makefile.cmd -include $(SRC)/cmd/Makefile.cmd.64 -include $(SRC)/cmd/mdb/sparc/Makefile.sparcv9 -include $(SRC)/cmd/mdb/sun4u/Makefile.sun4u -include $(SRC)/cmd/mdb/Makefile.module - -CPPFLAGS += -DMP -D_MACHDEP -CPPFLAGS += -I../../../../../../../../src/cmd/mdb/common -CPPFLAGS += -I$(SRC)/uts/sun4u -CPPFLAGS += -I$(SRC)/uts/sun4 -CPPFLAGS += -I$(SRC)/uts/sfmmu -CPPFLAGS += -I$(SRC)/uts/sparc/v9 -CPPFLAGS += -I$(SRC)/uts/sun4u/opl diff --git a/usr/src/cmd/mdb/sun4u/modules/serengeti/Makefile b/usr/src/cmd/mdb/sun4u/modules/serengeti/Makefile deleted file mode 100644 index 49aee4899c..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/serengeti/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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" - -SUBDIRS = sgsbbc -include $(SRC)/cmd/mdb/Makefile.subdirs diff --git a/usr/src/cmd/mdb/sun4u/modules/serengeti/sgsbbc/Makefile b/usr/src/cmd/mdb/sun4u/modules/serengeti/sgsbbc/Makefile deleted file mode 100644 index b4b2522746..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/serengeti/sgsbbc/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# ident "%Z%%M% %I% %E% SMI" -# - -SUBDIRS = v9 -include $(SRC)/cmd/mdb/Makefile.subdirs diff --git a/usr/src/cmd/mdb/sun4u/modules/serengeti/sgsbbc/sgsbbc.c b/usr/src/cmd/mdb/sun4u/modules/serengeti/sgsbbc/sgsbbc.c deleted file mode 100644 index de6f69b112..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/serengeti/sgsbbc/sgsbbc.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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" - -#include <sys/mutex.h> -#include <sys/mdb_modapi.h> -#include <sys/sgsbbc_priv.h> - -/* - * Given the address of a soft state pointer for the SGSBBC driver, - * this function displays the values of selected fields. - * - * You have to specify the address of the soft state structure you - * want to decode. This dcmd does not automatically work that out - * for you. The contents of <sbbcp> points to the variable pointing - * to the soft state pointers. - * - * (ie. typing "**sbbcp/10J" at the mdb prompt will list the addresses - * of the first 10 soft state structures (if they exist). - * - * It can also be obtained using mdb's softstate dcmd. - * "*sbbcp::softstate 0 | ::sgsbbc_softstate" - */ -/* ARGSUSED */ -int -display_sbbc_softstate_t(uintptr_t addr, uint_t flags, int argc, - const mdb_arg_t *argv) -{ - sbbc_softstate_t softp; - - uint_t offset = 0; /* offset into soft state structure */ - int rv; /* return value from mdb function */ - - /* - * You have to specify the address of the soft state structure you - * want to decode. This dcmd does not automatically work that out. - */ - if ((flags & DCMD_ADDRSPEC) == 0) - return (DCMD_ERR); - - rv = mdb_vread(&softp, sizeof (sbbc_softstate_t), addr); - if (rv != sizeof (sbbc_softstate_t)) { - mdb_warn("sgsbbc soft_state: Failed read on %ll#r", addr); - return (DCMD_ERR); - } - - mdb_printf("---------- sbbc_softstate_t @ %#lr ----------\n", addr); - - offset = (int)(uintptr_t)&softp.dip - (int)(uintptr_t)&softp; - mdb_printf("%p: dip: %31ll#r\n", addr + offset, softp.dip); - - offset = (int)(uintptr_t)&softp.sram - (int)(uintptr_t)&softp; - mdb_printf("%p: sram: %30ll#r\n", addr + offset, softp.sram); - - offset = (int)(uintptr_t)&softp.sbbc_regs - (int)(uintptr_t)&softp; - mdb_printf("%p: sbbc_regs: %25ll#r\n", addr + offset, softp.sbbc_regs); - - offset = (int)(uintptr_t)&softp.port_int_regs - (int)(uintptr_t)&softp; - mdb_printf("%p: port_int_regs: %21ll#r\n", addr + offset, - softp.port_int_regs); - - offset = (int)(uintptr_t)&softp.epld_regs - (int)(uintptr_t)&softp; - mdb_printf("%p: epld_regs: %25p\n", addr + offset, softp.epld_regs); - - offset = (int)(uintptr_t)&softp.sram_toc - (int)(uintptr_t)&softp; - mdb_printf("%p: sram_toc: %26d\n", addr + offset, softp.sram_toc); - - offset = (int)(uintptr_t)&softp.sbbc_reg_handle1 - - (int)(uintptr_t)&softp; - mdb_printf("%p: sbbc_reg_handle1: %18ll#r\n", addr + offset, - softp.sbbc_reg_handle1); - - offset = (int)(uintptr_t)&softp.sbbc_reg_handle2 - - (int)(uintptr_t)&softp; - mdb_printf("%p: sbbc_reg_handle2: %18ll#r\n", addr + offset, - softp.sbbc_reg_handle2); - - offset = (int)(uintptr_t)&softp.inumber - (int)(uintptr_t)&softp; - mdb_printf("%p: inumber: %27ll#r\n", addr + offset, softp.inumber); - - offset = (int)(uintptr_t)&softp.intr_hdlrs - (int)(uintptr_t)&softp; - mdb_printf("%p: intr_hdlrs: %24ll#r\n", addr + offset, - softp.intr_hdlrs); - - offset = (int)(uintptr_t)&softp.suspended - (int)(uintptr_t)&softp; - mdb_printf("%p: suspended: %25ll#r\n", addr + offset, softp.suspended); - - offset = (int)(uintptr_t)&softp.chosen - (int)(uintptr_t)&softp; - mdb_printf("%p: chosen: %28ll#r\n", addr + offset, softp.chosen); - - return (DCMD_OK); -} - -/* - * MDB module linkage information: - */ - -static const mdb_dcmd_t dcmds[] = {{ - "sgsbbc_softstate", - NULL, - "print SGSBBC mailbox driver softstate fields", - display_sbbc_softstate_t - }, { NULL } -}; - -static const mdb_modinfo_t modinfo = { - MDB_API_VERSION, dcmds, NULL -}; - -const mdb_modinfo_t * -_mdb_init(void) -{ - return (&modinfo); -} diff --git a/usr/src/cmd/mdb/sun4u/modules/serengeti/sgsbbc/v9/Makefile b/usr/src/cmd/mdb/sun4u/modules/serengeti/sgsbbc/v9/Makefile deleted file mode 100644 index 4e3cdee751..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/serengeti/sgsbbc/v9/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -MODULE = sgsbbc.so -MDBTGT = kvm - -MODSRCS = sgsbbc.c - -include $(SRC)/cmd/Makefile.cmd -include $(SRC)/cmd/Makefile.cmd.64 -include $(SRC)/cmd/mdb/sparc/Makefile.sparcv9 -include $(SRC)/cmd/mdb/sun4u/Makefile.sun4u -include $(SRC)/cmd/mdb/Makefile.module - -CPPFLAGS += -DMP -D_MACHDEP -CPPFLAGS += -I../../../../../../../../src/cmd/mdb/common -CPPFLAGS += -I$(SRC)/uts/sun4u -CPPFLAGS += -I$(SRC)/uts/sfmmu -CPPFLAGS += -I$(SRC)/uts/sparc/v9 -CPPFLAGS += -I$(SRC)/uts/sun4u/serengeti diff --git a/usr/src/cmd/mdb/sun4u/modules/unix/Makefile b/usr/src/cmd/mdb/sun4u/modules/unix/Makefile deleted file mode 100644 index e5ebf16e3c..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/unix/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 1997-1999,2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" - -SUBDIRS = v9 -include ../../../Makefile.subdirs diff --git a/usr/src/cmd/mdb/sun4u/modules/unix/sfmmu.c b/usr/src/cmd/mdb/sun4u/modules/unix/sfmmu.c deleted file mode 100644 index ce4a1035f1..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/unix/sfmmu.c +++ /dev/null @@ -1,687 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <sys/types.h> -#include <sys/machparam.h> -#include <vm/as.h> -#include <vm/hat_sfmmu.h> - -#include <mdb/mdb_modapi.h> -#include <mdb/mdb_target.h> -#include <mdb/mdb_ctf.h> - -/* - * sfmmu mdb support - */ - -#define SFMMU_VTOP_DBG_SYMBOL 1 -#define SFMMU_VTOP_DBG_VERBOSE 2 -#define SFMMU_VTOP_DBG_DEBUG 4 -#define SFMMU_VTOP_DBG_ALL (SFMMU_VTOP_DBG_SYMBOL|SFMMU_VTOP_DBG_VERBOSE|\ - SFMMU_VTOP_DBG_DEBUG) - -#define SFMMU_VTOP_DBG_SYM if (sfmmu_vtop_dbg & SFMMU_VTOP_DBG_SYMBOL) \ - mdb_printf -#define SFMMU_VTOP_DBG_VRB if (sfmmu_vtop_dbg & SFMMU_VTOP_DBG_VERBOSE) \ - mdb_printf -#define SFMMU_VTOP_DBG_DBG if (sfmmu_vtop_dbg & SFMMU_VTOP_DBG_DEBUG) \ - mdb_printf - -#define SFMMU_VTOP_READSYM(dest, synm, where) \ - if (mdb_readsym(&(dest), sizeof (dest), (synm)) == -1) \ - mdb_warn("%s: couldn't find or read '%s'\n", (where), (synm)); - -struct hme_blks_max { - struct hme_blk hmx_hmeblk; - struct sf_hment hmx_hmes[NHMENTS - 1]; -}; - -int sfmmu_vtop(uintptr_t, uint_t, int, const mdb_arg_t *); -static int sfmmu_vtop_common(struct as *, uintptr_t, physaddr_t *); -static int sfmmu_vtop_impl(uintptr_t, sfmmu_t *, sfmmu_t *, physaddr_t *); -static void sfmmu_vtop_print_hmeblk(struct hme_blk *); -static struct sf_hment *mdb_sfmmu_hblktohme(struct hme_blk *, caddr_t, int *); - -int sfmmu_vtop_dbg_wanted = 0; /* set this as desired */ -int sfmmu_vtop_dbg = 0; - -/* - * ::sfmmu_vtop [[-v] -a as] - * Extended version of the vtop builtin. The optional <as> argument is - * used as base address space for translating a virtual address into a - * physical address. The verbose option ("-v") shows intermediate - * translation steps. If <as> or kas is ommitted, the builtin ::vtop - * dcmd is called. - */ -int -sfmmu_vtop(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - int ret; - struct as *asp = NULL; - char *asnmp = NULL; - int verbose = 0; - physaddr_t paddr; - - sfmmu_vtop_dbg = sfmmu_vtop_dbg_wanted; - - if (mdb_getopts(argc, argv, - 'v', MDB_OPT_SETBITS, TRUE, &verbose, - 'a', MDB_OPT_STR, &asnmp, - NULL) != argc) - return (DCMD_USAGE); - - if (verbose != 0 && asnmp == NULL) { - mdb_warn("-v requires -a option\n"); - return (DCMD_USAGE); - } - - if (verbose != 0 && (sfmmu_vtop_dbg & SFMMU_VTOP_DBG_VERBOSE) == 0) { - sfmmu_vtop_dbg |= SFMMU_VTOP_DBG_VERBOSE; - } - - if (asnmp != NULL) { - GElf_Sym sym; - - SFMMU_VTOP_DBG_DBG("asnmp=%p asnm=%s\n", asnmp, asnmp); - if (strcmp(asnmp, "kas") == 0) { - if (mdb_lookup_by_name("kas", &sym) == -1) { - mdb_warn("couldn't find 'kas'\n"); - return (DCMD_ERR); - } else { - asp = (struct as *)sym.st_value; - SFMMU_VTOP_DBG_SYM("kas &sym=%p\n", &sym); - } - } else { - asp = (struct as *)mdb_strtoull(asnmp); - } - SFMMU_VTOP_DBG_DBG("asp=0x%p\n", asp); - } - - if (asp == 0) { - SFMMU_VTOP_DBG_DBG("sfmmu_vtop: call standard vtop\n"); - return (mdb_call_dcmd("vtop", addr, flags, argc, argv)); - } - - if ((ret = sfmmu_vtop_common(asp, addr, &paddr)) == -1L) { - mdb_printf("no mapping found for addr=%p\n", addr); - return (DCMD_ERR); - } - - if (ret == 0) { - mdb_printf("address space %p: virtual %lr mapped to physical " - "%llr", asp, addr, paddr); - } else { - return (DCMD_ERR); - } - - return (DCMD_OK); -} - -static int -sfmmu_vtop_common(struct as *asp, uintptr_t addr, physaddr_t *pap) -{ - struct as mas; - struct as *masp = &mas; - sfmmu_t *hatp; - sfmmu_t mhat; - sfmmu_t *mhatp = &mhat; - int ret; - - if (mdb_vread(masp, sizeof (mas), (uintptr_t)asp) == -1) { - mdb_warn("couldn't read as at %p\n", asp); - return (DCMD_ERR); - } - - hatp = masp->a_hat; - - SFMMU_VTOP_DBG_DBG("hatp=%p addr=%p masp=%p\n", hatp, addr, masp); - - if (mdb_vread(mhatp, sizeof (mhat), (uintptr_t)hatp) == -1) { - mdb_warn("couldn't read hat at %p\n", hatp); - return (DCMD_ERR); - } - if (mhatp->sfmmu_as != asp) { - mdb_warn("%p is not a valid address space\n", asp); - return (DCMD_ERR); - } - - ret = sfmmu_vtop_impl(addr, hatp, mhatp, pap); - - return (ret); -} - -static int -sfmmu_vtop_impl(uintptr_t addr, sfmmu_t *sfmmup, sfmmu_t *msfmmup, - physaddr_t *pap) -{ - struct hmehash_bucket *uhme_hash; - struct hmehash_bucket *khme_hash; - int uhmehash_num; - int khmehash_num; - sfmmu_t *ksfmmup; - struct hmehash_bucket mbucket; - struct hmehash_bucket *hmebp; - struct hmehash_bucket *shmebp; - hmeblk_tag hblktag; - int hmeshift; - int hashno = 1; - struct hme_blk *hmeblkp = NULL; - struct hme_blks_max mhmeblkmax; - intptr_t thmeblkp; - struct sf_hment *sfhmep; - int i; - ism_blk_t mism_blk; - ism_map_t *ism_map; - ism_blk_t *ism_blkp; - ism_blk_t *sism_blkp; - sfmmu_t *ism_hatid = NULL; - int sfhmeinx = 0; - tte_t tte; - pfn_t pfn; - pfn_t start_pfn; - page_t *pp; - int ret = -1; - - SFMMU_VTOP_READSYM(uhme_hash, "uhme_hash", "sfmmu_vtop_impl"); - SFMMU_VTOP_DBG_DBG("uhme_hash=%p\t", uhme_hash); - SFMMU_VTOP_READSYM(uhmehash_num, "uhmehash_num", "sfmmu_vtop_impl"); - SFMMU_VTOP_DBG_DBG("uhmehash_num=%lx\n", uhmehash_num); - SFMMU_VTOP_READSYM(khme_hash, "khme_hash", "sfmmu_vtop_impl"); - SFMMU_VTOP_DBG_DBG("khme_hash=%p\t", khme_hash); - SFMMU_VTOP_READSYM(khmehash_num, "khmehash_num", "sfmmu_vtop_impl"); - SFMMU_VTOP_DBG_DBG("khmehash_num=%lx\n", khmehash_num); - SFMMU_VTOP_READSYM(ksfmmup, "ksfmmup", "sfmmu_vtop_impl"); - SFMMU_VTOP_DBG_DBG("ksfmmup=%p\n", ksfmmup); - - ism_blkp = sism_blkp = msfmmup->sfmmu_iblk; - while (ism_blkp != NULL && ism_hatid == NULL) { - SFMMU_VTOP_DBG_DBG("ism_blkp=%p\n", ism_blkp); - if (mdb_vread(&mism_blk, sizeof (mism_blk), - (uintptr_t)ism_blkp) == -1) { - mdb_warn("couldn't read ism_blk at %p\n", ism_blkp); - return (DCMD_ERR); - } - ism_blkp = &mism_blk; - ism_map = ism_blkp->iblk_maps; - for (i = 0; i < ISM_MAP_SLOTS && ism_map[i].imap_ismhat; i++) { - if ((caddr_t)addr >= ism_start(ism_map[i]) && - (caddr_t)addr < ism_end(ism_map[i])) { - sfmmup = ism_hatid = ism_map[i].imap_ismhat; - addr = (caddr_t)addr - ism_start(ism_map[i]); - SFMMU_VTOP_DBG_VRB("ism_blkp=%p inx=%d\n", - sism_blkp, i); - SFMMU_VTOP_DBG_DBG("ism map=%p ism hat=%p " - "addr=%llx\n", - (caddr_t)&ism_map[i] - (caddr_t)ism_blkp - + (caddr_t)sism_blkp, sfmmup, addr); - break; - } - } - ism_blkp = sism_blkp = ism_blkp->iblk_next; - } - - hblktag.htag_id = sfmmup; - do { - SFMMU_VTOP_DBG_DBG("-hashno=%d-\n", hashno); - hmeshift = HME_HASH_SHIFT(hashno); - SFMMU_VTOP_DBG_DBG("hmeshift=%d\n", hmeshift); - hblktag.htag_bspage = HME_HASH_BSPAGE(addr, hmeshift); - hblktag.htag_rehash = hashno; - -#ifdef __sparcv9 - SFMMU_VTOP_DBG_DBG("hblktag=%lx %lx\n", - (uint64_t)hblktag.htag_tag[0], - (uint64_t)hblktag.htag_tag[1]); -#else - SFMMU_VTOP_DBG_DBG("hblktag=%llx\n", - (uint64_t)hblktag.htag_tag); -#endif - - hmebp = shmebp = HME_HASH_FUNCTION(sfmmup, addr, hmeshift); - SFMMU_VTOP_DBG_DBG("hmebp=%p\n", hmebp); - - if (mdb_vread(&mbucket, sizeof (mbucket), - (uintptr_t)hmebp) == -1) { - mdb_warn("couldn't read mbucket at %p\n", hmebp); - return (DCMD_ERR); - } - - hmebp = &mbucket; - - for (hmeblkp = hmebp->hmeblkp; hmeblkp; - hmeblkp = hmeblkp->hblk_next) { - - SFMMU_VTOP_DBG_DBG("hmeblkp=%p\n", hmeblkp); - - if (hmeblkp == NULL) - break; - - if (mdb_vread(&mhmeblkmax, sizeof (struct hme_blk), - (uintptr_t)hmeblkp) == -1) { - mdb_warn("couldn't read hme_blk at %p\n", - hmeblkp); - return (DCMD_ERR); - } - - thmeblkp = (uintptr_t)hmeblkp; - hmeblkp = &mhmeblkmax.hmx_hmeblk; - - if (HTAGS_EQ(hmeblkp->hblk_tag, hblktag)) { - /* found hme_blk */ - break; - } - } - - if (hmeblkp != NULL) { - sfmmu_vtop_print_hmeblk(hmeblkp); - - sfhmep = mdb_sfmmu_hblktohme(hmeblkp, (caddr_t)addr, - &sfhmeinx); - - SFMMU_VTOP_DBG_DBG("sfhmeinx=%d ", sfhmeinx); - - if (sfhmeinx > 0) { - thmeblkp += sizeof (struct hme_blk) + - sizeof (struct sf_hment) * (sfhmeinx - 1); - - if (mdb_vread(sfhmep, sizeof (struct sf_hment), - thmeblkp) == -1) { - mdb_warn("couldn't read msfhme at %p\n", - sfhmep); - return (DCMD_ERR); - } - } - - SFMMU_VTOP_DBG_VRB("sfmmup=%p hmebp=%p hmeblkp=%p\n", - sfmmup, shmebp, thmeblkp); - - tte = sfhmep->hme_tte; - SFMMU_VTOP_DBG_VRB("tte=%llx ", tte.ll); - if (TTE_IS_VALID(&tte)) { - start_pfn = TTE_TO_TTEPFN(&tte); - *pap = (start_pfn << MMU_PAGESHIFT) + - (addr & TTE_PAGE_OFFSET(tte.tte_size)); - pfn = *pap >> MMU_PAGESHIFT; - pp = (sfhmep->hme_page != 0) ? - sfhmep->hme_page + (pfn - start_pfn) : 0; - SFMMU_VTOP_DBG_VRB("pfn=%lx pp=%p\n", pfn, pp); - ret = 0; - } - break; - } - - hashno++; - - } while (HME_REHASH(msfmmup) && (hashno <= MAX_HASHCNT)); - - return (ret); -} - -static void -sfmmu_vtop_print_hmeblk(struct hme_blk *hmeblkp) -{ - - if ((sfmmu_vtop_dbg & SFMMU_VTOP_DBG_DEBUG) == 0) - return; - - mdb_printf(" hblk_nextpa=%llx\n", hmeblkp->hblk_nextpa); -#ifdef __sparcv9 - mdb_printf(" hblktag=%lx %lx\n", hmeblkp->hblk_tag.htag_tag[0], - hmeblkp->hblk_tag.htag_tag[1]); -#else - mdb_printf(" hblktag=%llx\n", hmeblkp->hblk_tag.htag_tag); -#endif - mdb_printf(" hblk_next=%p\n", hmeblkp->hblk_next); - mdb_printf(" hblk_shadow=%p\n", hmeblkp->hblk_shadow); - mdb_printf(" hblk_span=%d\n", hmeblkp->hblk_span); - mdb_printf(" hblk_ttesz=%d\n", hmeblkp->hblk_ttesz); - if (hmeblkp->hblk_shw_bit == 0) { - mdb_printf(" hblk_hmecnt=%d\n", hmeblkp->hblk_hmecnt); - mdb_printf(" hblk_vcnt=%d\n", hmeblkp->hblk_vcnt); - } else { - mdb_printf(" hblk_shw_mask=%x\n", hmeblkp->hblk_shw_mask); - } -} - -static struct sf_hment * -mdb_sfmmu_hblktohme(struct hme_blk *hmeblkp, caddr_t addr, int *hmenump) -{ - int index = 0; - - if (get_hblk_ttesz(hmeblkp) == TTE8K) { - index = (((uintptr_t)addr >> MMU_PAGESHIFT) & (NHMENTS-1)); - } - - if (hmenump) { - *hmenump = index; - } - - return (&hmeblkp->hblk_hme[index]); -} - -/* - * ::memseg_list dcmd - */ -/*ARGSUSED*/ -int -memseg_list(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - struct memseg ms; - - if (!(flags & DCMD_ADDRSPEC)) { - if (mdb_pwalk_dcmd("memseg", "memseg_list", - 0, NULL, 0) == -1) { - mdb_warn("can't walk memseg"); - return (DCMD_ERR); - } - return (DCMD_OK); - } - - if (DCMD_HDRSPEC(flags)) - mdb_printf("%<u>%?s %?s %?s %?s %?s%</u>\n", "ADDR", - "PAGES", "EPAGES", "BASE", "END"); - - if (mdb_vread(&ms, sizeof (struct memseg), addr) == -1) { - mdb_warn("can't read memseg at %#lx", addr); - return (DCMD_ERR); - } - - mdb_printf("%0?lx %0?lx %0?lx %0?lx %0?lx\n", addr, - ms.pages, ms.epages, ms.pages_base, ms.pages_end); - - return (DCMD_OK); -} - -/* - * walk the memseg structures - */ -int -memseg_walk_init(mdb_walk_state_t *wsp) -{ - if (wsp->walk_addr != (uintptr_t)NULL) { - mdb_warn("memseg only supports global walks\n"); - return (WALK_ERR); - } - - if (mdb_readvar(&wsp->walk_addr, "memsegs") == -1) { - mdb_warn("symbol 'memsegs' not found"); - return (WALK_ERR); - } - - wsp->walk_data = mdb_alloc(sizeof (struct memseg), UM_SLEEP); - return (WALK_NEXT); - -} - -int -memseg_walk_step(mdb_walk_state_t *wsp) -{ - int status; - - if (wsp->walk_addr == 0) { - return (WALK_DONE); - } - - if (mdb_vread(wsp->walk_data, sizeof (struct memseg), - wsp->walk_addr) == -1) { - mdb_warn("failed to read struct memseg at %p", wsp->walk_addr); - return (WALK_DONE); - } - - status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data, - wsp->walk_cbdata); - - wsp->walk_addr = (uintptr_t)(((struct memseg *)wsp->walk_data)->next); - - return (status); -} - -void -memseg_walk_fini(mdb_walk_state_t *wsp) -{ - mdb_free(wsp->walk_data, sizeof (struct memseg)); -} - -int -platform_vtop(uintptr_t addr, struct as *asp, physaddr_t *pap) -{ - int rv; - - sfmmu_vtop_dbg = sfmmu_vtop_dbg_wanted; - - SFMMU_VTOP_DBG_DBG("platform_vtop: called.\n"); - - if (asp == NULL) { - return (DCMD_ERR); - } - - if ((rv = sfmmu_vtop_common(asp, addr, pap)) == 0) { - mdb_printf("address space %p: ", asp); - } - - return (rv); -} - -/* - * ::tsbinfo help - */ -void -tsbinfo_help(void) -{ - mdb_printf("-l\tlist valid TSB entries.\n" - "-a\tlist all TSB entries. Can only be used with -l.\n"); -} - -/* - * ::tsbinfo dcmd - */ -int -tsbinfo_list(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - uint_t lflag = 0, aflag = 0; - struct tsb_info tsbinfo; - unsigned int entries = 0; - struct tsbe *tsbp, *tsbend, *tsbstart; - caddr_t va; - uintptr_t pa; - uint_t tsbbytes; - char tsbsize[16]; -#define FLAGS_SIZE sizeof ("RELOC,FLUSH,SWAPPED") - char tsbflags[FLAGS_SIZE + 1]; - - static const mdb_bitmask_t ttesz_mask_bits[] = { - { "8K", TSB8K, TSB8K }, - { "64K", TSB64K, TSB64K }, - { "512K", TSB512K, TSB512K }, - { "4M", TSB4M, TSB4M }, - { "32M", TSB32M, TSB32M }, - { "256M", TSB256M, TSB256M }, - { NULL, 0, 0 } - }; - - static const mdb_bitmask_t flags_bits[] = { - { "RELOC", TSB_RELOC_FLAG, TSB_RELOC_FLAG }, - { "FLUSH", TSB_FLUSH_NEEDED, TSB_FLUSH_NEEDED }, - { "SWAPPED", TSB_SWAPPED, TSB_SWAPPED }, - { NULL, 0, 0 } - }; - - if (!(flags & DCMD_ADDRSPEC)) { - return (DCMD_USAGE); - } - - if (mdb_getopts(argc, argv, - 'l', MDB_OPT_SETBITS, TRUE, &lflag, - 'a', MDB_OPT_SETBITS, TRUE, &aflag, - NULL) != argc) { - return (DCMD_USAGE); - } - - /* -a only valid with -l */ - if (aflag && !lflag) { - return (DCMD_USAGE); - } - - /* Print header? */ - if (DCMD_HDRSPEC(flags) || lflag) { - mdb_printf("%<u>%-?s %-?s %-8s %-*s %s%</u>\n", "TSBINFO", - "TSB", "SIZE", FLAGS_SIZE, "FLAGS", "TTE SIZES"); - } - - if (mdb_vread(&tsbinfo, sizeof (struct tsb_info), addr) == -1) { - mdb_warn("failed to read struct tsb_info at %p", addr); - return (DCMD_ERR); - } - - mdb_printf("%0?lx ", addr); - - /* Print a "-" if the TSB is swapped out. */ - if ((tsbinfo.tsb_flags & TSB_SWAPPED) == 0) { - mdb_printf("%0?lx ", tsbinfo.tsb_va); - } else { - mdb_printf("%0?-s ", "-"); - } - - tsbbytes = TSB_BYTES(tsbinfo.tsb_szc); - -#define KB 1024 -#define MB (KB*KB) - if (tsbbytes >= MB) { - mdb_snprintf(tsbsize, sizeof (tsbsize), "%dM", tsbbytes / MB); - } else { - mdb_snprintf(tsbsize, sizeof (tsbsize), "%dK", tsbbytes / KB); - } -#undef MB -#undef KB - mdb_printf("%-8s ", tsbsize); - - if (tsbinfo.tsb_flags == 0) { - mdb_printf("%-*s ", FLAGS_SIZE, "-"); - } else { - mdb_snprintf(tsbflags, sizeof (tsbflags), "%b", - tsbinfo.tsb_flags, flags_bits); - mdb_printf("%-*s ", FLAGS_SIZE, tsbflags); - } - - mdb_printf("%b\n", tsbinfo.tsb_ttesz_mask, ttesz_mask_bits); - - /* Print TSB entries? */ - if (lflag) { - - if ((tsbinfo.tsb_flags & TSB_SWAPPED) == 0) { - - entries = TSB_ENTRIES(tsbinfo.tsb_szc); - - tsbp = mdb_alloc(sizeof (struct tsbe) * entries, - UM_SLEEP); - - if (mdb_vread(tsbp, sizeof (struct tsbe) * entries, - (uintptr_t)tsbinfo.tsb_va) == -1) { - mdb_warn("failed to read TSB at %p", - tsbinfo.tsb_va); - return (DCMD_ERR); - } - - mdb_printf( - "TSB @ %lx (%d entries)\n" - "%-?s %-17s %s\n" - "%<u>%-?s %1s %1s %-11s " - "%1s %1s %1s %1s %1s %1s %8s " - "%1s %1s %1s %1s %1s %1s %1s " - "%1s %1s %1s %1s %1s %1s%</u>\n", - tsbinfo.tsb_va, entries, "", "TAG", "TTE", - "ADDR", "I", "L", "VA 63:22", - "V", "S", "N", "I", "H", "S", "PA 42:13", - "N", "U", "R", "W", "E", "X", "L", - "P", "V", "E", "P", "W", "G"); - - tsbend = tsbp + entries; - for (tsbstart = tsbp; tsbp < tsbend; tsbp++) { - if (aflag || - (tsbp->tte_tag.tag_invalid == 0)) { - - va = (caddr_t) - (((uint64_t)tsbp->tte_tag.tag_vahi - << 32) + - tsbp->tte_tag.tag_valo); - pa = (tsbp->tte_data.tte_pahi << 19) + - tsbp->tte_data.tte_palo; - mdb_printf("%0?lx %-1u %-1u %011lx " - "%1u %-1u %-1u %-1u %-1u %1u %08x " - "%1u %1u %1u %1u %1u %1u %1u " - "%1u %1u %1u %1u %1u %1u\n", - tsbinfo.tsb_va + (tsbp - tsbstart) - * sizeof (struct tsbe), - tsbp->tte_tag.tag_invalid, - tsbp->tte_tag.tag_locked, va, - tsbp->tte_data.tte_val, - tsbp->tte_data.tte_size, - tsbp->tte_data.tte_nfo, - tsbp->tte_data.tte_ie, - tsbp->tte_data.tte_hmenum, -#ifdef sun4v - 0, -#else - tsbp->tte_data.tte_size2, -#endif - pa, - tsbp->tte_data.tte_no_sync, - tsbp->tte_data.tte_suspend, - tsbp->tte_data.tte_ref, - tsbp->tte_data.tte_wr_perm, -#ifdef sun4v - 0, -#else - tsbp->tte_data.tte_exec_synth, -#endif - tsbp->tte_data.tte_exec_perm, - tsbp->tte_data.tte_lock, - tsbp->tte_data.tte_cp, - tsbp->tte_data.tte_cv, - tsbp->tte_data.tte_se, - tsbp->tte_data.tte_priv, - tsbp->tte_data.tte_hwwr, -#ifdef sun4v - 0 -#else - tsbp->tte_data.tte_glb -#endif - /*CSTYLED*/ - ); - } - } - - mdb_printf("\n"); /* blank line for readability */ - - mdb_free(tsbstart, sizeof (struct tsbe) * entries); - - } else { - - mdb_printf("TSB swapped out\n"); - } - } - - return (DCMD_OK); -} diff --git a/usr/src/cmd/mdb/sun4u/modules/unix/sfmmu.h b/usr/src/cmd/mdb/sun4u/modules/unix/sfmmu.h deleted file mode 100644 index 54a810d838..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/unix/sfmmu.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SFMMU_H -#define _SFMMU_H - -#ifdef __cplusplus -extern "C" { -#endif - -extern int sfmmu_vtop(uintptr_t addr, uint_t flags, int argc, - const mdb_arg_t *argv); - -extern int memseg_list(uintptr_t addr, uint_t flags, int argc, - const mdb_arg_t *argv); - -extern int memseg_walk_init(mdb_walk_state_t *); -extern int memseg_walk_step(mdb_walk_state_t *); -extern void memseg_walk_fini(mdb_walk_state_t *); - -extern void tsbinfo_help(void); -extern int tsbinfo_list(uintptr_t, uint_t, int, const mdb_arg_t *); - -#ifdef __cplusplus -} -#endif - -#endif /* _SFMMU_H */ diff --git a/usr/src/cmd/mdb/sun4u/modules/unix/unix.c b/usr/src/cmd/mdb/sun4u/modules/unix/unix.c deleted file mode 100644 index e43449f9db..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/unix/unix.c +++ /dev/null @@ -1,1637 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <sys/types.h> - -#ifndef DEBUG -#define DEBUG -#define _SYS_DEBUG_H -#include <sys/xc_impl.h> -#undef DEBUG -#else -#define _SYS_DEBUG_H -#include <sys/xc_impl.h> -#endif - -#include <sys/traptrace.h> -#include <sys/machparam.h> -#include <sys/intreg.h> -#include <sys/ivintr.h> -#include <sys/mutex_impl.h> - -#include <mdb/mdb_modapi.h> -#include <mdb/mdb_ctf.h> -#include <mdb/mdb_whatis.h> -#include "sfmmu.h" - -#ifndef SYSTRAP_TT -#define SYSTRAP_TT 0x1300 -#endif - -typedef struct trap_trace_fullrec { - struct trap_trace_record ttf_rec; - int ttf_cpu; -} trap_trace_fullrec_t; - -#ifdef sun4v -typedef struct htrap_trace_fullrec { - struct htrap_trace_record ttf_rec; - int ttf_cpu; -} htrap_trace_fullrec_t; -#endif - -/* - * These strings and accompanying macros allow our string table to look - * just like the real table in trap_table.s. - */ - -static const char NOT[] = "reserved"; /* common reserved string */ -static const char BAD[] = "unused"; /* common unused string */ - -#define NOT4 NOT, NOT, NOT, NOT -#define BAD4 BAD, BAD, BAD, BAD - -static const char *const ttdescr[] = { - NOT, /* 000 reserved */ - "power-on", /* 001 power on reset */ - "watchdog", /* 002 watchdog reset */ - "xir", /* 003 externally initiated reset */ - "sir", /* 004 software initiated reset */ - "red", /* 005 red mode exception */ - NOT, NOT, /* 006 - 007 reserved */ - "immu-xcp", /* 008 instruction access exception */ - "immu-miss", /* 009 instruction access MMU miss */ - "immu-err", /* 00A instruction access error */ - NOT, NOT4, /* 00B - 00F reserved */ - "ill-inst", /* 010 illegal instruction */ - "priv-inst", /* 011 privileged opcode */ - "unimp-ldd", /* 012 unimplemented LDD */ - "unimp-std", /* 013 unimplemented STD */ - NOT4, NOT4, NOT4, /* 014 - 01F reserved */ - "fp-disable", /* 020 fp disabled */ - "fp-ieee754", /* 021 fp exception ieee 754 */ - "fp-xcp-other", /* 022 fp exception other */ - "tag-oflow", /* 023 tag overflow */ - "cleanwin", /* 024 clean window */ - "cleanwin", /* 025 clean window */ - "cleanwin", /* 026 clean window */ - "cleanwin", /* 027 clean window */ - "div-zero", /* 028 division by zero */ - "internal-err", /* 029 internal processor error */ - NOT, NOT, NOT4, /* 02A - 02F reserved */ - "dmmu-xcp", /* 030 data access exception */ - "dmmu-miss", /* 031 data access MMU miss */ - "dmmu-err", /* 032 data access error */ - "dmmu-prot", /* 033 data access protection */ - "unalign", /* 034 mem address not aligned */ - "lddf-unalign", /* 035 LDDF mem address not aligned */ - "stdf-unalign", /* 036 STDF mem address not aligned */ - "priv-act", /* 037 privileged action */ - "ldqf-unalign", /* 038 LDQF mem address not aligned */ - "stqf-unalign", /* 039 STQF mem address not aligned */ - NOT, NOT, NOT4, /* 03A - 03F reserved */ - "async-d-err", /* 040 async data error */ - "level-1", /* 041 interrupt level 1 */ - "level-2", /* 042 interrupt level 2 */ - "level-3", /* 043 interrupt level 3 */ - "level-4", /* 044 interrupt level 4 */ - "level-5", /* 045 interrupt level 5 */ - "level-6", /* 046 interrupt level 6 */ - "level-7", /* 047 interrupt level 7 */ - "level-8", /* 048 interrupt level 8 */ - "level-9", /* 049 interrupt level 9 */ - "level-10", /* 04A interrupt level 10 */ - "level-11", /* 04B interrupt level 11 */ - "level-12", /* 04C interrupt level 12 */ - "level-13", /* 04D interrupt level 13 */ - "level-14", /* 04E interrupt level 14 */ - "level-15", /* 04F interrupt level 15 */ - NOT4, NOT4, NOT4, NOT4, /* 050 - 05F reserved */ - "int-vec", /* 060 interrupt vector */ - "pa-watch", /* 061 PA watchpoint */ - "va-watch", /* 062 VA watchpoint */ - "ecc-err", /* 063 corrected ECC error */ - "itlb-miss", /* 064 instruction access MMU miss */ - "itlb-miss", /* 065 instruction access MMU miss */ - "itlb-miss", /* 066 instruction access MMU miss */ - "itlb-miss", /* 067 instruction access MMU miss */ - "dtlb-miss", /* 068 data access MMU miss */ - "dtlb-miss", /* 069 data access MMU miss */ - "dtlb-miss", /* 06A data access MMU miss */ - "dtlb-miss", /* 06B data access MMU miss */ - "dtlb-prot", /* 06C data access protection */ - "dtlb-prot", /* 06D data access protection */ - "dtlb-prot", /* 06E data access protection */ - "dtlb-prot", /* 06F data access protection */ - "fast-ecc-err", /* 070 fast ecache ECC error */ - "dp-err", /* 071 data cache parity error */ - "ip-err", /* 072 instr cache parity error */ - NOT, NOT4, NOT4, /* 073 - 07B reserved */ -#ifdef sun4v - "cpu-mondo", /* 07C CPU mondo */ - "dev-mondo", /* 07D device mondo */ - "res.-err", /* 07E resumable error */ - "non-res.-err", /* 07F non-resumable error */ -#else - NOT4, /* 07C - 07F reserved */ -#endif - "spill-0-norm", /* 080 spill 0 normal */ - "spill-0-norm", /* 081 spill 0 normal */ - "spill-0-norm", /* 082 spill 0 normal */ - "spill-0-norm", /* 083 spill 0 normal */ - "spill-1-norm", /* 084 spill 1 normal */ - "spill-1-norm", /* 085 spill 1 normal */ - "spill-1-norm", /* 086 spill 1 normal */ - "spill-1-norm", /* 087 spill 1 normal */ - "spill-2-norm", /* 088 spill 2 normal */ - "spill-2-norm", /* 089 spill 2 normal */ - "spill-2-norm", /* 08A spill 2 normal */ - "spill-2-norm", /* 08B spill 2 normal */ - "spill-3-norm", /* 08C spill 3 normal */ - "spill-3-norm", /* 08D spill 3 normal */ - "spill-3-norm", /* 08E spill 3 normal */ - "spill-3-norm", /* 08F spill 3 normal */ - "spill-4-norm", /* 090 spill 4 normal */ - "spill-4-norm", /* 091 spill 4 normal */ - "spill-4-norm", /* 092 spill 4 normal */ - "spill-4-norm", /* 093 spill 4 normal */ - "spill-5-norm", /* 094 spill 5 normal */ - "spill-5-norm", /* 095 spill 5 normal */ - "spill-5-norm", /* 096 spill 5 normal */ - "spill-5-norm", /* 097 spill 5 normal */ - "spill-6-norm", /* 098 spill 6 normal */ - "spill-6-norm", /* 099 spill 6 normal */ - "spill-6-norm", /* 09A spill 6 normal */ - "spill-6-norm", /* 09B spill 6 normal */ - "spill-7-norm", /* 09C spill 7 normal */ - "spill-7-norm", /* 09D spill 7 normal */ - "spill-7-norm", /* 09E spill 7 normal */ - "spill-7-norm", /* 09F spill 7 normal */ - "spill-0-oth", /* 0A0 spill 0 other */ - "spill-0-oth", /* 0A1 spill 0 other */ - "spill-0-oth", /* 0A2 spill 0 other */ - "spill-0-oth", /* 0A3 spill 0 other */ - "spill-1-oth", /* 0A4 spill 1 other */ - "spill-1-oth", /* 0A5 spill 1 other */ - "spill-1-oth", /* 0A6 spill 1 other */ - "spill-1-oth", /* 0A7 spill 1 other */ - "spill-2-oth", /* 0A8 spill 2 other */ - "spill-2-oth", /* 0A9 spill 2 other */ - "spill-2-oth", /* 0AA spill 2 other */ - "spill-2-oth", /* 0AB spill 2 other */ - "spill-3-oth", /* 0AC spill 3 other */ - "spill-3-oth", /* 0AD spill 3 other */ - "spill-3-oth", /* 0AE spill 3 other */ - "spill-3-oth", /* 0AF spill 3 other */ - "spill-4-oth", /* 0B0 spill 4 other */ - "spill-4-oth", /* 0B1 spill 4 other */ - "spill-4-oth", /* 0B2 spill 4 other */ - "spill-4-oth", /* 0B3 spill 4 other */ - "spill-5-oth", /* 0B4 spill 5 other */ - "spill-5-oth", /* 0B5 spill 5 other */ - "spill-5-oth", /* 0B6 spill 5 other */ - "spill-5-oth", /* 0B7 spill 5 other */ - "spill-6-oth", /* 0B8 spill 6 other */ - "spill-6-oth", /* 0B9 spill 6 other */ - "spill-6-oth", /* 0BA spill 6 other */ - "spill-6-oth", /* 0BB spill 6 other */ - "spill-7-oth", /* 0BC spill 7 other */ - "spill-7-oth", /* 0BD spill 7 other */ - "spill-7-oth", /* 0BE spill 7 other */ - "spill-7-oth", /* 0BF spill 7 other */ - "fill-0-norm", /* 0C0 fill 0 normal */ - "fill-0-norm", /* 0C1 fill 0 normal */ - "fill-0-norm", /* 0C2 fill 0 normal */ - "fill-0-norm", /* 0C3 fill 0 normal */ - "fill-1-norm", /* 0C4 fill 1 normal */ - "fill-1-norm", /* 0C5 fill 1 normal */ - "fill-1-norm", /* 0C6 fill 1 normal */ - "fill-1-norm", /* 0C7 fill 1 normal */ - "fill-2-norm", /* 0C8 fill 2 normal */ - "fill-2-norm", /* 0C9 fill 2 normal */ - "fill-2-norm", /* 0CA fill 2 normal */ - "fill-2-norm", /* 0CB fill 2 normal */ - "fill-3-norm", /* 0CC fill 3 normal */ - "fill-3-norm", /* 0CD fill 3 normal */ - "fill-3-norm", /* 0CE fill 3 normal */ - "fill-3-norm", /* 0CF fill 3 normal */ - "fill-4-norm", /* 0D0 fill 4 normal */ - "fill-4-norm", /* 0D1 fill 4 normal */ - "fill-4-norm", /* 0D2 fill 4 normal */ - "fill-4-norm", /* 0D3 fill 4 normal */ - "fill-5-norm", /* 0D4 fill 5 normal */ - "fill-5-norm", /* 0D5 fill 5 normal */ - "fill-5-norm", /* 0D6 fill 5 normal */ - "fill-5-norm", /* 0D7 fill 5 normal */ - "fill-6-norm", /* 0D8 fill 6 normal */ - "fill-6-norm", /* 0D9 fill 6 normal */ - "fill-6-norm", /* 0DA fill 6 normal */ - "fill-6-norm", /* 0DB fill 6 normal */ - "fill-7-norm", /* 0DC fill 7 normal */ - "fill-7-norm", /* 0DD fill 7 normal */ - "fill-7-norm", /* 0DE fill 7 normal */ - "fill-7-norm", /* 0DF fill 7 normal */ - "fill-0-oth", /* 0E0 fill 0 other */ - "fill-0-oth", /* 0E1 fill 0 other */ - "fill-0-oth", /* 0E2 fill 0 other */ - "fill-0-oth", /* 0E3 fill 0 other */ - "fill-1-oth", /* 0E4 fill 1 other */ - "fill-1-oth", /* 0E5 fill 1 other */ - "fill-1-oth", /* 0E6 fill 1 other */ - "fill-1-oth", /* 0E7 fill 1 other */ - "fill-2-oth", /* 0E8 fill 2 other */ - "fill-2-oth", /* 0E9 fill 2 other */ - "fill-2-oth", /* 0EA fill 2 other */ - "fill-2-oth", /* 0EB fill 2 other */ - "fill-3-oth", /* 0EC fill 3 other */ - "fill-3-oth", /* 0ED fill 3 other */ - "fill-3-oth", /* 0EE fill 3 other */ - "fill-3-oth", /* 0EF fill 3 other */ - "fill-4-oth", /* 0F0 fill 4 other */ - "fill-4-oth", /* 0F1 fill 4 other */ - "fill-4-oth", /* 0F2 fill 4 other */ - "fill-4-oth", /* 0F3 fill 4 other */ - "fill-5-oth", /* 0F4 fill 5 other */ - "fill-5-oth", /* 0F5 fill 5 other */ - "fill-5-oth", /* 0F6 fill 5 other */ - "fill-5-oth", /* 0F7 fill 5 other */ - "fill-6-oth", /* 0F8 fill 6 other */ - "fill-6-oth", /* 0F9 fill 6 other */ - "fill-6-oth", /* 0FA fill 6 other */ - "fill-6-oth", /* 0FB fill 6 other */ - "fill-7-oth", /* 0FC fill 7 other */ - "fill-7-oth", /* 0FD fill 7 other */ - "fill-7-oth", /* 0FE fill 7 other */ - "fill-7-oth", /* 0FF fill 7 other */ - "syscall-4x", /* 100 old system call */ - "usr-brkpt", /* 101 user breakpoint */ - "usr-div-zero", /* 102 user divide by zero */ - "flush-wins", /* 103 flush windows */ - "clean-wins", /* 104 clean windows */ - "range-chk", /* 105 range check ?? */ - "fix-align", /* 106 do unaligned references */ - BAD, /* 107 unused */ - "syscall-32", /* 108 ILP32 system call on LP64 */ - "set-t0-addr", /* 109 set trap0 address */ - BAD, BAD, BAD4, /* 10A - 10F unused */ - BAD4, BAD4, BAD4, BAD4, /* 110 - 11F unused (V9 user traps?) */ - "get-cc", /* 120 get condition codes */ - "set-cc", /* 121 set condition codes */ - "get-psr", /* 122 get psr */ - "set-psr", /* 123 set psr (some fields) */ - "getts", /* 124 get timestamp */ - "gethrvtime", /* 125 get lwp virtual time */ - "self-xcall", /* 126 self xcall */ - "gethrtime", /* 127 get hrestime */ - BAD, /* 128 unused (ST_SETV9STACK) */ - "getlgrp", /* 129 get lgrpid */ - BAD, BAD, BAD4, /* 12A - 12F unused */ - BAD4, BAD4, /* 130 - 137 unused */ - "dtrace-pid", /* 138 DTrace pid provider */ - BAD, /* 139 unused */ - "dtrace-return", /* 13A DTrace pid provider */ - BAD, BAD4, /* 13B - 13F unused */ - "syscall-64", /* 140 LP64 system call */ - BAD, /* 141 unused */ - "tt-freeze", /* 142 freeze traptrace */ - "tt-unfreeze", /* 143 unfreeze traptrace */ - BAD4, BAD4, BAD4, /* 144 - 14F unused */ - BAD4, BAD4, BAD4, BAD4, /* 150 - 15F unused */ - BAD4, BAD4, BAD4, BAD4, /* 160 - 16F unused */ - BAD4, BAD4, BAD4, /* 170 - 17B unused */ - "ptl1-panic", /* 17C test ptl1_panic */ - "kmdb-enter", /* 17D kmdb enter (L1-A) */ - "kmdb-brkpt", /* 17E kmdb breakpoint */ - "obp-brkpt", /* 17F obp breakpoint */ -#ifdef sun4v - "fast_trap", /* 180 hypervisor fast trap */ - "cpu_tick_npt", /* 181 cpu_tick_npt() hcall */ - "cpu_stick_npt", /* 182 cpu_stick_npt() hcall */ - "mmu_map_addr", /* 183 mmu_map_addr() hcall */ - "mmu_unmap_addr", /* 184 mmu_unmap_addr() hcall */ - "ttrace_addentry", /* 185 ttrace_addentry() hcall */ - NOT, NOT, NOT4, NOT4, /* 186 - 18F reserved */ -#else - NOT4, NOT4, NOT4, NOT4, /* 180 - 18F reserved */ -#endif - NOT4, NOT4, NOT4, NOT4, /* 190 - 19F reserved */ - NOT4, NOT4, NOT4, NOT4, /* 1A0 - 1AF reserved */ - NOT4, NOT4, NOT4, NOT4, /* 1B0 - 1BF reserved */ - NOT4, NOT4, NOT4, NOT4, /* 1C0 - 1CF reserved */ - NOT4, NOT4, NOT4, NOT4, /* 1D0 - 1DF reserved */ - NOT4, NOT4, NOT4, NOT4, /* 1E0 - 1EF reserved */ - NOT4, NOT4, NOT4, NOT4 /* 1F0 - 1FF reserved */ -}; -static const size_t ttndescr = sizeof (ttdescr) / sizeof (ttdescr[0]); - -static GElf_Sym iv_sym; - -/* - * Persistent data (shouldn't change). - */ -static int ncpu; /* _ncpu */ -static ssize_t mbox_size; /* size of xc_mbox */ -static ulong_t mbox_stoff; /* offset of xc_mbox.xc_state */ -static mdb_ctf_id_t mbox_states; /* xc_state enumeration */ - -static int -fetch_ncpu(void) -{ - if (ncpu == 0) - if (mdb_readsym(&ncpu, sizeof (ncpu), "_ncpu") == -1) { - mdb_warn("symbol '_ncpu' not found"); - return (1); - } - return (0); -} - -static int -fetch_mbox(void) -{ - if (mbox_size <= 0) { - mdb_ctf_id_t id; - - if (mdb_ctf_lookup_by_name("struct xc_mbox", &id) == -1) { - mdb_warn("couldn't find type 'struct xc_mbox'"); - return (1); - } - - /* - * These two could be combined into a single call to - * mdb_ctf_member_info if xc_state was actually of type - * enum xc_states. - */ - if (mdb_ctf_lookup_by_name("enum xc_states", - &mbox_states) == -1) { - mdb_warn("couldn't find type 'enum xc_states'"); - return (1); - } - if (mdb_ctf_offsetof(id, "xc_state", &mbox_stoff) == -1) { - mdb_warn("couldn't find 'xc_mbox.xc_state'"); - return (1); - } - mbox_stoff /= NBBY; - - if ((mbox_size = mdb_ctf_type_size(id)) == -1) { - mdb_warn("couldn't size 'struct xc_mbox'"); - return (1); - } - } - return (0); -} - -static int -print_range(int start, int end, int separator) -{ - int count; - char tmp; - char *format; - - if (start == end) { - /* Unfortunately, mdb_printf returns void */ - format = separator ? ", %d" : "%d"; - mdb_printf(format, start); - count = mdb_snprintf(&tmp, 1, format, start); - } else { - format = separator ? ", %d-%d" : "%d-%d"; - mdb_printf(format, start, end); - count = mdb_snprintf(&tmp, 1, format, start, end); - } - - return (count); -} - -static void -print_cpuset_range(ulong_t *cs, int words, int width) -{ - int i, j; - ulong_t m; - int in = 0; - int start; - int end; - int count = 0; - int sep = 0; - - for (i = 0; i < words; i++) - for (j = 0, m = 1; j < BT_NBIPUL; j++, m <<= 1) - if (cs[i] & m) { - if (in == 0) { - start = i * BT_NBIPUL + j; - in = 1; - } - } else { - if (in == 1) { - end = i * BT_NBIPUL + j - 1; - count += print_range(start, end, sep); - sep = 1; - in = 0; - } - } - if (in == 1) { - end = i * BT_NBIPUL - 1; - count += print_range(start, end, sep); - } - - while (count++ < width) - mdb_printf(" "); -} - -/*ARGSUSED*/ -static int -cmd_cpuset(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - uint_t rflag = 0, lflag = 0; - int words; - ulong_t *setp, set = 0; - - if (mdb_getopts(argc, argv, - 'l', MDB_OPT_SETBITS, TRUE, &lflag, - 'r', MDB_OPT_SETBITS, TRUE, &rflag, NULL) != argc) - return (DCMD_USAGE); - - if (lflag && rflag) - return (DCMD_USAGE); - - if (fetch_ncpu()) - return (DCMD_ERR); - - if ((words = BT_BITOUL(ncpu)) == 1) { - setp = &set; - mdb_vread(setp, sizeof (ulong_t), addr); - } else { - setp = mdb_alloc(words * sizeof (ulong_t), UM_SLEEP | UM_GC); - mdb_vread(setp, words * sizeof (ulong_t), addr); - } - - if (lflag) { - int i, j; - ulong_t m; - - for (i = 0; i < words; i++) - for (j = 0, m = 1; j < BT_NBIPUL; j++, m <<= 1) - if (setp[i] & m) - mdb_printf("%r\n", i * BT_NBIPUL + j); - } else if (rflag) { - int i; - int sep = 0; - - for (i = 0; i < words; i++) { - mdb_printf(sep ? " %?0lx" : "%?0lx", setp[i]); - sep = 1; - } - } else { - print_cpuset_range(setp, words, 0); - } - - return (DCMD_OK); -} - -/*ARGSUSED*/ -int -ttctl(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - TRAP_TRACE_CTL *ctls, *ctl; - int i, traptrace_buf_inuse = 0; - - if (argc != 0) - return (DCMD_USAGE); - - if (fetch_ncpu()) - return (DCMD_ERR); - - ctls = mdb_alloc(sizeof (TRAP_TRACE_CTL) * ncpu, UM_SLEEP | UM_GC); - if (mdb_readsym(ctls, sizeof (TRAP_TRACE_CTL) * ncpu, - "trap_trace_ctl") == -1) { - mdb_warn("symbol 'trap_trace_ctl' not found"); - return (DCMD_ERR); - } - - for (ctl = &ctls[0], i = 0; i < ncpu; i++, ctl++) { - if (ctl->d.vaddr_base == 0) - continue; - - traptrace_buf_inuse = 1; - mdb_printf("trap_trace_ctl[%d] = {\n", i); - mdb_printf(" vaddr_base = 0x%lx\n", (long)ctl->d.vaddr_base); - mdb_printf(" last_offset = 0x%x\n", ctl->d.last_offset); - mdb_printf(" offset = 0x%x\n", ctl->d.offset); - mdb_printf(" limit = 0x%x\n", ctl->d.limit); - mdb_printf(" paddr_base = 0x%llx\n", ctl->d.paddr_base); - mdb_printf(" asi = 0x%02x\n}\n", ctl->d.asi); - } - if (!traptrace_buf_inuse) { - mdb_warn("traptrace not configured"); - return (DCMD_ERR); - } - - return (DCMD_OK); -} - -/*ARGSUSED*/ -static int -ttprint_short(uintptr_t addr, const trap_trace_fullrec_t *full, int *cpu) -{ - const char *ttstr; - const struct trap_trace_record *ttp = &full->ttf_rec; - - if (*cpu == -1) - mdb_printf("%3d ", full->ttf_cpu); - else - if (*cpu != full->ttf_cpu) - return (0); - - /* - * Decoding the traptype field is a bit messy. First we check for - * several well-defined 16-bit values defined in <sys/traptrace.h>. - */ - switch (ttp->tt_tt) { - case TT_SC_ENTR: - ttstr = "sys-enter"; - break; - case TT_SC_RET: - ttstr = "sys-exit"; - break; - case TT_SYS_RTT_PROM: - ttstr = "prom_rtt"; - break; - case TT_SYS_RTT_PRIV: - ttstr = "priv_rtt"; - break; - case TT_SYS_RTT_USER: - ttstr = "user_rtt"; - break; - case TT_INTR_EXIT: - ttstr = "int-thr-exit"; - break; - default: - /* - * Next we consider several prefixes (which are - * typically OR'd with other information such as the - * %pil or %tt value at the time of the trace). - */ - switch (ttp->tt_tt & 0xff00) { - case TT_SERVE_INTR: - ttstr = "serve-intr"; - break; - case TT_XCALL: - ttstr = "xcall"; - break; - case TT_XCALL_CONT: - ttstr = "xcall-cont"; - break; - case SYSTRAP_TT: - ttstr = "sys_trap"; - break; - default: - /* - * Otherwise we try to convert the - * tt value to a string using our - * giant lookup table. - */ - ttstr = ttp->tt_tt < ttndescr ? - ttdescr[ttp->tt_tt] : "?"; - } - } - -#ifdef sun4v - mdb_printf("%016llx %04hx %-12s %02x %02x %0?p %A\n", ttp->tt_tick, - ttp->tt_tt, ttstr, ttp->tt_tl, ttp->tt_gl, - ttp->tt_tpc, ttp->tt_tpc); -#else - mdb_printf("%016llx %04hx %-12s %04hx %0?p %A\n", ttp->tt_tick, - ttp->tt_tt, ttstr, ttp->tt_tl, ttp->tt_tpc, ttp->tt_tpc); -#endif - - return (WALK_NEXT); -} - -/*ARGSUSED*/ -static int -ttprint_long(uintptr_t addr, const trap_trace_fullrec_t *full, int *cpu) -{ - const struct trap_trace_record *ttp = &full->ttf_rec; - - if (*cpu == -1) - mdb_printf("%3d ", full->ttf_cpu); - else if (*cpu != full->ttf_cpu) - return (WALK_NEXT); - -#ifdef sun4v - mdb_printf("%016llx %016llx %04hx %02x %02x %0?p %0?p %0?p " - "[%p,%p,%p,%p]\n", - ttp->tt_tick, ttp->tt_tstate, ttp->tt_tt, ttp->tt_tl, ttp->tt_gl, - ttp->tt_tpc, ttp->tt_sp, ttp->tt_tr, - ttp->tt_f1, ttp->tt_f2, ttp->tt_f3, ttp->tt_f4); -#else - mdb_printf("%016llx %016llx %04hx %04hx %0?p %0?p %0?p [%p,%p,%p,%p]\n", - ttp->tt_tick, ttp->tt_tstate, ttp->tt_tt, ttp->tt_tl, - ttp->tt_tpc, ttp->tt_sp, ttp->tt_tr, - ttp->tt_f1, ttp->tt_f2, ttp->tt_f3, ttp->tt_f4); -#endif - - return (WALK_NEXT); -} - -typedef struct ttrace_cpu_data { - struct trap_trace_record *tc_buf; - struct trap_trace_record *tc_rec; - struct trap_trace_record *tc_stop; - size_t tc_bufsiz; - uintptr_t tc_base; -} ttrace_cpu_data_t; - -typedef struct ttrace_walk_data { - int tw_ncpu; - ttrace_cpu_data_t *tw_cpus; -} ttrace_walk_data_t; - -int -ttrace_walk_init(mdb_walk_state_t *wsp) -{ - TRAP_TRACE_CTL *ctls, *ctl; - int i, traptrace_buf_inuse = 0; - ttrace_walk_data_t *tw; - ttrace_cpu_data_t *tc; - struct trap_trace_record *buf; - - if (wsp->walk_addr != (uintptr_t)NULL) { - mdb_warn("ttrace only supports global walks\n"); - return (WALK_ERR); - } - - if (fetch_ncpu()) - return (WALK_ERR); - - ctls = mdb_alloc(sizeof (TRAP_TRACE_CTL) * ncpu, UM_SLEEP); - if (mdb_readsym(ctls, sizeof (TRAP_TRACE_CTL) * ncpu, - "trap_trace_ctl") == -1) { - mdb_warn("symbol 'trap_trace_ctl' not found"); - mdb_free(ctls, sizeof (TRAP_TRACE_CTL) * ncpu); - return (WALK_ERR); - } - - tw = mdb_zalloc(sizeof (ttrace_walk_data_t), UM_SLEEP); - tw->tw_ncpu = ncpu; - tw->tw_cpus = mdb_zalloc(sizeof (ttrace_cpu_data_t) * ncpu, UM_SLEEP); - - for (i = 0; i < ncpu; i++) { - ctl = &ctls[i]; - - if (ctl->d.vaddr_base == 0) - continue; - - traptrace_buf_inuse = 1; - tc = &(tw->tw_cpus[i]); - tc->tc_bufsiz = ctl->d.limit - - sizeof (struct trap_trace_record); - tc->tc_buf = buf = mdb_alloc(tc->tc_bufsiz, UM_SLEEP); - tc->tc_base = (uintptr_t)ctl->d.vaddr_base; - - if (mdb_vread(buf, tc->tc_bufsiz, tc->tc_base) == -1) { - mdb_warn("failed to read trap trace buffer at %p", - ctl->d.vaddr_base); - mdb_free(buf, tc->tc_bufsiz); - tc->tc_buf = NULL; - } else { - tc->tc_rec = (struct trap_trace_record *) - ((uintptr_t)buf + (uintptr_t)ctl->d.last_offset); - tc->tc_stop = (struct trap_trace_record *) - ((uintptr_t)buf + (uintptr_t)ctl->d.offset); - } - } - if (!traptrace_buf_inuse) { - mdb_warn("traptrace not configured"); - mdb_free(ctls, sizeof (TRAP_TRACE_CTL) * ncpu); - return (DCMD_ERR); - } - - mdb_free(ctls, sizeof (TRAP_TRACE_CTL) * ncpu); - wsp->walk_data = tw; - return (WALK_NEXT); -} - -int -ttrace_walk_step(mdb_walk_state_t *wsp) -{ - ttrace_walk_data_t *tw = wsp->walk_data; - ttrace_cpu_data_t *tc; - struct trap_trace_record *rec; - int oldest, i, status; - uint64_t oldest_tick = 0; - int done = 1; - trap_trace_fullrec_t fullrec; - - for (i = 0; i < tw->tw_ncpu; i++) { - tc = &(tw->tw_cpus[i]); - - if (tc->tc_rec == NULL) - continue; - done = 0; - - if (tc->tc_rec->tt_tick == 0) - mdb_warn("Warning: tt_tick == 0\n"); - - if (tc->tc_rec->tt_tick > oldest_tick) { - oldest_tick = tc->tc_rec->tt_tick; - oldest = i; - } - } - - if (done) - return (-1); - - tc = &(tw->tw_cpus[oldest]); - rec = tc->tc_rec; - - fullrec.ttf_rec = *rec; - fullrec.ttf_cpu = oldest; - - if (oldest_tick != 0) - status = wsp->walk_callback((uintptr_t)rec - - (uintptr_t)tc->tc_buf + tc->tc_base, &fullrec, - wsp->walk_cbdata); - - tc->tc_rec--; - - if (tc->tc_rec < tc->tc_buf) - tc->tc_rec = (struct trap_trace_record *)((uintptr_t) - tc->tc_buf + (uintptr_t)tc->tc_bufsiz - - sizeof (struct trap_trace_record)); - - if (tc->tc_rec == tc->tc_stop) { - tc->tc_rec = NULL; - mdb_free(tc->tc_buf, tc->tc_bufsiz); - } - - return (status); -} - -void -ttrace_walk_fini(mdb_walk_state_t *wsp) -{ - ttrace_walk_data_t *tw = wsp->walk_data; - - mdb_free(tw->tw_cpus, sizeof (ttrace_cpu_data_t) * tw->tw_ncpu); - mdb_free(tw, sizeof (ttrace_walk_data_t)); -} - -int -ttrace(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - uint_t opt_x = FALSE; - int cpu = -1; - mdb_walk_cb_t ttprint; - - if (mdb_getopts(argc, argv, - 'x', MDB_OPT_SETBITS, TRUE, &opt_x, NULL) != argc) - return (DCMD_USAGE); - - if (flags & DCMD_ADDRSPEC) { - if (fetch_ncpu()) - return (DCMD_ERR); - if (addr >= ncpu) { - mdb_warn("expected cpu between 0 and %d\n", ncpu - 1); - return (DCMD_ERR); - } - cpu = (int)addr; - } - - if (cpu == -1) - mdb_printf("CPU "); - - if (opt_x) { -#ifdef sun4v - mdb_printf("%-16s %-16s %-4s %-3s %-3s %-?s %-?s %-?s " - "F1-4\n", "%tick", "%tstate", "%tt", "%tl", "%gl", - "%tpc", "%sp", "TR"); -#else - mdb_printf("%-16s %-16s %-4s %-4s %-?s %-?s %-?s " - "F1-4\n", "%tick", "%tstate", "%tt", "%tl", - "%tpc", "%sp", "TR"); -#endif - - ttprint = (mdb_walk_cb_t)ttprint_long; - } else { -#ifdef sun4v - mdb_printf("%-16s %-4s %-12s %-3s %-3s %s\n", - "%tick", "%tt", "", "%tl", "%gl", "%tpc"); -#else - mdb_printf("%-16s %-4s %-12s %-4s %s\n", - "%tick", "%tt", "", "%tl", "%tpc"); -#endif - - ttprint = (mdb_walk_cb_t)ttprint_short; - } - - if (mdb_walk("ttrace", ttprint, &cpu) == -1) { - mdb_warn("couldn't walk ttrace"); - return (DCMD_ERR); - } - - return (DCMD_OK); -} - -#ifdef sun4v -/*ARGSUSED*/ -int -httctl(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - TRAP_TRACE_CTL *ctls, *ctl; - int i, htraptrace_buf_inuse = 0; - htrap_trace_hdr_t hdr; - - if (argc != 0) - return (DCMD_USAGE); - - if (fetch_ncpu()) - return (DCMD_ERR); - - ctls = mdb_alloc(sizeof (TRAP_TRACE_CTL) * ncpu, UM_SLEEP | UM_GC); - if (mdb_readsym(ctls, sizeof (TRAP_TRACE_CTL) * ncpu, - "trap_trace_ctl") == -1) { - mdb_warn("symbol 'trap_trace_ctl' not found"); - return (DCMD_ERR); - } - - for (ctl = &ctls[0], i = 0; i < ncpu; i++, ctl++) { - if (ctl->d.hvaddr_base == 0) - continue; - - htraptrace_buf_inuse = 1; - mdb_vread(&hdr, sizeof (htrap_trace_hdr_t), - (uintptr_t)ctl->d.hvaddr_base); - mdb_printf("htrap_trace_ctl[%d] = {\n", i); - mdb_printf(" vaddr_base = 0x%lx\n", (long)ctl->d.hvaddr_base); - mdb_printf(" last_offset = 0x%lx\n", hdr.last_offset); - mdb_printf(" offset = 0x%lx\n", hdr.offset); - mdb_printf(" limit = 0x%x\n", ctl->d.hlimit); - mdb_printf(" paddr_base = 0x%llx\n}\n", ctl->d.hpaddr_base); - } - if (!htraptrace_buf_inuse) { - mdb_warn("hv traptrace not configured"); - return (DCMD_ERR); - } - - return (DCMD_OK); -} - -/*ARGSUSED*/ -static int -httprint_short(uintptr_t addr, const htrap_trace_fullrec_t *full, int *cpu) -{ - const char *ttstr; - const struct htrap_trace_record *ttp = &full->ttf_rec; - - if (*cpu == -1) - mdb_printf("%3d ", full->ttf_cpu); - else - if (*cpu != full->ttf_cpu) - return (0); - - /* - * Convert the tt value to a string using our gaint lookuo table - */ - ttstr = ttp->tt_tt < ttndescr ? ttdescr[ttp->tt_tt] : "?"; - - mdb_printf("%016llx %02x %04hx %04hx %-16s %02x %02x %0?p %A\n", - ttp->tt_tick, ttp->tt_ty, ttp->tt_tag, ttp->tt_tt, ttstr, - ttp->tt_tl, ttp->tt_gl, ttp->tt_tpc, ttp->tt_tpc); - - return (WALK_NEXT); -} - -/*ARGSUSED*/ -static int -httprint_long(uintptr_t addr, const htrap_trace_fullrec_t *full, int *cpu) -{ - const struct htrap_trace_record *ttp = &full->ttf_rec; - - if (*cpu == -1) - mdb_printf("%3d ", full->ttf_cpu); - else if (*cpu != full->ttf_cpu) - return (WALK_NEXT); - - mdb_printf("%016llx %016llx %02x %02x %04hx %04hx %02x %02x %0?p " - "[%p,%p,%p,%p]\n", - ttp->tt_tick, ttp->tt_tstate, ttp->tt_hpstate, ttp->tt_ty, - ttp->tt_tag, ttp->tt_tt, ttp->tt_tl, ttp->tt_gl, ttp->tt_tpc, - ttp->tt_f1, ttp->tt_f2, ttp->tt_f3, ttp->tt_f4); - - return (WALK_NEXT); -} - -typedef struct httrace_cpu_data { - struct htrap_trace_record *tc_buf; - struct htrap_trace_record *tc_rec; - struct htrap_trace_record *tc_stop; - size_t tc_bufsiz; - uintptr_t tc_base; -} httrace_cpu_data_t; - -typedef struct httrace_walk_data { - int tw_ncpu; - httrace_cpu_data_t *tw_cpus; -} httrace_walk_data_t; - -int -httrace_walk_init(mdb_walk_state_t *wsp) -{ - TRAP_TRACE_CTL *ctls, *ctl; - int i, htraptrace_buf_inuse = 0; - httrace_walk_data_t *tw; - httrace_cpu_data_t *tc; - struct htrap_trace_record *buf; - htrap_trace_hdr_t *hdr; - - if (wsp->walk_addr != (uintptr_t)NULL) { - mdb_warn("httrace only supports global walks\n"); - return (WALK_ERR); - } - - if (fetch_ncpu()) - return (WALK_ERR); - - ctls = mdb_alloc(sizeof (TRAP_TRACE_CTL) * ncpu, UM_SLEEP); - if (mdb_readsym(ctls, sizeof (TRAP_TRACE_CTL) * ncpu, - "trap_trace_ctl") == -1) { - mdb_warn("symbol 'trap_trace_ctl' not found"); - mdb_free(ctls, sizeof (TRAP_TRACE_CTL) * ncpu); - return (WALK_ERR); - } - - tw = mdb_zalloc(sizeof (httrace_walk_data_t), UM_SLEEP); - tw->tw_ncpu = ncpu; - tw->tw_cpus = mdb_zalloc(sizeof (httrace_cpu_data_t) * ncpu, UM_SLEEP); - - for (i = 0; i < ncpu; i++) { - ctl = &ctls[i]; - - if (ctl->d.hvaddr_base == 0) - continue; - - htraptrace_buf_inuse = 1; - tc = &(tw->tw_cpus[i]); - tc->tc_bufsiz = ctl->d.hlimit; - tc->tc_buf = buf = mdb_alloc(tc->tc_bufsiz, UM_SLEEP); - tc->tc_base = (uintptr_t)ctl->d.hvaddr_base; - - if (mdb_vread(buf, tc->tc_bufsiz, tc->tc_base) == -1) { - mdb_warn("failed to read hv trap trace buffer at %p", - ctl->d.hvaddr_base); - mdb_free(buf, tc->tc_bufsiz); - tc->tc_buf = NULL; - } else { - hdr = (htrap_trace_hdr_t *)buf; - tc->tc_rec = (struct htrap_trace_record *) - ((uintptr_t)buf + (uintptr_t)hdr->last_offset); - tc->tc_stop = (struct htrap_trace_record *) - ((uintptr_t)buf + (uintptr_t)hdr->offset); - } - } - if (!htraptrace_buf_inuse) { - mdb_warn("hv traptrace not configured"); - mdb_free(ctls, sizeof (TRAP_TRACE_CTL) * ncpu); - return (DCMD_ERR); - } - - mdb_free(ctls, sizeof (TRAP_TRACE_CTL) * ncpu); - wsp->walk_data = tw; - return (WALK_NEXT); -} - -int -httrace_walk_step(mdb_walk_state_t *wsp) -{ - httrace_walk_data_t *tw = wsp->walk_data; - httrace_cpu_data_t *tc; - struct htrap_trace_record *rec; - int oldest, i, status; - uint64_t oldest_tick = 0; - int done = 1; - htrap_trace_fullrec_t fullrec; - - for (i = 0; i < tw->tw_ncpu; i++) { - tc = &(tw->tw_cpus[i]); - - if (tc->tc_rec == NULL) - continue; - done = 0; - - if (tc->tc_rec->tt_tick == 0) - mdb_warn("Warning: tt_tick == 0\n"); - - if (tc->tc_rec->tt_tick >= oldest_tick) { - oldest_tick = tc->tc_rec->tt_tick; - oldest = i; - } - } - - if (done) - return (-1); - - tc = &(tw->tw_cpus[oldest]); - rec = tc->tc_rec; - - fullrec.ttf_rec = *rec; - fullrec.ttf_cpu = oldest; - - if (oldest_tick != 0) - status = wsp->walk_callback((uintptr_t)rec - - (uintptr_t)tc->tc_buf + tc->tc_base, &fullrec, - wsp->walk_cbdata); - - tc->tc_rec--; - - /* first record of the trap trace buffer is trap trace header */ - if (tc->tc_rec == tc->tc_buf) - tc->tc_rec = (struct htrap_trace_record *)((uintptr_t) - tc->tc_buf + (uintptr_t)tc->tc_bufsiz - - sizeof (struct htrap_trace_record)); - - if (tc->tc_rec == tc->tc_stop) { - tc->tc_rec = NULL; - mdb_free(tc->tc_buf, tc->tc_bufsiz); - } - - return (status); -} - -void -httrace_walk_fini(mdb_walk_state_t *wsp) -{ - httrace_walk_data_t *tw = wsp->walk_data; - - mdb_free(tw->tw_cpus, sizeof (httrace_cpu_data_t) * tw->tw_ncpu); - mdb_free(tw, sizeof (httrace_walk_data_t)); -} - -int -httrace(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - uint_t opt_x = FALSE; - int cpu = -1; - mdb_walk_cb_t ttprint; - - if (mdb_getopts(argc, argv, - 'x', MDB_OPT_SETBITS, TRUE, &opt_x, NULL) != argc) - return (DCMD_USAGE); - - if (flags & DCMD_ADDRSPEC) { - if (fetch_ncpu()) - return (DCMD_ERR); - if (addr >= ncpu) { - mdb_warn("expected cpu between 0 and %d\n", ncpu - 1); - return (DCMD_ERR); - } - cpu = (int)addr; - } - - if (cpu == -1) - mdb_printf("CPU "); - - if (opt_x) { - mdb_printf("%-16s %-16s %-3s %-3s %-4s %-4s %-3s %-3s %-?s " - "F1-4\n", "%tick", "%tstate", "%hp", "%ty", "%tag", - "%tt", "%tl", "%gl", "%tpc"); - ttprint = (mdb_walk_cb_t)httprint_long; - } else { - mdb_printf("%-16s %-3s %-4s %-4s %-16s %-3s %-3s %s\n", - "%tick", "%ty", "%tag", "%tt", "", "%tl", "%gl", - "%tpc"); - ttprint = (mdb_walk_cb_t)httprint_short; - } - - if (mdb_walk("httrace", ttprint, &cpu) == -1) { - mdb_warn("couldn't walk httrace"); - return (DCMD_ERR); - } - - return (DCMD_OK); -} -#endif - -struct { - int xc_type; - const char *xc_str; -} xc_data[] = { - { XT_ONE_SELF, "xt-one-self" }, - { XT_ONE_OTHER, "xt-one-other" }, - { XT_SOME_SELF, "xt-some-self" }, - { XT_SOME_OTHER, "xt-some-other" }, - { XT_ALL_SELF, "xt-all-self" }, - { XT_ALL_OTHER, "xt-all-other" }, - { XC_ONE_SELF, "xc-one-self" }, - { XC_ONE_OTHER, "xc-one-other" }, - { XC_ONE_OTHER_H, "xc-one-other-h" }, - { XC_SOME_SELF, "xc-some-self" }, - { XC_SOME_OTHER, "xc-some-other" }, - { XC_SOME_OTHER_H, "xc-some-other-h" }, - { XC_ALL_SELF, "xc-all-self" }, - { XC_ALL_OTHER, "xc-all-other" }, - { XC_ALL_OTHER_H, "xc-all-other-h" }, - { XC_ATTENTION, "xc-attention" }, - { XC_DISMISSED, "xc-dismissed" }, - { XC_LOOP_ENTER, "xc-loop-enter" }, - { XC_LOOP_DOIT, "xc-loop-doit" }, - { XC_LOOP_EXIT, "xc-loop-exit" }, - { 0, NULL } -}; - -/*ARGSUSED*/ -int -xctrace_walk(uintptr_t addr, const trap_trace_fullrec_t *full, int *cpu) -{ - const struct trap_trace_record *ttp = &full->ttf_rec; - int i, type = ttp->tt_tt & 0xff; - const char *str = "???"; - - if ((ttp->tt_tt & 0xff00) == TT_XCALL) { - for (i = 0; xc_data[i].xc_str != NULL; i++) { - if (xc_data[i].xc_type == type) { - str = xc_data[i].xc_str; - break; - } - } - } else if ((ttp->tt_tt & 0xff00) == TT_XCALL_CONT) { - str = "xcall-cont"; - mdb_printf("%3d %016llx %-16s %08x %08x %08x %08x\n", - full->ttf_cpu, ttp->tt_tick, str, ttp->tt_f1, ttp->tt_f2, - ttp->tt_f3, ttp->tt_f4); - return (WALK_NEXT); - } else if (ttp->tt_tt == 0x60) { - str = "int-vec"; - } else { - return (WALK_NEXT); - } - - mdb_printf("%3d %016llx %-16s %08x %a\n", full->ttf_cpu, - ttp->tt_tick, str, ttp->tt_sp, ttp->tt_tr); - - return (WALK_NEXT); -} - -/*ARGSUSED*/ -int -xctrace(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - if ((flags & DCMD_ADDRSPEC) || argc != 0) - return (DCMD_USAGE); - - if (mdb_walk("ttrace", (mdb_walk_cb_t)xctrace_walk, NULL) == -1) { - mdb_warn("couldn't walk ttrace"); - return (DCMD_ERR); - } - - return (DCMD_OK); -} - -/* - * Grrr... xc_mbox isn't in an _impl header file; we define it here. - */ -typedef struct xc_mbox { - xcfunc_t *xc_func; - uint64_t xc_arg1; - uint64_t xc_arg2; - cpuset_t xc_cpuset; - volatile uint_t xc_state; -} xc_mbox_t; - -typedef struct xc_mbox_walk { - int xw_ndx; - uintptr_t xw_addr; - xc_mbox_t *xw_mbox; -} xc_mbox_walk_t; - -static int -xc_mbox_walk_init(mdb_walk_state_t *wsp) -{ - GElf_Sym sym; - xc_mbox_walk_t *xw; - - if (mdb_lookup_by_name("xc_mbox", &sym) == -1) { - mdb_warn("couldn't find 'xc_mbox'"); - return (WALK_ERR); - } - - if (fetch_ncpu() || fetch_mbox()) - return (WALK_ERR); - - xw = mdb_zalloc(sizeof (xc_mbox_walk_t), UM_SLEEP); - xw->xw_mbox = mdb_zalloc(mbox_size * ncpu, UM_SLEEP); - - if (mdb_readsym(xw->xw_mbox, mbox_size * ncpu, "xc_mbox") == -1) { - mdb_warn("couldn't read 'xc_mbox'"); - mdb_free(xw->xw_mbox, mbox_size * ncpu); - mdb_free(xw, sizeof (xc_mbox_walk_t)); - return (WALK_ERR); - } - - xw->xw_addr = sym.st_value; - wsp->walk_data = xw; - - return (WALK_NEXT); -} - -static int -xc_mbox_walk_step(mdb_walk_state_t *wsp) -{ - xc_mbox_walk_t *xw = wsp->walk_data; - int status; - - if (xw->xw_ndx == ncpu) - return (WALK_DONE); - - status = wsp->walk_callback(xw->xw_addr, - &xw->xw_mbox[xw->xw_ndx++], wsp->walk_cbdata); - - xw->xw_addr += mbox_size; - return (status); -} - -static void -xc_mbox_walk_fini(mdb_walk_state_t *wsp) -{ - xc_mbox_walk_t *xw = wsp->walk_data; - - mdb_free(xw->xw_mbox, mbox_size * ncpu); - mdb_free(xw, sizeof (xc_mbox_walk_t)); -} - -static int -xc_mbox(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - xc_mbox_t *mbox; - GElf_Sym sym; - const char *state; - - if (argc != 0) - return (DCMD_USAGE); - - if (!(flags & DCMD_ADDRSPEC)) { - if (mdb_walk_dcmd("xc_mbox", "xc_mbox", argc, argv) == -1) { - mdb_warn("can't walk 'xc_mbox'"); - return (DCMD_ERR); - } - return (DCMD_OK); - } - - if (fetch_ncpu() || fetch_mbox()) - return (DCMD_ERR); - - if (DCMD_HDRSPEC(flags)) { - mdb_printf("%3s %-8s %-8s %-9s %-16s %-16s %s\n", - "CPU", "ADDR", "STATE", "CPUSET", "ARG1", "ARG2", "HNDLR"); - } - - mbox = mdb_alloc(mbox_size, UM_SLEEP | UM_GC); - if (mdb_vread(mbox, mbox_size, addr) == -1) { - mdb_warn("couldn't read xc_mbox at %p", addr); - return (DCMD_ERR); - } - - if (mbox->xc_func == NULL) - return (DCMD_OK); - - if (mdb_lookup_by_name("xc_mbox", &sym) == -1) { - mdb_warn("couldn't read 'xc_mbox'"); - return (DCMD_ERR); - } - - state = mdb_ctf_enum_name(mbox_states, - /* LINTED - alignment */ - *(int *)((char *)mbox + mbox_stoff)); - - mdb_printf("%3d %08x %-8s [ ", - (int)((addr - sym.st_value) / mbox_size), addr, - state ? state : "XC_???"); - - print_cpuset_range((ulong_t *)&mbox->xc_cpuset, BT_BITOUL(ncpu), 5); - - mdb_printf(" ] %-16a %-16a %a\n", - mbox->xc_arg1, mbox->xc_arg2, mbox->xc_func); - - return (DCMD_OK); -} - -typedef struct vecint_walk_data { - intr_vec_t **vec_table; - uintptr_t vec_base; - size_t vec_idx; - size_t vec_size; -} vecint_walk_data_t; - -int -vecint_walk_init(mdb_walk_state_t *wsp) -{ - vecint_walk_data_t *vecint; - - if (wsp->walk_addr != (uintptr_t)NULL) { - mdb_warn("vecint walk only supports global walks\n"); - return (WALK_ERR); - } - - vecint = mdb_zalloc(sizeof (vecint_walk_data_t), UM_SLEEP); - - vecint->vec_size = MAXIVNUM * sizeof (intr_vec_t *); - vecint->vec_base = (uintptr_t)iv_sym.st_value; - vecint->vec_table = mdb_zalloc(vecint->vec_size, UM_SLEEP); - - if (mdb_vread(vecint->vec_table, vecint->vec_size, - vecint->vec_base) == -1) { - mdb_warn("couldn't read intr_vec_table"); - mdb_free(vecint->vec_table, vecint->vec_size); - mdb_free(vecint, sizeof (vecint_walk_data_t)); - return (WALK_ERR); - } - - wsp->walk_data = vecint; - return (WALK_NEXT); -} - -int -vecint_walk_step(mdb_walk_state_t *wsp) -{ - vecint_walk_data_t *vecint = (vecint_walk_data_t *)wsp->walk_data; - size_t max = vecint->vec_size / sizeof (intr_vec_t *); - intr_vec_t iv; - int status; - - if (wsp->walk_addr == (uintptr_t)NULL) { - while ((vecint->vec_idx < max) && ((wsp->walk_addr = - (uintptr_t)vecint->vec_table[vecint->vec_idx++]) == - (uintptr_t)NULL)) - continue; - } - - if (wsp->walk_addr == (uintptr_t)NULL) - return (WALK_DONE); - - status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data, - wsp->walk_cbdata); - - if (mdb_vread(&iv, sizeof (intr_vec_t), - (uintptr_t)wsp->walk_addr) == -1) { - mdb_warn("failed to read iv_p %p\n", wsp->walk_addr); - return (WALK_ERR); - } - - wsp->walk_addr = (uintptr_t)iv.iv_vec_next; - return (status); -} - -void -vecint_walk_fini(mdb_walk_state_t *wsp) -{ - vecint_walk_data_t *vecint = wsp->walk_data; - - mdb_free(vecint->vec_table, vecint->vec_size); - mdb_free(vecint, sizeof (vecint_walk_data_t)); -} - -int -vecint_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - intr_vec_t iv; - - if (!(flags & DCMD_ADDRSPEC)) { - if (mdb_walk_dcmd("vecint", "vecint", argc, argv) == -1) { - mdb_warn("can't walk vecint"); - return (DCMD_ERR); - } - return (DCMD_OK); - } - - if (DCMD_HDRSPEC(flags)) { - mdb_printf("%4s %?s %4s %?s %?s %s\n", "INUM", "ADDR", - "PIL", "ARG1", "ARG2", "HANDLER"); - } - - if (mdb_vread(&iv, sizeof (iv), addr) == -1) { - mdb_warn("couldn't read intr_vec_table at %p", addr); - return (DCMD_ERR); - } - - mdb_printf("%4x %?p %4d %?p %?p %a\n", iv.iv_inum, addr, - iv.iv_pil, iv.iv_arg1, iv.iv_arg2, iv.iv_handler); - - return (DCMD_OK); -} - -int -softint_walk_init(mdb_walk_state_t *wsp) -{ - intr_vec_t *list; - - if (wsp->walk_addr != (uintptr_t)NULL) { - mdb_warn("softint walk only supports global walks\n"); - return (WALK_ERR); - } - - /* Read global softint linked list pointer */ - if (mdb_readvar(&list, "softint_list") == -1) { - mdb_warn("failed to read the global softint_list pointer\n"); - return (WALK_ERR); - } - - wsp->walk_addr = (uintptr_t)list; - return (WALK_NEXT); -} - -/*ARGSUSED*/ -void -softint_walk_fini(mdb_walk_state_t *wsp) -{ - /* Nothing to do here */ -} - -int -softint_walk_step(mdb_walk_state_t *wsp) -{ - intr_vec_t iv; - int status; - - if (wsp->walk_addr == (uintptr_t)NULL) - return (WALK_DONE); - - status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data, - wsp->walk_cbdata); - - if (mdb_vread(&iv, sizeof (intr_vec_t), - (uintptr_t)wsp->walk_addr) == -1) { - mdb_warn("failed to read iv_p %p\n", wsp->walk_addr); - return (WALK_ERR); - } - - wsp->walk_addr = (uintptr_t)iv.iv_vec_next; - return (status); -} - -int -softint_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - intr_vec_t iv; - - if (!(flags & DCMD_ADDRSPEC)) { - if (mdb_walk_dcmd("softint", "softint", argc, argv) == -1) { - mdb_warn("can't walk softint"); - return (DCMD_ERR); - } - return (DCMD_OK); - } - - if (DCMD_HDRSPEC(flags)) { - mdb_printf("%?s %4s %4s %4s %?s %?s %s\n", "ADDR", "TYPE", - "PEND", "PIL", "ARG1", "ARG2", "HANDLER"); - } - - if (mdb_vread(&iv, sizeof (iv), addr) == -1) { - mdb_warn("couldn't read softint at %p", addr); - return (DCMD_ERR); - } - - mdb_printf("%?p %4s %4d %4d %?p %?p %a\n", addr, - (iv.iv_flags & IV_SOFTINT_MT) ? "M" : "S", - iv.iv_flags & IV_SOFTINT_PEND, iv.iv_pil, - iv.iv_arg1, iv.iv_arg2, iv.iv_handler); - - return (DCMD_OK); -} - -static int -whatis_walk_tt(uintptr_t taddr, const trap_trace_fullrec_t *ttf, - mdb_whatis_t *w) -{ - uintptr_t cur = 0; - - while (mdb_whatis_match(w, taddr, sizeof (struct trap_trace_record), - &cur)) - mdb_whatis_report_object(w, cur, taddr, - "trap trace record for cpu %d\n", ttf->ttf_cpu); - - return (WHATIS_WALKRET(w)); -} - -/*ARGSUSED*/ -static int -whatis_run_traptrace(mdb_whatis_t *w, void *ignored) -{ - GElf_Sym sym; - - if (mdb_lookup_by_name("trap_trace_ctl", &sym) == -1) - return (0); - - if (mdb_walk("ttrace", (mdb_walk_cb_t)whatis_walk_tt, w) == -1) - mdb_warn("failed to walk 'ttrace'"); - - return (0); -} - -/*ARGSUSED*/ -int -mutex_owner_init(mdb_walk_state_t *wsp) -{ - return (WALK_NEXT); -} - -int -mutex_owner_step(mdb_walk_state_t *wsp) -{ - uintptr_t addr = wsp->walk_addr; - mutex_impl_t mtx; - uintptr_t owner; - kthread_t thr; - - if (mdb_vread(&mtx, sizeof (mtx), addr) == -1) - return (WALK_ERR); - - if (!MUTEX_TYPE_ADAPTIVE(&mtx)) - return (WALK_DONE); - - if ((owner = (uintptr_t)MUTEX_OWNER(&mtx)) == (uintptr_t)NULL) - return (WALK_DONE); - - if (mdb_vread(&thr, sizeof (thr), owner) != -1) - (void) wsp->walk_callback(owner, &thr, wsp->walk_cbdata); - - return (WALK_DONE); -} - -static const mdb_dcmd_t dcmds[] = { - { "cpuset", ":[-l|-r]", "dump a cpuset_t", cmd_cpuset }, - { "ttctl", NULL, "dump trap trace ctl records", ttctl }, - { "ttrace", "[-x]", "dump trap trace buffer for a cpu", ttrace }, -#ifdef sun4v - { "httctl", NULL, "dump hv trap trace ctl records", httctl }, - { "httrace", "[-x]", "dump hv trap trace buffer for a cpu", httrace }, -#endif - { "xc_mbox", "?", "dump xcall mboxes", xc_mbox }, - { "xctrace", NULL, "dump xcall trace buffer", xctrace }, - { "vecint", NULL, "display a registered hardware interrupt", - vecint_dcmd }, - { "softint", NULL, "display a registered software interrupt", - softint_dcmd }, - { "sfmmu_vtop", ":[[-v] -a as]", "print virtual to physical mapping", - sfmmu_vtop }, - { "memseg_list", ":", "show memseg list", memseg_list }, - { "tsbinfo", ":[-l [-a]]", "show tsbinfo", tsbinfo_list, - tsbinfo_help }, - { NULL } -}; - -static const mdb_walker_t walkers[] = { - { "mutex_owner", "walks the owner of a mutex", - mutex_owner_init, mutex_owner_step }, - { "ttrace", "walks the trap trace buffer for a CPU", - ttrace_walk_init, ttrace_walk_step, ttrace_walk_fini }, -#ifdef sun4v - { "httrace", "walks the hv trap trace buffer for a CPU", - httrace_walk_init, httrace_walk_step, httrace_walk_fini }, -#endif - { "xc_mbox", "walks the cross call mail boxes", - xc_mbox_walk_init, xc_mbox_walk_step, xc_mbox_walk_fini }, - { "vecint", "walk the list of registered hardware interrupts", - vecint_walk_init, vecint_walk_step, vecint_walk_fini }, - { "softint", "walk the list of registered software interrupts", - softint_walk_init, softint_walk_step, softint_walk_fini }, - { "memseg", "walk the memseg structures", - memseg_walk_init, memseg_walk_step, memseg_walk_fini }, - { NULL } -}; - -static const mdb_modinfo_t modinfo = { MDB_API_VERSION, dcmds, walkers }; - -const mdb_modinfo_t * -_mdb_init(void) -{ - if (mdb_lookup_by_name("intr_vec_table", &iv_sym) == -1) { - mdb_warn("couldn't find intr_vec_table"); - return (NULL); - } - - mdb_whatis_register("traptrace", whatis_run_traptrace, NULL, - WHATIS_PRIO_EARLY, WHATIS_REG_NO_ID); - - return (&modinfo); -} diff --git a/usr/src/cmd/mdb/sun4u/modules/unix/v9/Makefile b/usr/src/cmd/mdb/sun4u/modules/unix/v9/Makefile deleted file mode 100644 index 9c23823491..0000000000 --- a/usr/src/cmd/mdb/sun4u/modules/unix/v9/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -MODULE = unix.so -MDBTGT = kvm - -MODSRCS = unix.c sfmmu.c - -include ../../../../../Makefile.cmd -include ../../../../../Makefile.cmd.64 -include ../../../../sparc/Makefile.sparcv9 -include ../../../Makefile.sun4u -include ../../../../Makefile.module - -CPPFLAGS += -DMP -D_MACHDEP -CPPFLAGS += -I../../../../common -CPPFLAGS += -I$(SRC)/uts/sun4 -CPPFLAGS += -I$(SRC)/uts/sun4u -CPPFLAGS += -I$(SRC)/uts/sfmmu -CPPFLAGS += -I$(SRC)/uts/sparc/v9 -CERRWARN += $(CNOWARN_UNINIT) diff --git a/usr/src/cmd/mdb/sun4u/v9/Makefile b/usr/src/cmd/mdb/sun4u/v9/Makefile deleted file mode 100644 index af751f2ce9..0000000000 --- a/usr/src/cmd/mdb/sun4u/v9/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -include ../../Makefile.common - -SUBDIRS = kmdb - -include ../../Makefile.subdirs - -.PARALLEL: $(SUBDIRS) - -# inter-module dependencies -kmdb: $(SRC)/cmd/mdb/sparc/v9/libstand $(SRC)/cmd/mdb/sparc/v9/libstandctf $(SRC)/cmd/mdb/sparc/v9/mdb_ks diff --git a/usr/src/cmd/mdb/sun4u/v9/Makefile.kmdb b/usr/src/cmd/mdb/sun4u/v9/Makefile.kmdb deleted file mode 100644 index 32fc72077b..0000000000 --- a/usr/src/cmd/mdb/sun4u/v9/Makefile.kmdb +++ /dev/null @@ -1,59 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" -# - -ARCHOPTS = -D__sparcv9cpu -D__sparcv9 - -ASFLAGS += -I$(ROOT)/usr/include/v9 -CPPFLAGS += -I$(ROOT)/usr/include/v9 - -PROMINCDIRS += $(SRC)/uts/sun4u - -KMDBML += \ - client_handler.s \ - kaif_handlers.s \ - kaif_invoke.s \ - kaif_resume.s \ - kaif_startup.s \ - kmdb_setcontext.s \ - kmdb_start.s \ - kmdb_v9asmutil.s - -KMDBSRCS += \ - mdb_v9util.c - -REGOFFUSERS = \ - kaif_resume.o \ - kaif_startup.o - -CTXOFFUSERS = \ - kmdb_setcontext.o - -$(REGOFFUSERS) $(REGOFFUSERS:%.o=%.ln): kaif_off.h - -$(CTXOFFUSERS) $(CTXOFFUSERS:%.o=%.ln): kmdb_context_off.h - diff --git a/usr/src/cmd/mdb/sun4u/v9/kmdb/Makefile b/usr/src/cmd/mdb/sun4u/v9/kmdb/Makefile deleted file mode 100644 index 15167ca0aa..0000000000 --- a/usr/src/cmd/mdb/sun4u/v9/kmdb/Makefile +++ /dev/null @@ -1,199 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - - -all: $(PROG) - -%.o: ../../../sparc/mdb/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.ln: ../../../sparc/mdb/%.c - $(LINT.c) -c $< - -kaif.fth: ../../../sparc/v9/kmdb/kaif_regs.h - -ROOT_MISC_DIR = $(ROOT)/platform/sun4u/kernel/misc -ROOT_MISC_DIR_64 = $(ROOT_MISC_DIR)/$(SUBDIR64) - -ROOTMISC = $(ROOT_MISC_DIR)/$(PROG) -ROOTMISC64 = $(ROOT_MISC_DIR_64)/$(PROG) - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../../sparc/Makefile.sparcv9 -include ../../../sparc/Makefile.kmdb.64 -include ../../../Makefile.kmdb - -STANDLIBS += $(ROOT)/usr/lib/sparcv9/libstanddisasm.so - -KMDB_FPTEST = \ - $(FINDFP) -x kaif_resume -x kaif_trap_common $@ - -# -# Uncomment the following line to enable trap accounting. A DTLB translation -# will be added for the trap table, and each handler installed by KMDB will use -# its padding to keep a trap count. See kaif_handlers.s. -# -#TRAPCOUNT = -DKMDB_TRAPCOUNT - -CPPFLAGS += -I../../../sparc/mdb -I.. -I$(SRC)/uts/sun4 -I$(SRC)/uts/sun4u $(TRAPCOUNT) -CPPFLAGS += -I$(SRC)/cmd/mdb/sparc/v9 -I$(SRC)/cmd/mdb/sparc/v9/kmdb -CPPFLAGS += -I$(SRC)/cmd/mdb/sparc -ASFLAGS += -I$(SRC)/uts/sun4 -I$(SRC)/uts/sun4u $(TRAPCOUNT) -ASFLAGS += -I$(SRC)/cmd/mdb/sparc -ASFLAGS += -I$(SRC)/cmd/mdb/sparc/v9 -I$(SRC)/cmd/mdb/sparc/v9/kmdb - -install: all $(ROOTMISC64) kaif.fth - -# -# lint rules -# - -.PARALLEL: lintkmdb lintprom lintkctl - -lint: lintkmdb lintprom lintkctl - $(LINT) $(ALLLINTFLAGS) $(KMDBOBJS:%.o=%.ln) $(PROMOBJS:%.o=%.ln) - -lintkmdb: $(KMDBOBJS:%.o=%.ln) - $(LINT) $(LINTFLAGS) $(KMDBOBJS:%.o=%.ln) - -lintprom: $(PROMOBJS:%.o=%.ln) - $(LINT) $(LINTFLAGS) $(PROMOBJS:%.o=%.ln) - -lintkctl: $(KCTLOBJS:%.o=%.ln) - $(LINT) $(ALLLINTFLAGS) $(KCTLOBJS:%.o=%.ln) - -kaif_off.h: ../../../sparc/kmdb/kaif_off.in - $(OFFSETS_CREATE) <../../../sparc/kmdb/kaif_off.in >$@ - -kmdb_context_off.h: ../../../sparc/kmdb/kmdb_context_off.in - $(OFFSETS_CREATE) <../../../sparc/kmdb/kmdb_context_off.in >$@ - -# -# Dynamic rules for object construction -# -%.o: ../../../common/kmdb/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -%.o: ../../../common/kmdb/kctl/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -%.o: ../../../common/kmdb/kctl/%.s - $(COMPILE.s) -o $@ $< - -%.o: ../../../common/mdb/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -%.o: ../../../sparc/kmdb/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -%.o: ../../../sparc/kmdb/%.s - $(COMPILE.s) -o $@ $< - -%.o: ../../../sparc/kmdb/kctl/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -%.o: ../../../sparc/kmdb/kctl/%.s - $(COMPILE.s) -o $@ $< - -%.o: ../../../sparc/mdb/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -%.o: ../../../sparc/v9/kmdb/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -%.o: ../../../sparc/v9/kmdb/%.s - $(COMPILE.s) -o $@ $< - -%.o: ../../../sparc/v9/kmdb/kctl/%.s - $(COMPILE.s) -o $@ $< - -%.o: $(SRC)/common/net/util/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -# -# Lint -# - -%.ln: ../../../common/kmdb/%.c - $(LINT.c) -c $< - -%.ln: ../../../common/kmdb/kctl/%.c - $(LINT.c) -c $< - -%.ln: ../../../common/kmdb/kctl/%.s - $(LINT.s) -c $< - -%.ln: ../../../common/mdb/%.c - $(LINT.c) -c $< - -%.ln: ../../../sparc/kmdb/%.c - $(LINT.c) -c $< - -%.ln: ../../../sparc/kmdb/%.s - $(LINT.s) -c $< - -%.ln: ../../../sparc/kmdb/kctl/%.c - $(LINT.c) -c $< - -%.ln: ../../../sparc/kmdb/kctl/%.s - $(LINT.s) -c $< - -%.ln: ../../../sparc/mdb/%.c - $(LINT.c) -c $< - -%.ln: ../../../sparc/v9/kmdb/%.c - $(LINT.c) -c $< - -%.ln: ../../../sparc/v9/kmdb/%.s - $(LINT.s) -c $< - -%.ln: ../../../sparc/v9/kmdb/kctl/%.s - $(LINT.s) -c $< - -%.ln: $(SRC)/common/net/util/%.c - $(LINT.c) -c $< - -# -# Installation targets -# - -$(ROOT_MISC_DIR) $(ROOT_MISC_DIR_64): - -$(INS.dir) - -$(ROOT_MISC_DIR)/%: % $(ROOT_MISC_DIR) - $(INS.file) - -$(ROOT_MISC_DIR_64)/%: % $(ROOT_MISC_DIR_64) - $(INS.file) diff --git a/usr/src/cmd/mdb/sun4u/v9/kmdb/mach_asmutil.h b/usr/src/cmd/mdb/sun4u/v9/kmdb/mach_asmutil.h deleted file mode 100644 index e7ee987f1b..0000000000 --- a/usr/src/cmd/mdb/sun4u/v9/kmdb/mach_asmutil.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -#ifndef _MACH_ASMUTIL_H -#define _MACH_ASMUTIL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _ASM - -#define GET_NWIN(scr1, reg1) \ - rdpr %ver, reg1;\ - and reg1, VER_MAXWIN, reg1 - -#define SET_GL(x) - -#define SWITCH_TO_NORMAL_GLOBALS() \ - mov %o5, %g3 /* save %o5 in %g3 */;\ - mov %o4, %g2 /* save %o4 in %g2 */;\ - mov %g5, %o5 /* set %o5 = gregs pointer */;\ - mov %g4, %o4 /* set %o4 = return %pstate value */;\ - wrpr %g0, PTSTATE_KERN_COMMON, %pstate /* AG = 0 */ - -#define SWITCH_TO_TL1_GLOBALS_AND_RET() \ - wrpr %o4, %pstate /* use TL1 globals, set %pstate from %o4 */;\ - mov %g3, %o5 /* restore saved %o5 from %g3 */;\ - jmp %g7;\ - mov %g2, %o4 /* restore saved %o4 from %g2 */ - -#define KAIF_SAVE_TL1_STATE() \ - ba kaif_save_tl1_state;\ - mov PTSTATE_KERN_COMMON|PSTATE_AG, %g4 - -#define KAIF_SAVE_TL1_STATE_SLAVE() \ - ba kaif_save_tl1_state;\ - mov PTSTATE_KERN_COMMON|PSTATE_IG, %g4 - -#define SET_PSTATE_COMMON_AG(reg1) \ - or %g0, PTSTATE_KERN_COMMON | PSTATE_AG, reg1;\ - wrpr reg1, %pstate - -#define KAIF_DEMAP_TLB_ALL(scr) \ - mov DEMAP_ALL_TYPE, scr; \ - stxa %g0, [scr]ASI_DTLB_DEMAP; \ - sethi %hi(FLUSH_ADDR), scr; \ - flush scr - -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _MACH_ASMUTIL_H */ diff --git a/usr/src/cmd/mdb/sun4v/Makefile b/usr/src/cmd/mdb/sun4v/Makefile deleted file mode 100644 index 809fb5b456..0000000000 --- a/usr/src/cmd/mdb/sun4v/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -SUBDIRS = modules v9 -include ../Makefile.subdirs - -modules: v9 diff --git a/usr/src/cmd/mdb/sun4v/Makefile.kmdb b/usr/src/cmd/mdb/sun4v/Makefile.kmdb deleted file mode 100644 index 6412a9f017..0000000000 --- a/usr/src/cmd/mdb/sun4v/Makefile.kmdb +++ /dev/null @@ -1,129 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -PROMSRCS += \ - prom_2path.c \ - prom_devname.c \ - prom_devtype.c \ - prom_enter.c \ - prom_env.c \ - prom_exit.c \ - prom_fb.c \ - prom_getchar.c \ - prom_init.c \ - prom_inpath.c \ - prom_interp.c \ - prom_io.c \ - prom_mmu.c \ - prom_node.c \ - prom_outpath.c \ - prom_panic.c \ - prom_phandle.c \ - prom_printf.c \ - prom_prop.c \ - prom_putchar.c \ - prom_reboot.c \ - prom_sparc.c \ - prom_stdin.c \ - prom_stdout.c \ - prom_string.c \ - promif_emul.c \ - promif_interp.c \ - promif_io.c \ - promif_mon.c \ - promif_node.c \ - promif_prop.c \ - promif_reboot.c \ - promif_stree.c - -KMDBSRCS += \ - kaif.c \ - kaif_activate.c \ - kaif_start_isadep.c \ - kmdb_dpi_isadep.c \ - kmdb_fault_isadep.c \ - kmdb_kdi_isadep.c \ - kmdb_makecontext.c \ - kmdb_promif_isadep.c \ - kvm_isadep.c - -KMDBML += \ - kmdb_asmutil.s - -KCTLSRCS += \ - kctl_isadep.c - -KCTLML += \ - kctl_asm.s - -SACPPFLAGS = -D__sparc - -STANDLIBS += \ - ../../../sparc/v9/libstandctf/libstandctf.so \ - $(SRC)/lib/libumem/$(MACHDIR)/libstandumem.so \ - ../../../sparc/v9/libstand/libstand.a - -KMDBLIBS = $(STANDLIBS) ../../../sparc/v9/mdb_ks/kmod/mdb_ks - -MAPFILE_SOURCES = \ - $(MAPFILE_SOURCES_COMMON) \ - ../../../sparc/kmdb/kmdb_dpi_isadep.h \ - $(MAPFILE_SOURCES_$(MACH)) - -%.fth: $(SRC)/cmd/mdb/sparc/kmdb/%.fdbg - grep '^#' <$< >$(<F).c - grep -v '^#' <$< >$(<F).tmp - $(CC) $(CTFSTABSCFLAGS) $(CPPFLAGS) $(CCGDEBUG) -c -o $(<F).o $(<F).c - $(CTFCONVERT) $(CTFCVTFLAGS) $(<F).o - $(CTFSTABS) -t forth -i $(<F).tmp -o $@ $(<F).o - $(RM) $(<F).c $(<F).tmp $(<F).o - -%.o: ../../../../../psm/promif/ieee1275/common/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.o: ../../../../../psm/promif/ieee1275/sun4/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.o: ../../../../../psm/promif/ieee1275/sun4u/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.o: ../../../../../uts/sun4v/promif/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.ln: ../../../../../psm/promif/ieee1275/common/%.c - $(LINT.c) -c $< - -%.ln: ../../../../../psm/promif/ieee1275/sun4/%.c - $(LINT.c) -c $< - -%.ln: ../../../../../psm/promif/ieee1275/sun4u/%.c - $(LINT.c) -c $< - -%.ln: ../../../../../uts/sun4v/promif/%.c - $(LINT.c) -c $< diff --git a/usr/src/cmd/mdb/sun4v/Makefile.sun4v b/usr/src/cmd/mdb/sun4v/Makefile.sun4v deleted file mode 100644 index de961c14c5..0000000000 --- a/usr/src/cmd/mdb/sun4v/Makefile.sun4v +++ /dev/null @@ -1,49 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# ident "%Z%%M% %I% %E% SMI" -# - -ROOTMOD = $(ROOT)/usr/platform/sun4v/lib/mdb/$(MDBTGT)$(MACHMODDIR) -ROOTKMOD = $(ROOT)/platform/sun4v/kernel/kmdb$(MACHMODDIR) - -$(ROOT)/usr/platform/sun4v/lib/mdb: - $(INS.dir) - -$(ROOT)/usr/platform/sun4v/lib/mdb/$(MDBTGT): $(ROOT)/usr/platform/sun4v/lib/mdb - $(INS.dir) - -$(ROOT)/usr/platform/sun4v/lib/mdb/$(MDBTGT)/sparcv9: \ - $(ROOT)/usr/platform/sun4v/lib/mdb/$(MDBTGT) - $(INS.dir) - -$(ROOT)/platform/sun4v/kernel: - $(INS.dir) - -$(ROOT)/platform/sun4v/kernel/kmdb: $(ROOT)/platform/sun4v/kernel - $(INS.dir) - -$(ROOT)/platform/sun4v/kernel/kmdb/sparcv9: $(ROOT)/platform/sun4v/kernel/kmdb - $(INS.dir) diff --git a/usr/src/cmd/mdb/sun4v/modules/Makefile b/usr/src/cmd/mdb/sun4v/modules/Makefile deleted file mode 100644 index f9bb56a3d2..0000000000 --- a/usr/src/cmd/mdb/sun4v/modules/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" -# - -SUBDIRS = errh ldc mdesc unix vdsk -include ../../Makefile.subdirs diff --git a/usr/src/cmd/mdb/sun4v/modules/errh/Makefile b/usr/src/cmd/mdb/sun4v/modules/errh/Makefile deleted file mode 100644 index 04a88a5bc8..0000000000 --- a/usr/src/cmd/mdb/sun4v/modules/errh/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" -# - -SUBDIRS = v9 -include ../../../Makefile.subdirs diff --git a/usr/src/cmd/mdb/sun4v/modules/errh/errh.c b/usr/src/cmd/mdb/sun4v/modules/errh/errh.c deleted file mode 100644 index 3554e1d559..0000000000 --- a/usr/src/cmd/mdb/sun4v/modules/errh/errh.c +++ /dev/null @@ -1,346 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -#include <sys/types.h> -#include <sys/time.h> -#include <sys/sysmacros.h> -#include <ctype.h> -#include <sys/mdb_modapi.h> -#include <sys/cpuvar.h> -#include <sys/machcpuvar.h> -#include <sys/error.h> - - -/*ARGSUSED*/ -int -resumable(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - uint_t verbose = 0; - cpu_t cpu; - uintptr_t current, first; - - if (flags & DCMD_ADDRSPEC) - return (DCMD_USAGE); - - if (mdb_getopts(argc, argv, - 'v', MDB_OPT_SETBITS, 1, &verbose, NULL) != argc) - return (DCMD_USAGE); - - if (mdb_readvar(&first, "cpu_list") == -1) { - mdb_warn("failed to read 'cpu_list'"); - return (DCMD_ERR); - } - - if (verbose) - mdb_printf("CPUID ADDRESS\n"); - - current = first; - do { - if (mdb_vread(&cpu, sizeof (cpu), current) == -1) { - mdb_warn("failed to read cpu at %p", current); - return (DCMD_ERR); - } - - if (verbose) { - if (cpu.cpu_m.cpu_rq_lastre == 0) - mdb_printf("%-5d empty\n", cpu.cpu_id); - else - mdb_printf("%-5d %lx\n", cpu.cpu_id, - cpu.cpu_m.cpu_rq_lastre); - } else if (cpu.cpu_m.cpu_rq_lastre != 0) - mdb_printf("%lx\n", cpu.cpu_m.cpu_rq_lastre); - } while ((current = (uintptr_t)cpu.cpu_next) != first); - - return (DCMD_OK); -} - -/*ARGSUSED*/ -int -nonresumable(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - uint_t verbose = 0; - cpu_t cpu; - uintptr_t current, first; - - if (flags & DCMD_ADDRSPEC) - return (DCMD_USAGE); - - if (mdb_getopts(argc, argv, - 'v', MDB_OPT_SETBITS, 1, &verbose, NULL) != argc) - return (DCMD_USAGE); - - if (mdb_readvar(&first, "cpu_list") == -1) { - mdb_warn("failed to read 'cpu_list'"); - return (DCMD_ERR); - } - - if (verbose) - mdb_printf("CPUID ADDRESS\n"); - - current = first; - do { - if (mdb_vread(&cpu, sizeof (cpu), current) == -1) { - mdb_warn("failed to read cpu at %p", current); - return (DCMD_ERR); - } - - if (verbose) { - if (cpu.cpu_m.cpu_nrq_lastnre == 0) - mdb_printf("%-5d empty\n", cpu.cpu_id); - else - mdb_printf("%-5d %lx\n", cpu.cpu_id, - cpu.cpu_m.cpu_nrq_lastnre); - } else if (cpu.cpu_m.cpu_nrq_lastnre != 0) - mdb_printf("%lx\n", cpu.cpu_m.cpu_nrq_lastnre); - } while ((current = (uintptr_t)cpu.cpu_next) != first); - - return (DCMD_OK); -} - -/*ARGSUSED*/ -int -rqueue(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - uint_t verbose = 0; - cpu_t cpu; - uintptr_t ao, lower, upper, current; - - if (!(flags & DCMD_ADDRSPEC)) - return (DCMD_USAGE); - - if (mdb_getopts(argc, argv, - 'v', MDB_OPT_SETBITS, 1, &verbose, NULL) != argc) - return (DCMD_USAGE); - - if (mdb_vread(&cpu, sizeof (cpu_t), addr) == -1) { - mdb_warn("failed to find cpu at %p", addr); - return (DCMD_ERR); - } - - ao = (uintptr_t)cpu.cpu_m.cpu_rq_lastre; /* beginning and end */ - lower = (uintptr_t)cpu.cpu_m.cpu_rq_va + CPU_RQ_SIZE; - upper = lower + CPU_RQ_SIZE - Q_ENTRY_SIZE; - - if (ao < lower || upper < ao) { - if (verbose) - mdb_printf("empty\n"); - return (DCMD_OK); - } - - for (current = ao; current >= lower; current -= Q_ENTRY_SIZE) - mdb_printf("%lx\n", current); - - for (current = upper; current > ao; current -= Q_ENTRY_SIZE) - mdb_printf("%lx\n", current); - - return (DCMD_OK); -} - -/*ARGSUSED*/ -int -nrqueue(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - uint_t verbose = 0; - cpu_t cpu; - uintptr_t lower, ao, upper; - uintptr_t current; - - if (!(flags & DCMD_ADDRSPEC)) - return (DCMD_USAGE); - - if (mdb_getopts(argc, argv, - 'v', MDB_OPT_SETBITS, 1, &verbose, NULL) != argc) - return (DCMD_USAGE); - - if (mdb_vread(&cpu, sizeof (cpu_t), addr) == -1) { - mdb_warn("failed to find cpu at %p", addr); - return (DCMD_ERR); - } - - ao = (uintptr_t)cpu.cpu_m.cpu_nrq_lastnre; /* beginning and end */ - lower = (uintptr_t)cpu.cpu_m.cpu_nrq_va + CPU_NRQ_SIZE; - upper = lower + CPU_NRQ_SIZE - Q_ENTRY_SIZE; - - if (ao < lower || upper < ao) { - if (verbose) - mdb_printf("empty\n"); - return (DCMD_OK); - } - - for (current = ao; current >= lower; current -= Q_ENTRY_SIZE) - mdb_printf("%lx\n", current); - - for (current = upper; current > ao; current -= Q_ENTRY_SIZE) - mdb_printf("%lx\n", current); - - return (DCMD_OK); -} - -/*ARGSUSED*/ -int -errh_prtaddr(uintptr_t addr, const void *data, void *private) -{ - mdb_printf("%lx\n", addr); - return (WALK_NEXT); -} - -int -rq_walk_init(mdb_walk_state_t *wsp) -{ - cpu_t cpu; - uintptr_t *ao, *lower, *upper; - - if (wsp->walk_addr == (uintptr_t)NULL) { - mdb_warn("address of struct cpu_t is required\n"); - return (WALK_ERR); - } - - if (mdb_vread(&cpu, sizeof (cpu_t), wsp->walk_addr) == -1) { - mdb_warn("failed to find cpu at %p", wsp->walk_addr); - return (WALK_ERR); - } - - wsp->walk_callback = (mdb_walk_cb_t)errh_prtaddr; - wsp->walk_addr = (uintptr_t)cpu.cpu_m.cpu_rq_lastre; - wsp->walk_data = mdb_alloc(sizeof (uintptr_t) * 3, UM_SLEEP); - - ao = lower = upper = wsp->walk_data; - lower += 1; - upper += 2; - - *ao = (uintptr_t)wsp->walk_addr; /* beginning and end */ - *lower = (uintptr_t)cpu.cpu_m.cpu_rq_va + CPU_RQ_SIZE; - *upper = (uintptr_t)*lower + CPU_RQ_SIZE - Q_ENTRY_SIZE; - - if (wsp->walk_addr < *lower || *upper < wsp->walk_addr) { - mdb_free(wsp->walk_data, sizeof (uintptr_t) * 3); - return (WALK_DONE); - } - - return (WALK_NEXT); -} - -int -nrq_walk_init(mdb_walk_state_t *wsp) -{ - cpu_t cpu; - uintptr_t *ao, *lower, *upper; - - if (wsp->walk_addr == (uintptr_t)NULL) { - mdb_warn("address of struct cpu_t is required\n"); - return (WALK_ERR); - } - - if (mdb_vread(&cpu, sizeof (cpu_t), wsp->walk_addr) == -1) { - mdb_warn("failed to find cpu at %p", wsp->walk_addr); - return (WALK_ERR); - } - - wsp->walk_callback = (mdb_walk_cb_t)errh_prtaddr; - wsp->walk_addr = (uintptr_t)cpu.cpu_m.cpu_nrq_lastnre; - wsp->walk_data = mdb_alloc(sizeof (uintptr_t) * 3, UM_SLEEP); - - ao = lower = upper = wsp->walk_data; - lower += 1; - upper += 2; - - *ao = (uintptr_t)wsp->walk_addr; /* beginning and end */ - *lower = (uintptr_t)cpu.cpu_m.cpu_nrq_va + CPU_NRQ_SIZE; - *upper = (uintptr_t)*lower + CPU_NRQ_SIZE - Q_ENTRY_SIZE; - - if (wsp->walk_addr < *lower || *upper < wsp->walk_addr) { - mdb_free(wsp->walk_data, sizeof (uintptr_t) * 3); - return (WALK_DONE); - } - - return (WALK_NEXT); -} - -int -errh_walk_step(mdb_walk_state_t *wsp) -{ - int status; - uintptr_t *ao, *lower, *upper; - - if (wsp->walk_addr == (uintptr_t)NULL) - return (WALK_DONE); - - status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data, - wsp->walk_cbdata); - - wsp->walk_addr -= Q_ENTRY_SIZE; - - ao = lower = upper = wsp->walk_data; - lower += 1; - upper += 2; - - if (wsp->walk_addr < *lower) - wsp->walk_addr = *upper; /* wrap around */ - else if (wsp->walk_addr == *ao) - return (WALK_DONE); /* end of loop */ - - return (status); -} - -void -errh_walk_fini(mdb_walk_state_t *wsp) -{ - mdb_free(wsp->walk_data, sizeof (uintptr_t) * 3); -} - -/* - * MDB module linkage information: - * - * Declare a list of structures describing dcmds, and a function - * named _mdb_init to return a pointer to module information. - */ - -static const mdb_dcmd_t dcmds[] = { - { "errhre", "[-v]", "addr of sun4v resumable error element", - resumable }, - { "errhnre", "[-v]", "addr of sun4v nonresumable error element", - nonresumable }, - { "errhrq", ":", "addr of sun4v resumable errors in RQ", rqueue }, - { "errhnrq", ":", "addr of sun4v nonresumable errors in NRQ", nrqueue }, - { NULL } -}; - -static const mdb_walker_t walkers[] = { - { "errhrq", "walk a cpu-specific sun4v resumble error queue", - rq_walk_init, errh_walk_step, errh_walk_fini, NULL }, - { "errhnrq", "walk a cpu-specific sun4v nonresumble error queue", - nrq_walk_init, errh_walk_step, errh_walk_fini, NULL }, - { NULL } -}; - -static const mdb_modinfo_t modinfo = { - MDB_API_VERSION, dcmds, walkers -}; - -const mdb_modinfo_t * -_mdb_init(void) -{ - return (&modinfo); -} diff --git a/usr/src/cmd/mdb/sun4v/modules/errh/v9/Makefile b/usr/src/cmd/mdb/sun4v/modules/errh/v9/Makefile deleted file mode 100644 index d07324efcb..0000000000 --- a/usr/src/cmd/mdb/sun4v/modules/errh/v9/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" -# - -MODULE = errh.so -MDBTGT = kvm - -MODSRCS = errh.c - -include ../../../../../Makefile.cmd -include ../../../../../Makefile.cmd.64 -include ../../../../sparc/Makefile.sparcv9 -include ../../../Makefile.sun4v -include ../../../../Makefile.module - -MODSRCS_DIR = ../ - -CPPFLAGS += -DMP -D_MACHDEP -CPPFLAGS += -Dsun4v -CPPFLAGS += -I$(SRC)/uts/sun4 -CPPFLAGS += -I$(SRC)/uts/sun4v -CPPFLAGS += -I$(SRC)/uts/sparc/v9 -CPPFLAGS += -I$(SRC)/cmd/mdb/common diff --git a/usr/src/cmd/mdb/sun4v/modules/ldc/Makefile b/usr/src/cmd/mdb/sun4v/modules/ldc/Makefile deleted file mode 100644 index 0af584001f..0000000000 --- a/usr/src/cmd/mdb/sun4v/modules/ldc/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# ident "%Z%%M% %I% %E% SMI" -# - -SUBDIRS = v9 -include ../../../Makefile.subdirs diff --git a/usr/src/cmd/mdb/sun4v/modules/ldc/ldc.c b/usr/src/cmd/mdb/sun4v/modules/ldc/ldc.c deleted file mode 100644 index 766f799e6e..0000000000 --- a/usr/src/cmd/mdb/sun4v/modules/ldc/ldc.c +++ /dev/null @@ -1,510 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -/* - * This module provides debugging tools for the LDoms channels (ldc) - */ - -#include <sys/mdb_modapi.h> -#include <sys/ldc.h> -#include <sys/ldc_impl.h> -#include <sys/hypervisor_api.h> - -#define ALLBITS (u_longlong_t)-1 - -const mdb_bitmask_t ldc_mode_bits[] = { - { "raw ", ALLBITS, LDC_MODE_RAW }, - { "unrel ", ALLBITS, LDC_MODE_UNRELIABLE }, - { "rel ", ALLBITS, LDC_MODE_RELIABLE }, - { NULL, 0, 0} -}; - -const mdb_bitmask_t ldc_status_bits[] = { - { "init ", ALLBITS, LDC_INIT }, - { "open ", ALLBITS, LDC_OPEN }, - { "ready ", ALLBITS, LDC_READY }, - { "up ", ALLBITS, LDC_UP }, - { NULL, 0, 0} -}; - -const mdb_bitmask_t ldc_tstate_bits[] = { - { "txq", TS_TXQ_RDY, TS_TXQ_RDY }, - { "rxq", TS_RXQ_RDY, TS_RXQ_RDY }, - { "hv_qconf", TS_QCONF_RDY, TS_QCONF_RDY }, - { "cnex_reg", TS_CNEX_RDY, TS_CNEX_RDY }, - { "hv_link_rdy", TS_LINK_READY, TS_LINK_READY }, - { "ver_done", TS_VER_DONE, TS_VER_DONE }, - { "hs_done", TS_HSHAKE_DONE, TS_HSHAKE_DONE }, - { NULL, 0, 0} -}; - -const mdb_bitmask_t ldc_hstate_bits[] = { - { "snt_ver", TS_SENT_VER, TS_SENT_VER }, - { "snt_rts", TS_SENT_RTS, TS_SENT_RTS }, - { "rcv_rtr", TS_RCVD_RTR, TS_RCVD_RTR }, - { "snt_rdx", TS_SENT_RDX, TS_SENT_RDX }, - { "rcv_ver", TS_RCVD_VER, TS_RCVD_VER }, - { "rcv_rts", TS_RCVD_RTS, TS_RCVD_RTS }, - { "snt_rtr", TS_SENT_RTR, TS_SENT_RTR }, - { "rcv_rdx", TS_RCVD_RDX, TS_RCVD_RDX }, - { NULL, 0, 0} -}; - -const mdb_bitmask_t ldc_class_bits[] = { - { "generic ", ALLBITS, LDC_DEV_GENERIC }, - { "blk ", ALLBITS, LDC_DEV_BLK }, - { "blk_svc ", ALLBITS, LDC_DEV_BLK_SVC }, - { "net ", ALLBITS, LDC_DEV_NT }, - { "net_svc ", ALLBITS, LDC_DEV_NT_SVC }, - { "serial ", ALLBITS, LDC_DEV_SERIAL }, - { NULL, 0, 0} -}; - -const mdb_bitmask_t ldc_intrstate_bits[] = { - { "none ", ALLBITS, LDC_INTR_NONE }, - { "active ", ALLBITS, LDC_INTR_ACTIVE }, - { "pending", ALLBITS, LDC_INTR_PEND }, - { NULL, 0, 0} -}; - -const mdb_bitmask_t ldc_linkstate_bits[] = { - { "down ", ALLBITS, LDC_CHANNEL_DOWN }, - { "reset", ALLBITS, LDC_CHANNEL_RESET }, - { "up ", ALLBITS, LDC_CHANNEL_UP }, - { NULL, 0, 0} -}; - -const mdb_bitmask_t msg_type_bits[] = { - { "ctrl", ALLBITS, LDC_CTRL }, - { "data", ALLBITS, LDC_DATA }, - { "err ", ALLBITS, LDC_ERR }, - { NULL, 0, 0} -}; - -const mdb_bitmask_t msg_stype_bits[] = { - { "info ", ALLBITS, LDC_INFO }, - { "ack ", ALLBITS, LDC_ACK }, - { "nack ", ALLBITS, LDC_NACK }, - { NULL, 0, 0} -}; - -const mdb_bitmask_t msg_ctrl_bits[] = { - { "ver ", ALLBITS, LDC_VER }, - { "rts ", ALLBITS, LDC_RTS }, - { "rtr ", ALLBITS, LDC_RTR }, - { "rdx ", ALLBITS, LDC_RDX }, - { NULL, 0, 0} -}; - -const mdb_bitmask_t mhdl_status_bits[] = { - { "unbound", ALLBITS, LDC_UNBOUND }, - { "bound ", LDC_BOUND, LDC_BOUND }, - { "mapped ", LDC_MAPPED, LDC_MAPPED }, - { NULL, 0, 0} -}; - -const mdb_bitmask_t mhdl_type_bits[] = { - { "shadow ", ALLBITS, LDC_SHADOW_MAP }, - { "direct ", ALLBITS, LDC_DIRECT_MAP }, - { "io ", ALLBITS, LDC_IO_MAP }, - { NULL, 0, 0} -}; - -const mdb_bitmask_t mhdl_perm_bits[] = { - { "r-- ", ALLBITS, LDC_MEM_R }, - { "-w- ", ALLBITS, LDC_MEM_W }, - { "--x ", ALLBITS, LDC_MEM_X }, - { "rw- ", ALLBITS, LDC_MEM_RW }, - { "rwx ", ALLBITS, LDC_MEM_RWX }, - { NULL, 0, 0} -}; - - -/* - * Print LDC channel information - */ -int -ldcinfo(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - uint_t verbose = FALSE; - ldc_chan_t ldcp; - - /* - * If no ldc_chan_t address was specified on the command line, - * we can print out all ldc channels by invoking the - * walker, using this dcmd itself as the callback. - */ - if (!(flags & DCMD_ADDRSPEC)) { - if (mdb_walk_dcmd("ldcinfo", "ldcinfo", argc, argv) == -1) { - mdb_warn("failed to walk 'ldcinfo'"); - return (DCMD_ERR); - } - return (DCMD_OK); - } - - - if (mdb_vread(&ldcp, sizeof (ldcp), addr) != sizeof (ldcp)) { - mdb_warn("failed to read ldc_chan_t at %p", addr); - return (DCMD_ERR); - } - - - if (mdb_getopts(argc, argv, - 'v', MDB_OPT_SETBITS, TRUE, &verbose, NULL) != argc) { - return (DCMD_USAGE); - } - - if (DCMD_HDRSPEC(flags)) { - mdb_printf("%-5s %-13s %-6s %-8s %-6s %-6s %-6s %-8s\n", - "ID", "ADDR", "MODE", "DEVCLASS", "STATUS", "TSTATE", - "HSTATE", "HV_LINK"); - } - - mdb_printf("0x%-3x 0x%p %b %b %b 0x%-4x 0x%-4x %b\n", - ldcp.id, addr, ldcp.mode, ldc_mode_bits, - ldcp.devclass, ldc_class_bits, - ldcp.status, ldc_status_bits, ldcp.tstate, ldcp.hstate, - ldcp.link_state, ldc_linkstate_bits); - - if (verbose) { - mdb_printf("Link State: %b\n", ldcp.tstate, ldc_tstate_bits); - mdb_printf("Hshake State: %b\n", ldcp.hstate, ldc_hstate_bits); - mdb_printf("Callback: %a(0x%p) - %s\n", - ldcp.cb, ldcp.cb_arg, - (ldcp.cb_enabled == 1) ? "enabled" : "disabled"); - mdb_printf("Tx Info: 0x%p len=0x%lx hd=0x%lx tl=0x%lx " - "intr=%b\n", ldcp.tx_q_va, ldcp.tx_q_entries, ldcp.tx_head, - ldcp.tx_tail, ldcp.tx_intr_state, ldc_intrstate_bits); - mdb_printf("Rx Info: 0x%p len=0x%lx intr=%b\n", - ldcp.rx_q_va, ldcp.rx_q_entries, - ldcp.rx_intr_state, ldc_intrstate_bits); - if (ldcp.mode == LDC_MODE_RELIABLE) { - mdb_printf("Rx Dq Info: 0x%p len=0x%lx hd=0x%lx " - "tl=0x%lx ackhd=0x%lx", ldcp.rx_dq_va, - ldcp.rx_dq_entries, ldcp.rx_dq_head, - ldcp.rx_dq_tail, ldcp.rx_ack_head); - mdb_printf("Stream: buf=0x%p off=0x%lx remains=0x%lx\n", - ldcp.stream_bufferp, ldcp.stream_offset, - ldcp.stream_remains); - } - if (ldcp.mtbl != NULL || ldcp.mhdl_list != NULL) - mdb_printf("Memory: mtbl=0x%p mhdl_list=0x%p\n", - ldcp.mtbl, ldcp.mhdl_list); - if (ldcp.exp_dring_list != NULL || ldcp.imp_dring_list != NULL) - mdb_printf("Desc Ring: exported=0x%p imported=0x%p\n", - ldcp.exp_dring_list, ldcp.imp_dring_list); - mdb_printf("\n"); - } - return (DCMD_OK); -} - - -/* - * ldcinfo walker initialization - */ -int -ldc_walk_init(mdb_walk_state_t *wsp) -{ - ldc_soft_state_t softstate; - - /* Must have a start addr. */ - if (wsp->walk_addr == (uintptr_t)NULL) { - if (mdb_readvar(&wsp->walk_addr, "ldcssp") == -1) { - mdb_warn("failed to read 'ldcssp'"); - return (WALK_ERR); - } - - if (wsp->walk_addr == (uintptr_t)NULL) - return (WALK_DONE); - - if (mdb_vread(&softstate, sizeof (softstate), wsp->walk_addr) - != sizeof (softstate)) { - mdb_warn("failed to read softstate %p", wsp->walk_addr); - return (WALK_ERR); - } - - wsp->walk_addr = (uintptr_t)softstate.chan_list; - } - - return (WALK_NEXT); -} - -/* - * ldcinfo walker step routine. - */ -int -ldc_walk_step(mdb_walk_state_t *wsp) -{ - int status; - ldc_chan_t ldcp; - - if (wsp->walk_addr == (uintptr_t)NULL) - return (WALK_DONE); - - if (mdb_vread(&ldcp, sizeof (ldc_chan_t), wsp->walk_addr) == -1) { - mdb_warn("failed to read at %p", wsp->walk_addr); - - return (WALK_ERR); - } - - status = wsp->walk_callback(wsp->walk_addr, &ldcp, - wsp->walk_cbdata); - wsp->walk_addr = (uintptr_t)ldcp.next; - - return (status); -} - - -/* - * dcmd to print ldc packet information - * - * arg0 - count (number of pkts to print) - */ -int -ldcmsg(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - ldc_msg_t msg; - uint64_t count = 1; - int i; - - /* - * If no ldc_msg_t address was specified on the command line, - * print usage. - */ - if (!(flags & DCMD_ADDRSPEC)) { - return (DCMD_USAGE); - } - - /* chk if we need to print more that one pkt */ - if (argc != 0) { - const mdb_arg_t *arg = &argv[0]; - - if (arg->a_type == MDB_TYPE_IMMEDIATE) - count = arg->a_un.a_val; - else - count = (uint64_t)mdb_strtoull(arg->a_un.a_str); - } - - /* print header */ - mdb_printf("%-13s %-10s %-4s %-5s %-4s %-11s %-4s %-10s\n", - "ADDR", "SEQID", "TYPE", "STYPE", "CTRL", "ENVELOPE", - "SIZE", "ACKID"); - - /* print pkt */ - for (i = 0; i < count; i++) { - - if (mdb_vread(&msg, sizeof (msg), addr) != sizeof (msg)) { - mdb_warn("failed to read ldc_msg_t at %p", addr); - return (DCMD_ERR); - } - - mdb_printf("0x%p 0x%-8x %b %b", addr, msg.seqid, - msg.type, msg_type_bits, msg.stype, msg_stype_bits); - - if (msg.type == LDC_CTRL) - mdb_printf(" %b ", msg.ctrl, msg_ctrl_bits); - else - mdb_printf(" %-4s ", "--"); - - mdb_printf("%-5s %-5s", - ((msg.env & LDC_FRAG_START) != 0) ? "start" : "--", - ((msg.env & LDC_FRAG_STOP) != 0) ? "stop" : "--"); - - /* print size */ - if (msg.type == LDC_DATA && msg.stype == LDC_INFO) - mdb_printf(" 0x%-2x ", (msg.env & LDC_LEN_MASK)); - else - mdb_printf(" %-4s ", "--"); - - /* print ackid if data/ack */ - if (msg.type == LDC_DATA && msg.stype == LDC_ACK) - mdb_printf("0x%-8x\n", msg.ackid); - else - mdb_printf("%-10s\n", "--"); - - /* next packet */ - addr = addr + LDC_PACKET_SIZE; - } - - return (DCMD_OK); -} - - -/* - * Print LDC map table information - */ -int -ldcmtbl(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - uint_t verbose = FALSE; - ldc_mtbl_t mtbl; - ldc_mte_slot_t mte; - uintptr_t mteaddr; - int i; - - /* - * If no ldc_mtbl_t address was specified on the command line, - * print usage. - */ - if (!(flags & DCMD_ADDRSPEC)) { - return (DCMD_USAGE); - } - - if (mdb_vread(&mtbl, sizeof (mtbl), addr) != sizeof (mtbl)) { - mdb_warn("failed to read ldc_mtbl_t at %p", addr); - return (DCMD_ERR); - } - - mdb_printf("Map Table: addr=0x%p total=%ld free=%ld tbl_base=0x%p\n", - addr, mtbl.num_entries, mtbl.num_avail, mtbl.table); - - if (mdb_getopts(argc, argv, - 'v', MDB_OPT_SETBITS, TRUE, &verbose, NULL) != argc) { - return (DCMD_USAGE); - } - if (!verbose) - return (DCMD_OK); - - /* print table header */ - mdb_printf("\n%-4s %-13s %-2s %-2s %-2s %-2s %-2s %-2s %-2s %-5s\n", - "IDX", "RA_PFN", "CW", "CR", "IW", "IR", "X", "W", "R", "PGSZC"); - - /* print each table entry */ - mteaddr = (uintptr_t)mtbl.table; - for (i = 0; i < mtbl.num_entries; i++) { - if (mdb_vread(&mte, sizeof (mte), mteaddr) != sizeof (mte)) { - return (DCMD_ABORT); - } - - /* skip empty entries */ - if (mte.entry.ll != 0) { - mdb_printf("%-4d 0x%-11x %-2d %-2d %-2d %-2d " - "%-2d %-2d %-2d 0x%-2x\n", - i, mte.entry.mte_bit.rpfn, mte.entry.mte_bit.cw, - mte.entry.mte_bit.cr, mte.entry.mte_bit.iw, - mte.entry.mte_bit.ir, mte.entry.mte_bit.x, - mte.entry.mte_bit.w, mte.entry.mte_bit.r, - mte.entry.mte_bit.pgszc); - } - mteaddr = mteaddr + sizeof (ldc_mte_slot_t); - } - return (DCMD_OK); -} - - - -/* - * Print LDC channel memory handle information - */ -int -ldcmhdl(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - ldc_mhdl_t mhdl; - ldc_memseg_t memseg; - uint64_t count = 1; - int i; - - /* - * If no ldc_msg_t address was specified on the command line, - * print usage. - */ - if (!(flags & DCMD_ADDRSPEC)) { - return (DCMD_USAGE); - } - - /* chk if we need to print more that one pkt */ - if (argc != 0) { - const mdb_arg_t *arg = &argv[0]; - - if (arg->a_type == MDB_TYPE_IMMEDIATE) - count = arg->a_un.a_val; - else - count = (uint64_t)mdb_strtoull(arg->a_un.a_str); - } - - mdb_printf("%-13s %-7s %-7s %-4s %-13s %-13s %-10s\n", - "ADDR", "STATUS", "MAPTYPE", "PERM", "MEMSEG", "VADDR", "SIZE"); - - /* print pkt */ - for (i = 0; i < count; i++) { - - if (mdb_vread(&mhdl, sizeof (mhdl), addr) != sizeof (mhdl)) { - mdb_warn("failed to read ldc_mhdl_t at %p", addr); - return (DCMD_ERR); - } - - mdb_printf("0x%p %b %b %b 0x%p ", - addr, mhdl.status, mhdl_status_bits, - mhdl.mtype, mhdl_type_bits, mhdl.perm, mhdl_perm_bits, - mhdl.memseg); - - if (mhdl.memseg != NULL) { - if (mdb_vread(&memseg, sizeof (memseg), - (uintptr_t)mhdl.memseg) != sizeof (memseg)) { - mdb_warn("failed to read ldc_memseg_t at %p", - mhdl.memseg); - return (DCMD_ERR); - } - - mdb_printf("0x%p 0x%-8lx\n", memseg.vaddr, memseg.size); - } else { - mdb_printf("\n"); - } - - if ((addr = (uintptr_t)mhdl.next) == (uintptr_t)NULL) - break; - } - - return (DCMD_OK); -} - - -/* - * MDB module linkage information: - */ -static const mdb_dcmd_t dcmds[] = { - { "ldcinfo", "?[-v]", "LDom channel information", ldcinfo }, - { "ldcmsg", ":[cnt]", "LDom channel message", ldcmsg }, - { "ldcmtbl", ":[-v]", "LDom channel map table", ldcmtbl }, - { "ldcmhdl", ":[cnt]", "LDom channel memory handles", ldcmhdl }, - { NULL } -}; - -static const mdb_walker_t walkers[] = { - { "ldcinfo", "List all LDom channels", - ldc_walk_init, ldc_walk_step, NULL }, - { NULL } -}; - -static const mdb_modinfo_t modinfo = { - MDB_API_VERSION, dcmds, walkers -}; - -const mdb_modinfo_t * -_mdb_init(void) -{ - return (&modinfo); -} diff --git a/usr/src/cmd/mdb/sun4v/modules/ldc/v9/Makefile b/usr/src/cmd/mdb/sun4v/modules/ldc/v9/Makefile deleted file mode 100644 index 8f53c91ab1..0000000000 --- a/usr/src/cmd/mdb/sun4v/modules/ldc/v9/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# ident "%Z%%M% %I% %E% SMI" -# - -MODULE = ldc.so -MDBTGT = kvm - -MODSRCS = ldc.c - -include ../../../../../Makefile.cmd -include ../../../../../Makefile.cmd.64 -include ../../../../sparc/Makefile.sparcv9 -include ../../../Makefile.sun4v -include ../../../../Makefile.module - -MODSRCS_DIR = ../ - -CPPFLAGS += -DMP -D_MACHDEP -CPPFLAGS += -Dsun4v -CPPFLAGS += -I$(SRC)/uts/sun4v -CPPFLAGS += -I$(SRC)/uts/sun4 -CPPFLAGS += -I$(SRC)/uts/sparc/v9 diff --git a/usr/src/cmd/mdb/sun4v/modules/mdesc/Makefile b/usr/src/cmd/mdb/sun4v/modules/mdesc/Makefile deleted file mode 100644 index 04a88a5bc8..0000000000 --- a/usr/src/cmd/mdb/sun4v/modules/mdesc/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" -# - -SUBDIRS = v9 -include ../../../Makefile.subdirs diff --git a/usr/src/cmd/mdb/sun4v/modules/mdesc/mdesc.c b/usr/src/cmd/mdb/sun4v/modules/mdesc/mdesc.c deleted file mode 100644 index b2c791690e..0000000000 --- a/usr/src/cmd/mdb/sun4v/modules/mdesc/mdesc.c +++ /dev/null @@ -1,310 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -#include <sys/types.h> -#include <sys/time.h> -#include <sys/sysmacros.h> -#include <ctype.h> -#include <sys/mdb_modapi.h> -#include <sys/mach_descrip.h> -#include <sys/mdesc.h> -#include <sys/mdesc_impl.h> - -/*ARGSUSED*/ -int -mdhdr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - uint_t verbose = 0; - uintptr_t mdp; - machine_descrip_t md; - - if (flags & DCMD_ADDRSPEC) - return (DCMD_USAGE); - - if (mdb_getopts(argc, argv, - 'v', MDB_OPT_SETBITS, 1, &verbose, NULL) != argc) - return (DCMD_USAGE); - - /* curr_mach_descrip normally points to /dev/mdesc */ - if (mdb_readvar(&mdp, "curr_mach_descrip") == -1) { - mdb_warn("failed to read 'curr_mach_descrip'"); - return (DCMD_ERR); - } - - if (verbose) - mdb_printf("ADDRESS VA MEMOPS SIZE\n"); - - do { - if (mdb_vread(&md, sizeof (md), mdp) == -1) { - mdb_warn("failed to read machine_descrip_t at %p", mdp); - return (DCMD_ERR); - } - - if (verbose) - mdb_printf("%-11lx %-11lx %-11lx %-11lx\n", - mdp, md.va, md.memops, md.size); - else - mdb_printf("%p\n", mdp); - - } while ((mdp = (uintptr_t)md.next) != (uintptr_t)NULL); - - return (DCMD_OK); -} - -/*ARGSUSED*/ -int -mdinfo(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - md_header_t mh; - machine_descrip_t md; - md_element_t *mdep; - char *namep; - uint8_t *datap; - int mdesize, namesize, datasize; - uintptr_t mdp; - md_element_t *mdeptr, *eof; - uintptr_t vaddr; - - if (flags & DCMD_ADDRSPEC) { - if ((addr & 7) != 0) { - mdb_warn("misaligned address at %p", addr); - return (DCMD_ERR); - } - vaddr = addr; - } else { - /* curr_mach_descrip normally points to /dev/mdesc */ - if (mdb_readvar(&mdp, "curr_mach_descrip") == -1) { - mdb_warn("failed to read 'curr_mach_descrip'"); - return (DCMD_ERR); - } - if (mdb_vread(&md, sizeof (md), mdp) == -1) { - mdb_warn("failed to read machine_descrip_t at %p", mdp); - return (DCMD_ERR); - } - vaddr = (uintptr_t)md.va; - } - - if (mdb_vread(&mh, sizeof (mh), vaddr) == -1) { - mdb_warn("failed to read md_header_t at %p", vaddr); - return (DCMD_ERR); - } - - mdesize = mh.node_blk_sz; - namesize = mh.name_blk_sz; - datasize = mh.data_blk_sz; - - /* find space for each section of the MD */ - if ((mdep = mdb_alloc(mdesize, UM_NOSLEEP)) == NULL) { - mdb_warn("failed to allocate memory for mde block"); - return (DCMD_ERR); - } - if ((namep = mdb_alloc(namesize, UM_NOSLEEP)) == NULL) { - mdb_warn("failed to allocate memory for name block"); - mdb_free(mdep, mdesize); - return (DCMD_ERR); - } - if ((datap = mdb_alloc(datasize, UM_NOSLEEP)) == NULL) { - mdb_warn("failed to allocate memory for data block"); - mdb_free(namep, namesize); - mdb_free(mdep, mdesize); - return (DCMD_ERR); - } - - /* store each of the MD sections */ - if (mdb_vread(mdep, mdesize, vaddr + MD_HEADER_SIZE) != mdesize) { - mdb_warn("failed to read node block %p", vaddr - + MD_HEADER_SIZE); - mdb_free(datap, datasize); - mdb_free(namep, namesize); - mdb_free(mdep, mdesize); - return (DCMD_ERR); - } - if (mdb_vread(namep, namesize, vaddr + MD_HEADER_SIZE + mdesize) - != namesize) { - mdb_warn("failed to read node block %p", vaddr + MD_HEADER_SIZE - + mdesize); - mdb_free(datap, datasize); - mdb_free(namep, namesize); - mdb_free(mdep, mdesize); - return (DCMD_ERR); - } - if (mdb_vread(datap, datasize, vaddr + MD_HEADER_SIZE + mdesize - + namesize) != datasize) { - mdb_warn("failed to read node block %p", vaddr + MD_HEADER_SIZE - + mdesize + namesize); - mdb_free(datap, datasize); - mdb_free(namep, namesize); - mdb_free(mdep, mdesize); - return (DCMD_ERR); - } - - mdb_printf("TYPE OFFSET NAME PROPERTY\n"); - eof = mdep + (mdesize / sizeof (md_element_t)); - for (mdeptr = mdep; mdeptr < eof; ++mdeptr) { - switch (MDE_TAG(mdeptr)) { - case MDET_NODE: - mdb_printf("node %-6x %-22s idx=%-11lx\n", - MDE_NAME(mdeptr), namep + mdeptr->name_offset, - MDE_PROP_INDEX(mdeptr)); - break; - case MDET_PROP_ARC: - mdb_printf("arc %-6x %-22s idx=%-11lx\n", - MDE_NAME(mdeptr), namep + mdeptr->name_offset, - MDE_PROP_INDEX(mdeptr)); - break; - case MDET_PROP_DAT: - mdb_printf("data %-6x %-22s len=%x, offset=%x\n", - MDE_NAME(mdeptr), namep + mdeptr->name_offset, - MDE_PROP_DATA_LEN(mdeptr), - MDE_PROP_DATA_OFFSET(mdeptr)); - break; - case MDET_PROP_STR: - mdb_printf("str %-6x %-22s len=%x, offset=%x\n", - MDE_NAME(mdeptr), namep + mdeptr->name_offset, - MDE_PROP_DATA_LEN(mdeptr), - MDE_PROP_DATA_OFFSET(mdeptr)); - break; - case MDET_PROP_VAL: - mdb_printf("val %-6x %-22s val=%-11lx\n", - MDE_NAME(mdeptr), namep + mdeptr->name_offset, - MDE_PROP_VALUE(mdeptr)); - break; - case MDET_NODE_END: - mdb_printf("end\n"); - break; - case MDET_NULL: - mdb_printf("null\n"); - break; - case MDET_LIST_END: - mdb_printf("end of list\n"); - break; - default: - mdb_printf("unkown tag=%x\n", MDE_TAG(mdeptr)); - break; - } - } - - mdb_free(datap, datasize); - mdb_free(namep, namesize); - mdb_free(mdep, mdesize); - return (DCMD_OK); -} - -/*ARGSUSED*/ -int -mdformat(uintptr_t addr, int size, int indent) -{ - mdb_inc_indent(indent); - if (mdb_dumpptr((uintptr_t)addr, size, - MDB_DUMP_RELATIVE | MDB_DUMP_TRIM | MDB_DUMP_ASCII | - MDB_DUMP_HEADER | MDB_DUMP_GROUP(4), NULL, NULL)) { - mdb_dec_indent(indent); - return (DCMD_ERR); - } - mdb_dec_indent(indent); - return (DCMD_OK); -} - -/*ARGSUSED*/ -int -mddump(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) -{ - uintptr_t mdp, mdep, namep, datap; - machine_descrip_t md; - md_header_t mh; - uintptr_t vaddr; - - if (flags & DCMD_ADDRSPEC) { - if ((addr & 7) != 0) { - mdb_warn("misaligned address at %p", addr); - return (DCMD_ERR); - } - vaddr = addr; - } else { - /* curr_mach_descrip normally points to /dev/mdesc */ - if (mdb_readvar(&mdp, "curr_mach_descrip") == -1) { - mdb_warn("failed to read 'curr_mach_descrip'"); - return (DCMD_ERR); - } - if (mdb_vread(&md, sizeof (md), mdp) == -1) { - mdb_warn("failed to read machine_descrip_t at %p", mdp); - return (DCMD_ERR); - } - vaddr = (uintptr_t)md.va; - } - - if (mdb_vread(&mh, sizeof (mh), (uintptr_t)vaddr) == -1) { - mdb_warn("failed to read md_header_t at %p", vaddr); - return (DCMD_ERR); - } - - mdep = (uintptr_t)vaddr + MD_HEADER_SIZE; - namep = mdep + mh.node_blk_sz; - datap = namep + mh.name_blk_sz; - - mdb_printf("header (md_header_t) section at %lx:\n", vaddr); - if (mdformat((uintptr_t)md.va, MD_HEADER_SIZE, 4) != DCMD_OK) - return (DCMD_ERR); - - mdb_printf("\nnode (md_element_t) section at %lx:\n", mdep); - if (mdformat(mdep, mh.node_blk_sz, 2) != DCMD_OK) - return (DCMD_ERR); - - mdb_printf("\nname section at %lx:\n", namep); - if (mdformat(namep, mh.name_blk_sz, 2) != DCMD_OK) - return (DCMD_ERR); - - mdb_printf("\ndata section at %lx:\n", datap); - if (mdformat(datap, mh.data_blk_sz, 2) != DCMD_OK) - return (DCMD_ERR); - - return (DCMD_OK); -} - -/* - * MDB module linkage information: - * - * Declare a list of structures describing dcmds, and a function - * named _mdb_init to return a pointer to module information. - */ - -static const mdb_dcmd_t dcmds[] = { - { "mdeschdr", "[-v]", "addr of current sun4v MD header", mdhdr }, - { "mdescinfo", "?", "print md_elements with names from sun4v MD", - mdinfo }, - { "mdescdump", "?", "dump node, name, data sections of sun4v MD", - mddump }, - { NULL } -}; - -static const mdb_modinfo_t modinfo = { - MDB_API_VERSION, dcmds, NULL -}; - -const mdb_modinfo_t * -_mdb_init(void) -{ - return (&modinfo); -} diff --git a/usr/src/cmd/mdb/sun4v/modules/mdesc/v9/Makefile b/usr/src/cmd/mdb/sun4v/modules/mdesc/v9/Makefile deleted file mode 100644 index 3ed6265556..0000000000 --- a/usr/src/cmd/mdb/sun4v/modules/mdesc/v9/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" -# - -MODULE = mdesc.so -MDBTGT = kvm - -MODSRCS = mdesc.c - -include ../../../../../Makefile.cmd -include ../../../../../Makefile.cmd.64 -include ../../../../sparc/Makefile.sparcv9 -include ../../../Makefile.sun4v -include ../../../../Makefile.module - -MODSRCS_DIR = ../ - -CPPFLAGS += -DMP -D_MACHDEP -CPPFLAGS += -Dsun4v -CPPFLAGS += -I$(SRC)/uts/sun4 -CPPFLAGS += -I$(SRC)/uts/sun4v -CPPFLAGS += -I$(SRC)/uts/sparc/v9 -CPPFLAGS += -I$(SRC)/cmd/mdb/common diff --git a/usr/src/cmd/mdb/sun4v/modules/unix/Makefile b/usr/src/cmd/mdb/sun4v/modules/unix/Makefile deleted file mode 100644 index 387148a1bf..0000000000 --- a/usr/src/cmd/mdb/sun4v/modules/unix/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -SUBDIRS = v9 -include ../../../Makefile.subdirs diff --git a/usr/src/cmd/mdb/sun4v/modules/unix/v9/Makefile b/usr/src/cmd/mdb/sun4v/modules/unix/v9/Makefile deleted file mode 100644 index 30ea58449a..0000000000 --- a/usr/src/cmd/mdb/sun4v/modules/unix/v9/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# - -MODULE = unix.so -MDBTGT = kvm - -MODSRCS = unix.c sfmmu.c - -include ../../../../../Makefile.cmd -include ../../../../../Makefile.cmd.64 -include ../../../../sparc/Makefile.sparcv9 -include ../../../Makefile.sun4v -include ../../../../Makefile.module - -MODSRCS_DIR = ../../../../sun4u/modules/unix - -CPPFLAGS += -DMP -D_MACHDEP -CPPFLAGS += -Dsun4v -CPPFLAGS += -I../../../../common -CPPFLAGS += -I$(SRC)/uts/sun4 -CPPFLAGS += -I$(SRC)/uts/sun4v -CPPFLAGS += -I$(SRC)/uts/sun4u -CPPFLAGS += -I$(SRC)/uts/sfmmu -CPPFLAGS += -I$(SRC)/uts/sparc/v9 -CERRWARN += $(CNOWARN_UNINIT) diff --git a/usr/src/cmd/mdb/sun4v/modules/vdsk/Makefile b/usr/src/cmd/mdb/sun4v/modules/vdsk/Makefile deleted file mode 100644 index 4c5460e696..0000000000 --- a/usr/src/cmd/mdb/sun4v/modules/vdsk/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" -# - -SUBDIRS = v9 -include ../../../Makefile.subdirs diff --git a/usr/src/cmd/mdb/sun4v/modules/vdsk/v9/Makefile b/usr/src/cmd/mdb/sun4v/modules/vdsk/v9/Makefile deleted file mode 100644 index 42ffab660e..0000000000 --- a/usr/src/cmd/mdb/sun4v/modules/vdsk/v9/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -# ident "%Z%%M% %I% %E% SMI" -# - -MODULE = vdsk.so -MDBTGT = kvm - -MODSRCS = vdsk.c - -include ../../../../../Makefile.cmd -include ../../../../../Makefile.cmd.64 -include ../../../../sparc/Makefile.sparcv9 -include ../../../Makefile.sun4v -include ../../../../Makefile.module - -MODSRCS_DIR = ../ - -CPPFLAGS += -DMP -D_MACHDEP -CPPFLAGS += -Dsun4v -CPPFLAGS += -I$(SRC)/uts/sun4v -CPPFLAGS += -I$(SRC)/uts/sun4 -CPPFLAGS += -I$(SRC)/uts/sparc/v9 diff --git a/usr/src/cmd/mdb/sun4v/modules/vdsk/vdsk.c b/usr/src/cmd/mdb/sun4v/modules/vdsk/vdsk.c deleted file mode 100644 index c404a3fb98..0000000000 --- a/usr/src/cmd/mdb/sun4v/modules/vdsk/vdsk.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -/* - * This module provides debugging tools for the LDoms vDisk drivers - * (vds and vdc). - */ - -#include <sys/mdb_modapi.h> - -#include <sys/vdsk_common.h> - -/* - */ -int -vd_dring_entry_walk_init(mdb_walk_state_t *wsp) -{ - /* Must have a start addr. */ - if (wsp->walk_addr == (uintptr_t)NULL) { - mdb_warn("Descriptor Ring base address required\n"); - - return (WALK_ERR); - } - - return (WALK_NEXT); -} - - -/* - * Generic entry walker step routine. - */ -int -vd_dring_entry_walk_step(mdb_walk_state_t *wsp) -{ - static int entry_count = 0; - int status; - vd_dring_entry_t dring_entry; - - if (mdb_vread(&dring_entry, VD_DRING_ENTRY_SZ, - (uintptr_t)wsp->walk_addr) == -1) { - mdb_warn("failed to read vd_dring_entry_t at %p", - wsp->walk_addr); - - return (WALK_ERR); - } - - status = wsp->walk_callback(wsp->walk_addr, &dring_entry, - wsp->walk_cbdata); - wsp->walk_addr = (uintptr_t)(wsp->walk_addr + VD_DRING_ENTRY_SZ); - - /* Check if we're at the last element */ - if (++entry_count >= VD_DRING_LEN) { - /* reset counter for next call to this walker */ - entry_count = 0; - - return (WALK_DONE); - } - - return (status); -} - -/* - * MDB module linkage information: - */ - -static const mdb_walker_t walkers[] = { - { "vd_dring_entry", "walk vDisk public Descriptor Ring entries", - vd_dring_entry_walk_init, vd_dring_entry_walk_step, NULL, NULL }, - { NULL } -}; - -static const mdb_modinfo_t modinfo = { - MDB_API_VERSION, NULL, walkers -}; - -const mdb_modinfo_t * -_mdb_init(void) -{ - return (&modinfo); -} diff --git a/usr/src/cmd/mdb/sun4v/v9/Makefile b/usr/src/cmd/mdb/sun4v/v9/Makefile deleted file mode 100644 index af751f2ce9..0000000000 --- a/usr/src/cmd/mdb/sun4v/v9/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" - -include ../../Makefile.common - -SUBDIRS = kmdb - -include ../../Makefile.subdirs - -.PARALLEL: $(SUBDIRS) - -# inter-module dependencies -kmdb: $(SRC)/cmd/mdb/sparc/v9/libstand $(SRC)/cmd/mdb/sparc/v9/libstandctf $(SRC)/cmd/mdb/sparc/v9/mdb_ks diff --git a/usr/src/cmd/mdb/sun4v/v9/Makefile.kmdb b/usr/src/cmd/mdb/sun4v/v9/Makefile.kmdb deleted file mode 100644 index 3e45c49ee2..0000000000 --- a/usr/src/cmd/mdb/sun4v/v9/Makefile.kmdb +++ /dev/null @@ -1,59 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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. -# -#ident "%Z%%M% %I% %E% SMI" -# - -ARCHOPTS = -D__sparcv9cpu -D__sparcv9 - -ASFLAGS += -I$(ROOT)/usr/include/v9 -CPPFLAGS += -I$(ROOT)/usr/include/v9 - -PROMINCDIRS += $(SRC)/uts/sun4u - -KMDBML += \ - client_handler.s \ - hcall.s \ - kaif_handlers.s \ - kaif_invoke.s \ - kaif_resume.s \ - kaif_startup.s \ - kmdb_setcontext.s \ - kmdb_start.s \ - kmdb_v9asmutil.s - -KMDBSRCS += \ - mdb_v9util.c - -REGOFFUSERS = \ - kaif_resume.o \ - kaif_startup.o - -CTXOFFUSERS = \ - kmdb_setcontext.o - -$(REGOFFUSERS) $(REGOFFUSERS:%.o=%.ln): kaif_off.h - -$(CTXOFFUSERS) $(CTXOFFUSERS:%.o=%.ln): kmdb_context_off.h - diff --git a/usr/src/cmd/mdb/sun4v/v9/kmdb/Makefile b/usr/src/cmd/mdb/sun4v/v9/kmdb/Makefile deleted file mode 100644 index d22287ce44..0000000000 --- a/usr/src/cmd/mdb/sun4v/v9/kmdb/Makefile +++ /dev/null @@ -1,213 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - - -all: $(PROG) - -%.o: ../../../sparc/mdb/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.ln: ../../../sparc/mdb/%.c - $(LINT.c) -c $< - -kaif.fth: ../../../sparc/v9/kmdb/kaif_regs.h - -ROOT_MISC_DIR = $(ROOT)/platform/sun4v/kernel/misc -ROOT_MISC_DIR_64 = $(ROOT_MISC_DIR)/$(SUBDIR64) - -ROOTMISC = $(ROOT_MISC_DIR)/$(PROG) -ROOTMISC64 = $(ROOT_MISC_DIR_64)/$(PROG) - -include ../../../../Makefile.cmd -include ../../../../Makefile.cmd.64 -include ../../../sparc/Makefile.sparcv9 -include ../../../sparc/Makefile.kmdb.64 -include ../../../Makefile.kmdb - -STANDLIBS += $(ROOT)/usr/lib/sparcv9/libstanddisasm.so - -KMDB_FPTEST = \ - $(FINDFP) -x kaif_resume -x kaif_trap_common $@ - -# -# Uncomment the following line to enable trap accounting. A DTLB translation -# will be added for the trap table, and each handler installed by KMDB will use -# its padding to keep a trap count. See kaif_handlers.s. -# -# NOTE: not currently supported by the sun4v fast miss handlers. See -# ../../../sparc/v9/kmdb/kaif_handlers.s to verify before use. -# -#TRAPCOUNT = -DKMDB_TRAPCOUNT - -CPPFLAGS += -I../../../sparc/mdb -I.. -I$(SRC)/uts/sun4 -I$(SRC)/uts/sun4v -CPPFLAGS += $(TRAPCOUNT) -CPPFLAGS += -Dsun4v -CPPFLAGS += -I$(SRC)/cmd/mdb/sparc -CPPFLAGS += -I$(SRC)/cmd/mdb/sparc/v9 -I$(SRC)/cmd/mdb/sparc/v9/kmdb -ASFLAGS += -xarch=v9v -I$(SRC)/uts/sun4 -I$(SRC)/uts/sun4v $(TRAPCOUNT) -ASFLAGS += -Dsun4v -ASFLAGS += -I$(SRC)/cmd/mdb/sparc -ASFLAGS += -I$(SRC)/cmd/mdb/sparc/v9 -I$(SRC)/cmd/mdb/sparc/v9/kmdb -CERRWARN += -_gcc=-Wno-unused-function - -install: all $(ROOTMISC64) kaif.fth - -# -# lint rules -# - -.PARALLEL: lintkmdb lintprom lintkctl - -lint: lintkmdb lintprom lintkctl - $(LINT) $(ALLLINTFLAGS) $(KMDBOBJS:%.o=%.ln) $(PROMOBJS:%.o=%.ln) - -lintkmdb: $(KMDBOBJS:%.o=%.ln) - $(LINT) $(LINTFLAGS) $(KMDBOBJS:%.o=%.ln) - -lintprom: $(PROMOBJS:%.o=%.ln) - $(LINT) $(LINTFLAGS) $(PROMOBJS:%.o=%.ln) - -lintkctl: $(KCTLOBJS:%.o=%.ln) - $(LINT) $(ALLLINTFLAGS) $(KCTLOBJS:%.o=%.ln) - -kaif_off.h: ../../../sparc/kmdb/kaif_off.in - $(OFFSETS_CREATE) <../../../sparc/kmdb/kaif_off.in >$@ - -kmdb_context_off.h: ../../../sparc/kmdb/kmdb_context_off.in - $(OFFSETS_CREATE) <../../../sparc/kmdb/kmdb_context_off.in >$@ - -# -# Dynamic rules for object construction -# -%.o: ../../../common/kmdb/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -%.o: ../../../common/kmdb/kctl/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -%.o: ../../../common/kmdb/kctl/%.s - $(COMPILE.s) -o $@ $< - -%.o: ../../../common/mdb/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -%.o: ../../../sparc/kmdb/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -%.o: ../../../sparc/kmdb/%.s - $(COMPILE.s) -o $@ $< - -%.o: ../../../sparc/kmdb/kctl/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -%.o: ../../../sparc/kmdb/kctl/%.s - $(COMPILE.s) -o $@ $< - -%.o: ../../../sparc/mdb/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -%.o: ../../../sparc/v9/kmdb/%.c - $(COMPILE.c) -o $@ $< - $(CTFCONVERT_O) - -%.o: ../../../sparc/v9/kmdb/%.s - $(COMPILE.s) -o $@ $< - -%.o: ../../../sparc/v9/kmdb/kctl/%.s - $(COMPILE.s) -o $@ $< - -%.o: $(SRC)/common/net/util/%.c - $(COMPILE.c) $< - $(CTFCONVERT_O) - -%.o: ../../../../../uts/sun4v/ml/%.s - $(COMPILE.s) -o $@ $< - -# -# Lint -# - -%.ln: ../../../common/kmdb/%.c - $(LINT.c) -c $< - -%.ln: ../../../common/kmdb/kctl/%.c - $(LINT.c) -c $< - -%.ln: ../../../common/kmdb/kctl/%.s - $(LINT.s) -c $< - -%.ln: ../../../common/mdb/%.c - $(LINT.c) -c $< - -%.ln: ../../../sparc/kmdb/%.c - $(LINT.c) -c $< - -%.ln: ../../../sparc/kmdb/%.s - $(LINT.s) -c $< - -%.ln: ../../../sparc/kmdb/kctl/%.c - $(LINT.c) -c $< - -%.ln: ../../../sparc/kmdb/kctl/%.s - $(LINT.s) -c $< - -%.ln: ../../../sparc/mdb/%.c - $(LINT.c) -c $< - -%.ln: ../../../sparc/v9/kmdb/%.c - $(LINT.c) -c $< - -%.ln: ../../../sparc/v9/kmdb/%.s - $(LINT.s) -c $< - -%.ln: ../../../sparc/v9/kmdb/kctl/%.s - $(LINT.s) -c $< - -%.ln: $(SRC)/common/net/util/%.c - $(LINT.c) -c $< - -%.ln: ../../../../../uts/sun4v/ml/%.s - $(LINT.s) -c $< - -# -# Installation targets -# - -$(ROOT_MISC_DIR) $(ROOT_MISC_DIR_64): - -$(INS.dir) - -$(ROOT_MISC_DIR)/%: % $(ROOT_MISC_DIR) - $(INS.file) - -$(ROOT_MISC_DIR_64)/%: % $(ROOT_MISC_DIR_64) - $(INS.file) diff --git a/usr/src/cmd/mdb/sun4v/v9/kmdb/mach_asmutil.h b/usr/src/cmd/mdb/sun4v/v9/kmdb/mach_asmutil.h deleted file mode 100644 index 26e4672f73..0000000000 --- a/usr/src/cmd/mdb/sun4v/v9/kmdb/mach_asmutil.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ - -#ifndef _MACH_ASMUTIL_H -#define _MACH_ASMUTIL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _ASM - -#define GET_NWIN(scr1, reg1) \ - rdpr %cwp, scr1; /* save current %cwp */ \ - wrpr %g0, 0x1f, %cwp; \ - rdpr %cwp, reg1; \ - wrpr %g0, scr1, %cwp /* restore current %cwp */ - -#define SET_GL(x) \ - wrpr %g0, x, %gl - -#define SWITCH_TO_NORMAL_GLOBALS() \ - /* tempararily save %o5 and %o4 and %o3 */; \ - stx %o5, [%g5 + KREG_OFF(KREG_O5)]; \ - stx %o4, [%g5 + KREG_OFF(KREG_O4)]; \ - stx %o3, [%g5 + KREG_OFF(KREG_O3)]; \ - /* now save %g5, %g4 and %g7 cause we are going to gl 0 */; \ - mov %g5, %o5 /* %o5 is gregs pointer now */; \ - mov %g4, %o4 /* %o4 is %pstate value now */; \ - mov %g7, %o3 /* %o3 is return pc now */; \ - SET_GL(0); /* normal globals */ - -#define SWITCH_TO_TL1_GLOBALS_AND_RET() \ - SET_GL(1) /* use TL1 globals, set %pstate from %o4 */;\ - mov %o4, %g4 /* restore %g4 as %pstate */; \ - mov %o5, %g5 /* restore %g5 as gregs pointer */; \ - mov %o3, %g7 /* retore %g7 as return pc */; \ - ldx [%g5 + KREG_OFF(KREG_O5)], %o5 /* restore saved %o5 */; \ - ldx [%g5 + KREG_OFF(KREG_O4)], %o4 /* restore saved %o4 */; \ - jmp %g7; \ - ldx [%g5 + KREG_OFF(KREG_O3)], %o3 /* restore saved %o3 */ - -#define KAIF_SAVE_TL1_STATE() \ - ba kaif_save_tl1_state;\ - mov PTSTATE_KERN_COMMON, %g4 - -#define KAIF_SAVE_TL1_STATE_SLAVE() KAIF_SAVE_TL1_STATE() - -#define SET_PSTATE_COMMON_AG(reg1) \ - or %g0, PTSTATE_KERN_COMMON, reg1;\ - wrpr reg1, %pstate - -#define KAIF_DEMAP_TLB_ALL(scr) - -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _MACH_ASMUTIL_H */ diff --git a/usr/src/cmd/mdb/tools/Makefile b/usr/src/cmd/mdb/tools/Makefile index 3ed9c7ad7d..ad1d9684e1 100644 --- a/usr/src/cmd/mdb/tools/Makefile +++ b/usr/src/cmd/mdb/tools/Makefile @@ -23,11 +23,12 @@ # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright 2022 Garrett D'Amore +# include $(SRC)/Makefile.master -SUBDIRS_sparc = findfp -SUBDIRS = scripts setdynflag $(SUBDIRS_$(MACH)) +SUBDIRS = scripts setdynflag .PARALLEL: $(SUBDIRS) diff --git a/usr/src/cmd/mdb/tools/findfp/Makefile b/usr/src/cmd/mdb/tools/findfp/Makefile deleted file mode 100644 index 6b85bddbf3..0000000000 --- a/usr/src/cmd/mdb/tools/findfp/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include ../../../Makefile.cmd - -SUBDIRS = $(MACH) - -include ../../Makefile.subdirs - diff --git a/usr/src/cmd/mdb/tools/findfp/Makefile.com b/usr/src/cmd/mdb/tools/findfp/Makefile.com deleted file mode 100644 index 7258550fb6..0000000000 --- a/usr/src/cmd/mdb/tools/findfp/Makefile.com +++ /dev/null @@ -1,69 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -.KEEP_STATE: - -PROG = findfp - -SRCS = \ - die.c \ - findfp.c \ - findscn.c \ - findsym.c -OBJS = $(SRCS:%.c=%.o) - -include ../../../../Makefile.cmd -include ../../common/Makefile.util - -# -# We're going to run this as part of the build, so we want it to use the -# running kernel's includes and libraries. -# -CPPFLAGS = -I../../common -I../common -CFLAGS = $(NATIVE_CFLAGS) $(CCVERBOSE) -CERRWARN += $(CNOWARN_UNINIT) -LDFLAGS = $(NATIVE_LDFLAGS) $(ZLAZYLOAD) $(BDIRECT) -LDLIBS = -lelf -CC = $(NATIVECC) -LD = $(NATIVELD) -NATIVE_LIBS += libelf.so libc.so - -install all: $(PROG) - -clobber clean: - $(RM) $(OBJS) $(PROG) - -$(PROG): $(OBJS) - $(LINK.c) $(OBJS) -o $@ $(LDLIBS) - $(POST_PROCESS) - -%.o: %.c - $(COMPILE.c) $< - $(POST_PROCESS_O) - -%.o: ../common/%.c - $(COMPILE.c) $< - $(POST_PROCESS_O) diff --git a/usr/src/cmd/mdb/tools/findfp/common/findfp.h b/usr/src/cmd/mdb/tools/findfp/common/findfp.h deleted file mode 100644 index 806ea98e04..0000000000 --- a/usr/src/cmd/mdb/tools/findfp/common/findfp.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _FINDFP_H -#define _FINDFP_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -extern int findelfsym(Elf *, uintptr_t, char **, offset_t *); - -#ifdef __cplusplus -} -#endif - -#endif /* _FINDFP_H */ diff --git a/usr/src/cmd/mdb/tools/findfp/common/findsym.c b/usr/src/cmd/mdb/tools/findfp/common/findsym.c deleted file mode 100644 index f6ebe239e3..0000000000 --- a/usr/src/cmd/mdb/tools/findfp/common/findsym.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <string.h> -#include <libelf.h> -#include <gelf.h> - -#include <findfp.h> -#include <util.h> - -int -findelfsym(Elf *elf, uintptr_t addr, char **symnamep, offset_t *offp) -{ - Elf_Data *symtab; - GElf_Shdr shdr; - Elf_Scn *scn; - int symtabidx, nent, i; - - if ((symtabidx = findelfsecidx(elf, ".symtab")) < 0) - elfdie("failed to find .symtab\n"); - - if ((scn = elf_getscn(elf, symtabidx)) == NULL || - gelf_getshdr(scn, &shdr) == NULL || - (symtab = elf_getdata(scn, NULL)) == NULL) - elfdie("failed to read .symtab"); - - nent = shdr.sh_size / shdr.sh_entsize; - - for (i = 0; i < nent; i++) { - GElf_Sym sym; - - if (gelf_getsym(symtab, i, &sym) == NULL) - elfdie("failed to get symbol at idx %d", i); - - if ((GELF_ST_TYPE(sym.st_info) != STT_FUNC && - GELF_ST_TYPE(sym.st_info) != STT_OBJECT) || - sym.st_shndx == SHN_UNDEF) - continue; - - if (addr - sym.st_value < sym.st_size) { - /* matched */ - if ((*symnamep = elf_strptr(elf, shdr.sh_link, - sym.st_name)) == NULL) - elfdie("failed to get name for sym %d", i); - *offp = addr - sym.st_value; - return (1); - } - } - - return (0); -} diff --git a/usr/src/cmd/mdb/tools/findfp/sparc/Makefile b/usr/src/cmd/mdb/tools/findfp/sparc/Makefile deleted file mode 100644 index 340f45b60c..0000000000 --- a/usr/src/cmd/mdb/tools/findfp/sparc/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include ../Makefile.com diff --git a/usr/src/cmd/mdb/tools/findfp/sparc/findfp.c b/usr/src/cmd/mdb/tools/findfp/sparc/findfp.c deleted file mode 100644 index 1d69e5d6f2..0000000000 --- a/usr/src/cmd/mdb/tools/findfp/sparc/findfp.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <libgen.h> -#include <errno.h> -#include <libelf.h> -#include <gelf.h> -#include <fcntl.h> -#include <unistd.h> -#include <sys/stat.h> -#include <sys/types.h> - -#include <findfp.h> -#include <util.h> - -#define OP(x) ((unsigned)(0x3 & x) << 30) /* general opcode */ -#define OP2(x) ((0x7 & x) << 22) /* op2 opcode */ -#define OP3(x) ((0x3f & x) << 19) /* op3 opcode */ - -#define OPMSK 0xC0000000 -#define OP2MSK 0x01C00000 -#define OP3MSK 0x01F80000 - -#define MAXEXCLUDES 5 - -typedef struct mask { - uint32_t m_mask; - uint32_t m_val; - const char *m_name; -} mask_t; - -static const mask_t masks[] = { - { OPMSK|OP2MSK, OP(0) | OP2(5), "FBPfcc" }, - { OPMSK|OP2MSK, OP(0) | OP2(6), "FBfcc" }, - { OPMSK|OP3MSK, OP(2) | OP3(0x34), "FPop1" }, - { OPMSK|OP3MSK, OP(2) | OP3(0x35), "FPop2" }, - { OPMSK|OP3(0x38), OP(3) | OP3(0x20), "FPldst1" }, - { OPMSK|OP3(0x38), OP(3) | OP3(0x30), "FPldst2" } -}; - -const char *progname; - -static void -usage(void) -{ - (void) fprintf(stderr, "Usage: %s infile\n", progname); - exit(2); -} - -int -main(int argc, char **argv) -{ - Elf *elf; - Elf_Scn *scn; - GElf_Shdr shdr; - Elf_Data *text; - uint32_t *instrs; - char *excludes[MAXEXCLUDES]; - int fd, textidx, i, j, c; - int shownames = 1; - int nexcludes = 0; - int found = 0; - char *filename; - - progname = basename(argv[0]); - - while ((c = getopt(argc, argv, ":nx:")) != EOF) { - switch (c) { - case 'n': - shownames = 0; - break; - case 'x': - if (nexcludes == MAXEXCLUDES - 1) - die("exclusion limit is %d", MAXEXCLUDES); - excludes[nexcludes++] = optarg; - break; - default: - usage(); - } - } - - if (argc - optind != 1) - usage(); - filename = argv[optind]; - - if ((fd = open(filename, O_RDONLY)) < 0) - die("failed to open %s", filename); - - (void) elf_version(EV_CURRENT); - if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) - elfdie("failed to open %s as ELF", filename); - - if ((textidx = findelfsecidx(elf, ".text")) < 0) - die("failed to find .text section in %s\n", filename); - - if ((scn = elf_getscn(elf, textidx)) == NULL || - gelf_getshdr(scn, &shdr) == NULL || - (text = elf_rawdata(scn, NULL)) == NULL) - elfdie("failed to read .text"); - - instrs = text->d_buf; - - for (i = 0; i < shdr.sh_size / 4; i++) { - for (j = 0; j < sizeof (masks) / sizeof (mask_t); j++) { - char *symname = NULL; - offset_t off; - int len = 35; - int xcl; - - if ((instrs[i] & masks[j].m_mask) != masks[j].m_val) - continue; - - if (findelfsym(elf, i * 4, &symname, &off)) { - if (nexcludes > 0) { - for (xcl = 0; xcl < nexcludes; xcl++) { - if (strcmp(symname, - excludes[xcl]) == 0) - break; - } - - if (xcl < nexcludes) - continue; /* exclude matched */ - } - } - - found++; - - if (!shownames || symname == NULL) { - (void) printf("%-*x", len, i * 4); - } else { - len -= printf("%s+%llx", symname, off); - (void) printf("%*s", (len > 0 ? len : 0), ""); - } - - (void) printf(" %08x %s\n", instrs[i], - masks[j].m_name); - } - } - - (void) elf_end(elf); - (void) close(fd); - - return (found > 0); -} diff --git a/usr/src/cmd/mdb/tools/setdynflag/sparc/Makefile b/usr/src/cmd/mdb/tools/setdynflag/sparc/Makefile deleted file mode 100644 index 66a1fbcd54..0000000000 --- a/usr/src/cmd/mdb/tools/setdynflag/sparc/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# -# 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 -# or http://www.opensolaris.org/os/licensing. -# 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 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#ident "%Z%%M% %I% %E% SMI" -# - -include ../Makefile.com diff --git a/usr/src/pkg/manifests/source-demo-mdb-examples.p5m b/usr/src/pkg/manifests/source-demo-mdb-examples.p5m index e7600e56a9..90203aed35 100644 --- a/usr/src/pkg/manifests/source-demo-mdb-examples.p5m +++ b/usr/src/pkg/manifests/source-demo-mdb-examples.p5m @@ -21,6 +21,7 @@ # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright 2022 Garrett D'Amore # set name=pkg.fmri value=pkg:/source/demo/mdb-examples@$(PKGVERS) @@ -37,16 +38,12 @@ file path=usr/demo/mdb/Makefile file path=usr/demo/mdb/Makefile.amd64 file path=usr/demo/mdb/Makefile.common file path=usr/demo/mdb/Makefile.i386 -file path=usr/demo/mdb/Makefile.sparc -file path=usr/demo/mdb/Makefile.sparcv9 file path=usr/demo/mdb/README dir path=usr/demo/mdb/amd64 dir path=usr/demo/mdb/common file path=usr/demo/mdb/common/example1.c file path=usr/demo/mdb/common/example2.c dir path=usr/demo/mdb/i386 -dir path=usr/demo/mdb/sparc -dir path=usr/demo/mdb/sparcv9 legacy pkg=SUNWmdbdm \ desc="Modular Debugger (MDB) demonstration modules and source code" \ name="Modular Debugger Demo Source" |
