Print this page
9210 remove KMDB branch debugging support
9211 ::crregs could do with cr2/cr3 support
9209 ::ttrace should be able to filter by thread
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Yuri Pankov <yuripv@yuripv.net>


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.


  24  */
  25 
  26 #pragma ident   "%Z%%M% %I%     %E% SMI"
  27 
  28 /*
  29  * Intel-specific portions of the DPI
  30  */
  31 
  32 #include <sys/types.h>
  33 #include <sys/trap.h>
  34 
  35 #include <kmdb/kmdb_dpi_impl.h>
  36 #include <kmdb/kmdb_fault.h>
  37 #include <kmdb/kmdb_kdi.h>
  38 #include <mdb/mdb_err.h>
  39 #include <mdb/mdb_debug.h>
  40 #include <mdb/mdb_kreg.h>
  41 #include <mdb/mdb.h>
  42 
  43 void
  44 kmdb_dpi_handle_fault(kreg_t trapno, kreg_t pc, kreg_t sp, int cpuid)
  45 {
  46         kmdb_kdi_system_claim();
  47 


 124                         kmdb_dpi_set_state(DPI_STATE_STOPPED, 0);
 125                         break;
 126                 default:
 127                         kmdb_dpi_set_state(DPI_STATE_FAULTED,
 128                             DPI_STATE_WHY_TRAP);
 129                         break;
 130                 }
 131         }
 132 
 133         mdb_dprintf(MDB_DBG_PROC, "returning from resume\n");
 134 }
 135 
 136 void
 137 kmdb_dpi_reboot(void)
 138 {
 139         /*
 140          * We're going to skip all of the niceties we employ in resume_common,
 141          * as we don't plan to ever return.
 142          */
 143         longjmp(kmdb_dpi_entry_pcb, KMDB_DPI_CMD_REBOOT);
 144 }
 145 
 146 void
 147 kmdb_dpi_msr_add(const kdi_msr_t *msrs)
 148 {
 149         mdb.m_dpi->dpo_msr_add(msrs);
 150 }
 151 
 152 uint64_t
 153 kmdb_dpi_msr_get(uint_t msr)
 154 {
 155         return (mdb.m_dpi->dpo_msr_get(DPI_MASTER_CPUID, msr));
 156 }
 157 
 158 uint64_t
 159 kmdb_dpi_msr_get_by_cpu(int cpuid, uint_t msr)
 160 {
 161         return (mdb.m_dpi->dpo_msr_get(cpuid, msr));
 162 }


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  *
  25  * Copyright 2018 Joyent, Inc.
  26  */
  27 


  28 /*
  29  * Intel-specific portions of the DPI
  30  */
  31 
  32 #include <sys/types.h>
  33 #include <sys/trap.h>
  34 
  35 #include <kmdb/kmdb_dpi_impl.h>
  36 #include <kmdb/kmdb_fault.h>
  37 #include <kmdb/kmdb_kdi.h>
  38 #include <mdb/mdb_err.h>
  39 #include <mdb/mdb_debug.h>
  40 #include <mdb/mdb_kreg.h>
  41 #include <mdb/mdb.h>
  42 
  43 void
  44 kmdb_dpi_handle_fault(kreg_t trapno, kreg_t pc, kreg_t sp, int cpuid)
  45 {
  46         kmdb_kdi_system_claim();
  47 


 124                         kmdb_dpi_set_state(DPI_STATE_STOPPED, 0);
 125                         break;
 126                 default:
 127                         kmdb_dpi_set_state(DPI_STATE_FAULTED,
 128                             DPI_STATE_WHY_TRAP);
 129                         break;
 130                 }
 131         }
 132 
 133         mdb_dprintf(MDB_DBG_PROC, "returning from resume\n");
 134 }
 135 
 136 void
 137 kmdb_dpi_reboot(void)
 138 {
 139         /*
 140          * We're going to skip all of the niceties we employ in resume_common,
 141          * as we don't plan to ever return.
 142          */
 143         longjmp(kmdb_dpi_entry_pcb, KMDB_DPI_CMD_REBOOT);


















 144 }