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/mpcore.s
          +++ new/usr/src/uts/i86pc/ml/mpcore.s
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   */
  24   24  /*
  25   25   * Copyright (c) 2010, Intel Corporation.
  26   26   * All rights reserved.
       27 + *
       28 + * Copyright 2018 Joyent, Inc.
  27   29   */
  28   30          
  29   31  #include <sys/asm_linkage.h>
  30   32  #include <sys/asm_misc.h>
  31   33  #include <sys/regset.h>
  32   34  #include <sys/privregs.h>
  33   35  #include <sys/x86_archext.h>
  34   36  
  35   37  #if !defined(__lint)
  36   38  #include <sys/segments.h>
↓ open down ↓ 282 lines elided ↑ open up ↑
 319  321          movl    $MSR_AMD_EFER, %ecx
 320  322          rdmsr
 321  323          orl     $AMD_EFER_NXE, %eax
 322  324          wrmsr
 323  325  1:
 324  326  
 325  327          /*
 326  328           * Complete the rest of the setup and call mp_startup().
 327  329           */
 328  330          movq    %gs:CPU_THREAD, %rax    /* get thread ptr */
 329      -        call    *T_PC(%rax)             /* call mp_startup */
      331 +        call    *T_PC(%rax)             /* call mp_startup_boot */
 330  332          /* not reached */
 331  333          int     $20                     /* whoops, returned somehow! */
 332  334  
 333  335          SET_SIZE(real_mode_start_cpu)
 334  336  
 335  337  #elif defined(__i386)
 336  338  
 337  339          ENTRY_NP(real_mode_start_cpu)
 338  340  
 339  341  #if !defined(__GNUC_AS__)
↓ open down ↓ 155 lines elided ↑ open up ↑
 495  497          ltr     %ax
 496  498          xorw    %ax, %ax                /* clear LDTR */
 497  499          lldt    %ax
 498  500          mov     %cr0, %edx
 499  501          and     $~(CR0_TS|CR0_EM), %edx /* clear emulate math chip bit */
 500  502          or      $(CR0_MP|CR0_NE), %edx
 501  503          mov     %edx, %cr0              /* set machine status word */
 502  504  
 503  505          /*
 504  506           * Before going any farther, enable usage of page table NX bit if 
 505      -         * that's how our page tables are set up.
      507 +         * that's how our page tables are set up.  (PCIDE is enabled later on).
 506  508           */
 507  509          bt      $X86FSET_NX, x86_featureset
 508  510          jnc     1f
 509  511          movl    %cr4, %ecx
 510  512          andl    $CR4_PAE, %ecx
 511  513          jz      1f
 512  514          movl    $MSR_AMD_EFER, %ecx
 513  515          rdmsr
 514  516          orl     $AMD_EFER_NXE, %eax
 515  517          wrmsr
↓ open down ↓ 124 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX