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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/i86pc/ml/fb_swtch_src.s
          +++ new/usr/src/uts/i86pc/ml/fb_swtch_src.s
↓ open down ↓ 14 lines elided ↑ open up ↑
  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  /*
  23   23   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
       25 + * Copyright 2018 Joyent, Inc.
  25   26   */
  26   27  
  27   28  
  28   29  #if defined(__lint)
  29   30  
  30   31  int fb_swtch_silence_lint = 0;
  31   32  
  32   33  #else
  33   34  
  34   35  #include <sys/asm_linkage.h>
↓ open down ↓ 10 lines elided ↑ open up ↑
  45   46  
  46   47  /*
  47   48   * For debugging with LEDs
  48   49   */
  49   50  #define FB_OUTB_ASM(val)        \
  50   51      movb        val, %al;       \
  51   52      outb        $0x80;
  52   53  
  53   54  
  54   55  #define DISABLE_PAGING                                                  \
       56 +        movl    %cr4, %eax                                              ;\
       57 +        btrl    $17, %eax       /* clear PCIDE bit */                   ;\
       58 +        movl    %eax, %cr4                                              ;\
  55   59          movl    %cr0, %eax                                              ;\
  56   60          btrl    $31, %eax       /* clear PG bit */                      ;\
  57   61          movl    %eax, %cr0
  58   62  
  59   63  /*
  60   64   * This macro contains common code for 64/32-bit versions of copy_sections().
  61   65   * On entry:
  62   66   *      fbf points to the fboot_file_t
  63   67   *      snum contains the number of sections
  64   68   * Registers that would be clobbered:
↓ open down ↓ 150 lines elided ↑ open up ↑
 215  219          movw    %ax, %ss
 216  220          movw    %ax, %ds
 217  221          movw    %ax, %es
 218  222          movw    %ax, %fs
 219  223          movw    %ax, %gs
 220  224  
 221  225          /*
 222  226           * Disable long mode by:
 223  227           * - shutting down paging (bit 31 of cr0).  This will flush the
 224  228           *   TLBs.
      229 +         * - turning off PCID in cr4
 225  230           * - disabling LME (long mode enable) in EFER (extended feature reg)
 226  231           */
 227  232  #endif
 228  233          DISABLE_PAGING          /* clobbers %eax */
 229  234  
 230  235  #if defined(__amd64)
 231  236          ljmp    $B32CODE_SEL, $1f
 232  237  1:
 233  238  #endif
 234  239  
↓ open down ↓ 216 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX