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 #ifndef _KMDB_DPI_IMPL_H
  27 #define _KMDB_DPI_IMPL_H
  28 
  29 #pragma ident   "%Z%%M% %I%     %E% SMI"
  30 
  31 #include <setjmp.h>
  32 #ifdef  __sparc
  33 #include <sys/regset.h>
  34 #endif  /* __sparc */
  35 #include <sys/types.h>
  36 
  37 #include <kmdb/kmdb_auxv.h>
  38 #include <kmdb/kmdb_dpi.h>
  39 #include <mdb/mdb_kreg.h>
  40 #include <mdb/mdb_target.h>
  41 
  42 #ifdef __cplusplus
  43 extern "C" {
  44 #endif
  45 
  46 extern jmp_buf *kmdb_dpi_fault_pcb;
  47 
  48 /*
  49  * The routines used by the kmdb side of the DPI to access the saved state
  50  * of the current kernel instance, and to control that instance.  A populated


  69 
  70         const mdb_tgt_gregset_t *(*dpo_get_gregs)(int);
  71         int (*dpo_get_register)(const char *, kreg_t *);
  72         int (*dpo_set_register)(const char *, kreg_t);
  73 #ifdef __sparc
  74         int (*dpo_get_rwin)(int, int, struct rwindow *);
  75         int (*dpo_get_nwin)(int);
  76 #endif
  77 
  78         int (*dpo_brkpt_arm)(uintptr_t, mdb_instr_t *);
  79         int (*dpo_brkpt_disarm)(uintptr_t, mdb_instr_t);
  80 
  81         int (*dpo_wapt_validate)(kmdb_wapt_t *);
  82         int (*dpo_wapt_reserve)(kmdb_wapt_t *);
  83         void (*dpo_wapt_release)(kmdb_wapt_t *);
  84         void (*dpo_wapt_arm)(kmdb_wapt_t *);
  85         void (*dpo_wapt_disarm)(kmdb_wapt_t *);
  86         int (*dpo_wapt_match)(kmdb_wapt_t *);
  87 
  88         int (*dpo_step)(void);
  89 #if defined(__i386) || defined(__amd64)
  90         void (*dpo_step_branch)(void);
  91 #endif
  92 
  93         uintptr_t (*dpo_call)(uintptr_t, uint_t, const uintptr_t *);
  94 
  95         void (*dpo_dump_crumbs)(uintptr_t, int);
  96 
  97 #if defined(__i386) || defined(__amd64)
  98         void (*dpo_msr_add)(const kdi_msr_t *);
  99         uint64_t (*dpo_msr_get)(int, uint_t);
 100 #endif
 101 
 102 #ifdef __sparc
 103         void (*dpo_kernpanic)(int);
 104 #endif
 105 };
 106 
 107 extern void (*kmdb_dpi_wrintr_fire)(void);
 108 
 109 extern dpi_ops_t kmdb_dpi_ops;
 110 
 111 extern void kmdb_dpi_resume_common(int);
 112 extern void kmdb_dpi_resume_master(void);
 113 
 114 /* Used by the debugger to tell the driver how to resume */
 115 #define KMDB_DPI_CMD_RESUME_ALL         1       /* Resume all CPUs */
 116 #define KMDB_DPI_CMD_RESUME_MASTER      2       /* Resume only master CPU */
 117 #define KMDB_DPI_CMD_RESUME_UNLOAD      3       /* Resume for debugger unload */
 118 #define KMDB_DPI_CMD_SWITCH_CPU         4       /* Switch to another CPU */
 119 #define KMDB_DPI_CMD_FLUSH_CACHES       5       /* Flush slave caches */
 120 #define KMDB_DPI_CMD_REBOOT             6       /* Reboot the machine */
 121 


   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 #ifndef _KMDB_DPI_IMPL_H
  29 #define _KMDB_DPI_IMPL_H
  30 


  31 #include <setjmp.h>
  32 #ifdef  __sparc
  33 #include <sys/regset.h>
  34 #endif  /* __sparc */
  35 #include <sys/types.h>
  36 
  37 #include <kmdb/kmdb_auxv.h>
  38 #include <kmdb/kmdb_dpi.h>
  39 #include <mdb/mdb_kreg.h>
  40 #include <mdb/mdb_target.h>
  41 
  42 #ifdef __cplusplus
  43 extern "C" {
  44 #endif
  45 
  46 extern jmp_buf *kmdb_dpi_fault_pcb;
  47 
  48 /*
  49  * The routines used by the kmdb side of the DPI to access the saved state
  50  * of the current kernel instance, and to control that instance.  A populated


  69 
  70         const mdb_tgt_gregset_t *(*dpo_get_gregs)(int);
  71         int (*dpo_get_register)(const char *, kreg_t *);
  72         int (*dpo_set_register)(const char *, kreg_t);
  73 #ifdef __sparc
  74         int (*dpo_get_rwin)(int, int, struct rwindow *);
  75         int (*dpo_get_nwin)(int);
  76 #endif
  77 
  78         int (*dpo_brkpt_arm)(uintptr_t, mdb_instr_t *);
  79         int (*dpo_brkpt_disarm)(uintptr_t, mdb_instr_t);
  80 
  81         int (*dpo_wapt_validate)(kmdb_wapt_t *);
  82         int (*dpo_wapt_reserve)(kmdb_wapt_t *);
  83         void (*dpo_wapt_release)(kmdb_wapt_t *);
  84         void (*dpo_wapt_arm)(kmdb_wapt_t *);
  85         void (*dpo_wapt_disarm)(kmdb_wapt_t *);
  86         int (*dpo_wapt_match)(kmdb_wapt_t *);
  87 
  88         int (*dpo_step)(void);



  89 
  90         uintptr_t (*dpo_call)(uintptr_t, uint_t, const uintptr_t *);
  91 
  92         void (*dpo_dump_crumbs)(uintptr_t, int);
  93 





  94 #ifdef __sparc
  95         void (*dpo_kernpanic)(int);
  96 #endif
  97 };
  98 
  99 extern void (*kmdb_dpi_wrintr_fire)(void);
 100 
 101 extern dpi_ops_t kmdb_dpi_ops;
 102 
 103 extern void kmdb_dpi_resume_common(int);
 104 extern void kmdb_dpi_resume_master(void);
 105 
 106 /* Used by the debugger to tell the driver how to resume */
 107 #define KMDB_DPI_CMD_RESUME_ALL         1       /* Resume all CPUs */
 108 #define KMDB_DPI_CMD_RESUME_MASTER      2       /* Resume only master CPU */
 109 #define KMDB_DPI_CMD_RESUME_UNLOAD      3       /* Resume for debugger unload */
 110 #define KMDB_DPI_CMD_SWITCH_CPU         4       /* Switch to another CPU */
 111 #define KMDB_DPI_CMD_FLUSH_CACHES       5       /* Flush slave caches */
 112 #define KMDB_DPI_CMD_REBOOT             6       /* Reboot the machine */
 113