Print this page
11787 Kernel needs to be built with retpolines
11788 Kernel needs to generally use RSB stuffing
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: John Levon <john.levon@joyent.com>


   3  *
   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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.

  23  */
  24         
  25 #include <sys/asm_linkage.h>
  26 #include <sys/asm_misc.h>
  27 #include <sys/regset.h>
  28 #include <sys/privregs.h>
  29 #include <sys/x86_archext.h>
  30 #include <sys/cpr_wakecode.h>
  31 
  32 #if !defined(__lint)
  33 #include <sys/segments.h>
  34 #include "assym.h"
  35 #endif
  36 
  37 #ifdef  DEBUG
  38 #define LED     1
  39 #define SERIAL  1
  40 #endif  /*      DEBUG   */
  41 
  42 #ifdef  DEBUG


 743         cmpl    %eax, WC_CPU_ID(%rbx)
 744         je      2f
 745 
 746         movq    %gs:CPU_THREAD, %rdi
 747         movq    WC_SAVED_STACK(%rbx), %rsi
 748         call    i_cpr_restore_stack
 749 2:
 750 
 751         movq    WC_RSP(%rbx), %rsp      / restore stack pointer
 752 
 753         /*
 754          * APIC initialization
 755          */
 756         movq    %rsp, %rbp
 757 
 758         /*
 759          * skip iff function pointer is NULL
 760          */
 761         cmpq    $0, ap_mlsetup
 762         je      3f
 763         call    *ap_mlsetup

 764 3:
 765 
 766         call    *cpr_start_cpu_func

 767 
 768 / restore %rbx to the value it ahd before we called the functions above
 769         movq    rm_platter_va, %rbx
 770         addq    $WC_CPU, %rbx
 771 
 772         movq    WC_R8(%rbx), %r8
 773         movq    WC_R9(%rbx), %r9
 774         movq    WC_R10(%rbx), %r10
 775         movq    WC_R11(%rbx), %r11
 776         movq    WC_R12(%rbx), %r12
 777         movq    WC_R13(%rbx), %r13
 778         movq    WC_R14(%rbx), %r14
 779         movq    WC_R15(%rbx), %r15
 780 /       movq    WC_RAX(%rbx), %rax
 781         movq    WC_RBP(%rbx), %rbp
 782         movq    WC_RCX(%rbx), %rcx
 783 /       movq    WC_RDX(%rbx), %rdx
 784         movq    WC_RDI(%rbx), %rdi
 785         movq    WC_RSI(%rbx), %rsi
 786 




   3  *
   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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2019 Joyent, Inc.
  24  */
  25 
  26 #include <sys/asm_linkage.h>
  27 #include <sys/asm_misc.h>
  28 #include <sys/regset.h>
  29 #include <sys/privregs.h>
  30 #include <sys/x86_archext.h>
  31 #include <sys/cpr_wakecode.h>
  32 
  33 #if !defined(__lint)
  34 #include <sys/segments.h>
  35 #include "assym.h"
  36 #endif
  37 
  38 #ifdef  DEBUG
  39 #define LED     1
  40 #define SERIAL  1
  41 #endif  /*      DEBUG   */
  42 
  43 #ifdef  DEBUG


 744         cmpl    %eax, WC_CPU_ID(%rbx)
 745         je      2f
 746 
 747         movq    %gs:CPU_THREAD, %rdi
 748         movq    WC_SAVED_STACK(%rbx), %rsi
 749         call    i_cpr_restore_stack
 750 2:
 751 
 752         movq    WC_RSP(%rbx), %rsp      / restore stack pointer
 753 
 754         /*
 755          * APIC initialization
 756          */
 757         movq    %rsp, %rbp
 758 
 759         /*
 760          * skip iff function pointer is NULL
 761          */
 762         cmpq    $0, ap_mlsetup
 763         je      3f
 764         leaq    ap_mlsetup, %rax
 765         INDIRECT_CALL_REG(rax)
 766 3:
 767 
 768         leaq    cpr_start_cpu_func, %rax
 769         INDIRECT_CALL_REG(rax)
 770 
 771 / restore %rbx to the value it ahd before we called the functions above
 772         movq    rm_platter_va, %rbx
 773         addq    $WC_CPU, %rbx
 774 
 775         movq    WC_R8(%rbx), %r8
 776         movq    WC_R9(%rbx), %r9
 777         movq    WC_R10(%rbx), %r10
 778         movq    WC_R11(%rbx), %r11
 779         movq    WC_R12(%rbx), %r12
 780         movq    WC_R13(%rbx), %r13
 781         movq    WC_R14(%rbx), %r14
 782         movq    WC_R15(%rbx), %r15
 783 /       movq    WC_RAX(%rbx), %rax
 784         movq    WC_RBP(%rbx), %rbp
 785         movq    WC_RCX(%rbx), %rcx
 786 /       movq    WC_RDX(%rbx), %rdx
 787         movq    WC_RDI(%rbx), %rdi
 788         movq    WC_RSI(%rbx), %rsi
 789