Print this page
8956 Implement KPTI
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>


   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  * Kernel/Debugger Interface (KDI) routines.  Called during debugger under
  30  * various system states (boot, while running, while the debugger has control).
  31  * Functions intended for use while the debugger has control may not grab any
  32  * locks or perform any functions that assume the availability of other system
  33  * services.
  34  */
  35 
  36 #include <sys/systm.h>
  37 #include <sys/x86_archext.h>
  38 #include <sys/kdi_impl.h>
  39 #include <sys/smp_impldefs.h>
  40 #include <sys/psm_types.h>
  41 #include <sys/segments.h>
  42 #include <sys/archsystm.h>
  43 #include <sys/controlregs.h>
  44 #include <sys/trap.h>
  45 #include <sys/kobj.h>
  46 #include <sys/kobj_impl.h>
  47 #include <sys/mach_mmu.h>


  96                 kdi_setdr1(value);
  97                 break;
  98         case 2:
  99                 kdi_setdr2(value);
 100                 break;
 101         case 3:
 102                 kdi_setdr3(value);
 103                 break;
 104         case 6:
 105                 kdi_setdr6(value);
 106                 break;
 107         case 7:
 108                 kdi_setdr7(value);
 109                 break;
 110         default:
 111                 panic("invalid debug register dr%d", reg);
 112                 /*NOTREACHED*/
 113         }
 114 }
 115 
 116 void
 117 kdi_flush_caches(void)
 118 {
 119         reload_cr3();
 120 }
 121 
 122 extern void kdi_slave_entry(void);
 123 
 124 void
 125 kdi_stop_slaves(int cpu, int doxc)
 126 {
 127         if (doxc)
 128                 kdi_xc_others(cpu, kdi_slave_entry);
 129 }
 130 
 131 /*
 132  * On i86pc, slaves busy-loop, so we don't need to do anything here.
 133  */
 134 void
 135 kdi_start_slaves(void)
 136 {
 137 }
 138 
 139 void
 140 kdi_slave_wait(void)
 141 {




   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  * Kernel/Debugger Interface (KDI) routines.  Called during debugger under
  30  * various system states (boot, while running, while the debugger has control).
  31  * Functions intended for use while the debugger has control may not grab any
  32  * locks or perform any functions that assume the availability of other system
  33  * services.
  34  */
  35 
  36 #include <sys/systm.h>
  37 #include <sys/x86_archext.h>
  38 #include <sys/kdi_impl.h>
  39 #include <sys/smp_impldefs.h>
  40 #include <sys/psm_types.h>
  41 #include <sys/segments.h>
  42 #include <sys/archsystm.h>
  43 #include <sys/controlregs.h>
  44 #include <sys/trap.h>
  45 #include <sys/kobj.h>
  46 #include <sys/kobj_impl.h>
  47 #include <sys/mach_mmu.h>


  96                 kdi_setdr1(value);
  97                 break;
  98         case 2:
  99                 kdi_setdr2(value);
 100                 break;
 101         case 3:
 102                 kdi_setdr3(value);
 103                 break;
 104         case 6:
 105                 kdi_setdr6(value);
 106                 break;
 107         case 7:
 108                 kdi_setdr7(value);
 109                 break;
 110         default:
 111                 panic("invalid debug register dr%d", reg);
 112                 /*NOTREACHED*/
 113         }
 114 }
 115 






 116 extern void kdi_slave_entry(void);
 117 
 118 void
 119 kdi_stop_slaves(int cpu, int doxc)
 120 {
 121         if (doxc)
 122                 kdi_xc_others(cpu, kdi_slave_entry);
 123 }
 124 
 125 /*
 126  * On i86pc, slaves busy-loop, so we don't need to do anything here.
 127  */
 128 void
 129 kdi_start_slaves(void)
 130 {
 131 }
 132 
 133 void
 134 kdi_slave_wait(void)
 135 {