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>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/kdi/kdi_idthdl.s
          +++ new/usr/src/uts/intel/kdi/kdi_idthdl.s
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
       24 + *
       25 + * Copyright 2018 Joyent, Inc.
  24   26   */
  25   27  
  26      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  27      -
  28   28  /*
  29   29   * Companion to kdi_idt.c - the implementation of the trap and interrupt
  30   30   * handlers.  For the most part, these handlers do the same thing - they
  31   31   * push a trap number onto the stack, followed by a jump to kdi_cmnint.
  32   32   * Each trap and interrupt has its own handler because each one pushes a
  33   33   * different number.
  34   34   */
  35   35  
  36   36  #include <sys/asm_linkage.h>
  37   37  #include <sys/kdi_regs.h>
  38   38  
  39   39  /* Nothing in this file is of interest to lint. */
  40   40  #if !defined(__lint)
  41   41  
  42      -/* 
       42 +/*
  43   43   * The default ASM_ENTRY_ALIGN (16) wastes far too much space.  Pay no
  44   44   * attention to the fleet of nop's we're adding to each handler.
  45   45   */
  46   46  #undef  ASM_ENTRY_ALIGN
  47   47  #define ASM_ENTRY_ALIGN 8
  48   48  
  49   49  /*
  50      - * We need the .align in ENTRY_NP (defined to be ASM_ENTRY_ALIGN) to match our
  51      - * manual .align (KDI_MSR_PATCHOFF) in order to ensure that the space reserved
  52      - * at the beginning of the handler for code is exactly KDI_MSR_PATCHOFF bytes
  53      - * long.  Note that the #error below isn't supported by the preprocessor invoked
  54      - * by as(1), and won't stop the build, but it'll emit a noticeable error message
  55      - * which won't escape the filters.
  56      - */
  57      -#if ASM_ENTRY_ALIGN != KDI_MSR_PATCHOFF
  58      -#error "ASM_ENTRY_ALIGN != KDI_MSR_PATCHOFF"
  59      -this won't assemble
  60      -#endif
  61      -
  62      -/*
  63      - * kdi_idt_patch will, on certain processors, replace the patch points below
  64      - * with MSR-clearing code.  kdi_id_patch has intimate knowledge of the size of
  65      - * the nop hole, as well as the structure of the handlers.  Do not change
  66      - * anything here without also changing kdi_idt_patch.
  67      - */
  68      -
  69      -/*
  70   50   * Generic trap and interrupt handlers.
  71   51   */
  72   52  
  73   53  #if defined(__xpv) && defined(__amd64)
  74   54  
  75   55  /*
  76   56   * The hypervisor places r11 and rcx on the stack.
  77   57   */
  78   58  
  79   59  #define TRAP_NOERR(trapno) \
↓ open down ↓ 15 lines elided ↑ open up ↑
  95   75  #define TRAP_ERR(trapno)        \
  96   76          push    $0;             \
  97   77          push    $trapno
  98   78  
  99   79  #endif  /* __xpv && __amd64 */
 100   80  
 101   81  
 102   82  #define MKIVCT(n) \
 103   83          ENTRY_NP(kdi_ivct/**/n/**/);    \
 104   84          TRAP_ERR(n);                    \
 105      -        .align  KDI_MSR_PATCHOFF;       \
 106      -        KDI_MSR_PATCH;                  \
 107   85          jmp     kdi_cmnint;             \
 108   86          SET_SIZE(kdi_ivct/**/n/**/)
 109   87  
 110   88  #define MKTRAPHDLR(n) \
 111   89          ENTRY_NP(kdi_trap/**/n);        \
 112   90          TRAP_ERR(n);                    \
 113      -        .align  KDI_MSR_PATCHOFF;       \
 114      -        KDI_MSR_PATCH;                  \
 115   91          jmp     kdi_cmnint;             \
 116   92          SET_SIZE(kdi_trap/**/n/**/)
 117   93  
 118   94  #define MKTRAPERRHDLR(n) \
 119   95          ENTRY_NP(kdi_traperr/**/n);     \
 120   96          TRAP_NOERR(n);                  \
 121      -        .align  KDI_MSR_PATCHOFF;       \
 122      -        KDI_MSR_PATCH;                  \
 123   97          jmp     kdi_cmnint;             \
 124   98          SET_SIZE(kdi_traperr/**/n)
 125   99  
 126  100  #define MKNMIHDLR \
 127  101          ENTRY_NP(kdi_int2);             \
 128  102          TRAP_NOERR(2);                  \
 129      -        .align  KDI_MSR_PATCHOFF;       \
 130      -        KDI_MSR_PATCH;                  \
 131  103          jmp     kdi_nmiint;             \
 132  104          SET_SIZE(kdi_int2)
 133  105  
 134  106  #define MKINVALHDLR \
 135  107          ENTRY_NP(kdi_invaltrap);        \
 136  108          TRAP_NOERR(255);                \
 137      -        .align  KDI_MSR_PATCHOFF;       \
 138      -        KDI_MSR_PATCH;                  \
 139  109          jmp     kdi_cmnint;             \
 140  110          SET_SIZE(kdi_invaltrap)
 141  111  
 142  112  /*
 143  113   * The handlers themselves
 144  114   */
 145  115  
 146  116          MKINVALHDLR
 147  117          MKTRAPHDLR(0)
 148  118          MKTRAPHDLR(1)
↓ open down ↓ 85 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX