]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1.Restore BSP IDT table to AP when AP wakeup.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 11 Jun 2010 08:24:01 +0000 (08:24 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 11 Jun 2010 08:24:01 +0000 (08:24 +0000)
2.Restore Virtual wire mode on AP when AP wakeup.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10575 6f19259b-4bc3-4df7-8a09-765794883524

EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/AsmInclude.inc
EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.S
EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.asm
EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.c
EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.h
EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/AsmInclude.inc
EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.S
EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.asm

index 6ebd98c98fe705c8cb8b6bc3cf0b852805706eed..d396726bfead36425346a4eb96396fc17a8bd875 100644 (file)
@@ -1,7 +1,7 @@
 ;------------------------------------------------------------------------------\r
 ; Include file for IA32 MpFuncs.asm\r
 ;\r
-; Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
 ; This program and the accompanying materials\r
 ; are licensed and made available under the terms and conditions of the BSD License\r
 ; which accompanies this distribution.  The full text of the license may be found at\r
@@ -20,6 +20,7 @@ StackStart          equ        LockLocation + 4h
 StackSize           equ        LockLocation + 8h\r
 RendezvousProc      equ        LockLocation + 0Ch\r
 GdtrProfile         equ        LockLocation + 10h\r
-BufferStart         equ        LockLocation + 18h\r
+IdtrProfile         equ        LockLocation + 16h\r
+BufferStart         equ        LockLocation + 1Ch\r
 \r
 ;-------------------------------------------------------------------------------\r
index 91313b1aca135a9e63afba087cf47d7518a0ad25..4da7fd5011925c84b247486fb41a3859b37cf98b 100644 (file)
@@ -1,7 +1,7 @@
 #------------------------------------------------------------------------------\r
 # IA32 assembly file for AP startup vector.\r
 #\r
-# Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -58,6 +58,11 @@ RendezvousFunnelProcStart:
         .byte 0x66                    # db         66h\r
         .byte 0x2E,0xF,0x1,0x14       # lgdt       fword ptr cs:[si]\r
 \r
+        .byte 0xBE\r
+        .word IdtrProfile\r
+        .byte 0x66                    # db         66h\r
+        .byte 0x2E,0xF,0x1,0x1C       # lidt       fword ptr cs:[si]\r
+\r
         .byte 0x33,0xC0               # xor        ax,  ax\r
         .byte 0x8E,0xD8               # mov        ds,  ax\r
         .byte 0xF,0x20,0xC0           # mov        eax, cr0                    ; Get control register 0\r
index e822cdbc6093847d03e509fb74055f414b24a517..e5f38a6bbe41835269d08a7afd8ad463e0e6fbeb 100644 (file)
@@ -1,7 +1,7 @@
 ;------------------------------------------------------------------------------\r
 ; IA32 assembly file for AP startup vector.\r
 ;\r
-; Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
 ; This program and the accompanying materials\r
 ; are licensed and made available under the terms and conditions of the BSD License\r
 ; which accompanies this distribution.  The full text of the license may be found at\r
@@ -60,6 +60,11 @@ RendezvousFunnelProcStart::
         dw GdtrProfile                ; mov        si, GdtrProfile\r
         db 66h                        ; db         66h\r
         db 2Eh,0Fh, 01h, 14h          ; lgdt       fword ptr cs:[si]\r
+\r
+        db 0BEh\r
+        dw IdtrProfile                ; mov        si, IdtrProfile\r
+        db 66h                        ; db         66h\r
+        db 2Eh,0Fh, 01h, 1Ch          ; lidt       fword ptr cs:[si]\r
         \r
         db 33h, 0C0h                  ; xor        ax,  ax\r
         db 8Eh, 0D8h                  ; mov        ds,  ax\r
index 4097b9e87ac80592f561fa36c4fa63f93107aa7a..3ff503758d84916819d7a347ea6ed4dfd1778e59 100644 (file)
@@ -117,7 +117,7 @@ GetNumberOfProcessors (
   @retval EFI_SUCCESS           Processor information successfully returned.\r
   @retval EFI_DEVICE_ERROR      Caller processor is AP.\r
   @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL\r
-  @retval EFI_NOT_FOUND         Processor with the handle specified by ProcessorNumber does not exist. \r
+  @retval EFI_NOT_FOUND         Processor with the handle specified by ProcessorNumber does not exist.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -165,7 +165,7 @@ GetProcessorInfo (
   ASSERT_EFI_ERROR (Status);\r
 \r
   ProcessorInfoBuffer->ProcessorId = (UINT64) ProcessorContextBuffer.ApicID;\r
-  \r
+\r
   //\r
   // Get Status Flag of specified processor\r
   //\r
@@ -208,7 +208,7 @@ GetProcessorInfo (
   @param  FailedCpuList         The list of processor numbers that fail to finish the function before\r
                                 TimeoutInMicrosecsond expires.\r
 \r
-  @retval EFI_SUCCESS           In blocking mode, all APs have finished before the timeout expired. \r
+  @retval EFI_SUCCESS           In blocking mode, all APs have finished before the timeout expired.\r
   @retval EFI_SUCCESS           In non-blocking mode, function has been dispatched to all enabled APs.\r
   @retval EFI_DEVICE_ERROR      Caller processor is AP.\r
   @retval EFI_NOT_STARTED       No enabled AP exists in the system.\r
@@ -275,7 +275,7 @@ StartupAllAPs (
           mStopCheckAPsStatus = FALSE;\r
           return EFI_NOT_READY;\r
         } else {\r
-          //     \r
+          //\r
           // Mark this processor as responsible for current calling.\r
           //\r
           mMPSystemData.CpuList[ProcessorNumber] = TRUE;\r
@@ -318,7 +318,7 @@ StartupAllAPs (
       }\r
     }\r
   }\r
-  \r
+\r
   //\r
   // If no enabled AP exists, return EFI_NOT_STARTED.\r
   //\r
@@ -599,7 +599,7 @@ SwitchBSP (
   @retval EFI_DEVICE_ERROR       Caller processor is AP.\r
   @retval EFI_NOT_FOUND          Processor with the handle specified by ProcessorNumber does not exist.\r
   @retval EFI_INVALID_PARAMETERS ProcessorNumber specifies the BSP.\r
-  \r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -661,7 +661,7 @@ EnableDisableAP (
   ASSERT_EFI_ERROR (Status);\r
 \r
   ChangeCpuState (ProcessorNumber, EnableAP);\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -721,7 +721,7 @@ CheckAPsStatus (
   UINTN           ProcessorNumber;\r
   CPU_DATA_BLOCK  *CpuData;\r
   EFI_STATUS      Status;\r
-  \r
+\r
   //\r
   // If CheckAPsStatus() is stopped, then return immediately.\r
   //\r
@@ -853,7 +853,7 @@ CheckAllAPs (
       ASSERT (*mMPSystemData.FailedCpuList != NULL);\r
     }\r
     ListIndex = 0;\r
\r
+\r
     for (ProcessorNumber = 0; ProcessorNumber < mNumberOfProcessors; ProcessorNumber++) {\r
       //\r
       // Check whether this processor is responsible for StartupAllAPs().\r
@@ -920,7 +920,7 @@ CheckThisAP (
     AcquireSpinLock (&CpuData->CpuDataLock);\r
     CpuData->State = CpuStateIdle;\r
     ReleaseSpinLock (&CpuData->CpuDataLock);\r
-    \r
+\r
     if (CpuData->Finished != NULL) {\r
       *(CpuData->Finished) = TRUE;\r
     }\r
@@ -1075,6 +1075,71 @@ GetNextWaitingProcessorNumber (
   return EFI_NOT_FOUND;\r
 }\r
 \r
+/**\r
+  Programs Local APIC registers for virtual wire mode.\r
+\r
+  This function programs Local APIC registers for virtual wire mode.\r
+\r
+  @param  Bsp  Indicates whether the programmed processor is going to be BSP\r
+\r
+**/\r
+VOID\r
+ProgramVirtualWireMode (\r
+  BOOLEAN                       Bsp\r
+  )\r
+{\r
+  UINTN                 ApicBase;\r
+  UINT32                Value;\r
+\r
+  ApicBase = (UINTN)AsmMsrBitFieldRead64 (27, 12, 35) << 12;\r
+\r
+  //\r
+  // Program the Spurious Vector entry\r
+  // Set bit 8 (APIC Software Enable/Disable) to enable local APIC,\r
+  // and set Spurious Vector as 0x0F.\r
+  //\r
+  MmioBitFieldWrite32 (ApicBase + APIC_REGISTER_SPURIOUS_VECTOR_OFFSET, 0, 9, 0x10F);\r
+\r
+  //\r
+  // Program the LINT0 vector entry as ExtInt\r
+  // Set bits 8..10 to 7 as ExtInt Delivery Mode,\r
+  // and clear bits for Delivery Status, Interrupt Input Pin Polarity, Remote IRR,\r
+  // Trigger Mode, and Mask\r
+  //\r
+  if (!Bsp) {\r
+    DisableInterrupts ();\r
+  }\r
+  Value = MmioRead32 (ApicBase + APIC_REGISTER_LINT0_VECTOR_OFFSET);\r
+  Value = BitFieldWrite32 (Value, 8, 10, 7);\r
+  Value = BitFieldWrite32 (Value, 12, 16, 0);\r
+  if (!Bsp) {\r
+    //\r
+    // For APs, LINT0 is masked\r
+    //\r
+    Value = BitFieldWrite32 (Value, 16, 16, 1);\r
+  }\r
+  MmioWrite32 (ApicBase + APIC_REGISTER_LINT0_VECTOR_OFFSET, Value);\r
+\r
+  //\r
+  // Program the LINT1 vector entry as NMI\r
+  // Set bits 8..10 to 4 as NMI Delivery Mode,\r
+  // and clear bits for Delivery Status, Interrupt Input Pin Polarity, Remote IRR,\r
+  // Trigger Mode.\r
+  // For BSP clear Mask bit, and for AP set mask bit.\r
+  //\r
+  Value = MmioRead32 (ApicBase + APIC_REGISTER_LINT1_VECTOR_OFFSET);\r
+  Value = BitFieldWrite32 (Value, 8, 10, 4);\r
+  Value = BitFieldWrite32 (Value, 12, 16, 0);\r
+  if (!Bsp) {\r
+    //\r
+    // For APs, LINT1 is masked\r
+    //\r
+    Value = BitFieldWrite32 (Value, 16, 16, 1);\r
+  }\r
+  MmioWrite32 (ApicBase + APIC_REGISTER_LINT1_VECTOR_OFFSET, Value);\r
+}\r
+\r
+\r
 /**\r
   Wrapper function for all procedures assigned to AP.\r
 \r
@@ -1092,6 +1157,8 @@ ApProcWrapper (
   UINTN                 ProcessorNumber;\r
   CPU_DATA_BLOCK        *CpuData;\r
 \r
+  ProgramVirtualWireMode (FALSE);\r
+\r
   WhoAmI (&mMpService, &ProcessorNumber);\r
   CpuData = &mMPSystemData.CpuData[ProcessorNumber];\r
 \r
@@ -1149,7 +1216,7 @@ SendInitSipiSipi (
   UINTN                 ApicBase;\r
   UINT32                ICRLow;\r
   UINT32                ICRHigh;\r
-  \r
+\r
   UINT32                VectorNumber;\r
   UINT32                DeliveryMode;\r
 \r
@@ -1203,7 +1270,7 @@ SendInitSipiSipi (
 \r
 /**\r
   Function to wake up a specified AP and assign procedure to it.\r
-  \r
+\r
   @param  ProcessorNumber  Handle number of the specified processor.\r
   @param  Procedure        Procedure to assign.\r
   @param  ProcArguments    Argument for Procedure.\r
@@ -1246,7 +1313,7 @@ WakeUpAp (
 \r
 /**\r
   Terminate AP's task and set it to idle state.\r
-  \r
+\r
   This function terminates AP's task due to timeout by sending INIT-SIPI,\r
   and sends it to idle state.\r
 \r
@@ -1444,7 +1511,9 @@ PrepareAPStartupVector (
 {\r
   MP_ASSEMBLY_ADDRESS_MAP   AddressMap;\r
   IA32_DESCRIPTOR           GdtrForBSP;\r
+  IA32_DESCRIPTOR           IdtrForBSP;\r
   EFI_PHYSICAL_ADDRESS      GdtForAP;\r
+  EFI_PHYSICAL_ADDRESS      IdtForAP;\r
   EFI_STATUS                Status;\r
 \r
   //\r
@@ -1483,6 +1552,7 @@ PrepareAPStartupVector (
   mExchangeInfo->StackSize  = AP_STACK_SIZE;\r
 \r
   AsmReadGdtr (&GdtrForBSP);\r
+  AsmReadIdtr (&IdtrForBSP);\r
 \r
   //\r
   // Allocate memory under 4G to hold GDT for APs\r
@@ -1491,15 +1561,20 @@ PrepareAPStartupVector (
   Status   = gBS->AllocatePages (\r
                     AllocateMaxAddress,\r
                     EfiBootServicesData,\r
-                    EFI_SIZE_TO_PAGES (GdtrForBSP.Limit + 1),\r
+                    EFI_SIZE_TO_PAGES ((GdtrForBSP.Limit + 1) + (IdtrForBSP.Limit + 1)),\r
                     &GdtForAP\r
                     );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
+  IdtForAP = (UINTN) GdtForAP + GdtrForBSP.Limit + 1;\r
+\r
   CopyMem ((VOID *) (UINTN) GdtForAP, (VOID *) GdtrForBSP.Base, GdtrForBSP.Limit + 1);\r
+  CopyMem ((VOID *) (UINTN) IdtForAP, (VOID *) IdtrForBSP.Base, IdtrForBSP.Limit + 1);\r
 \r
   mExchangeInfo->GdtrProfile.Base  = (UINTN) GdtForAP;\r
   mExchangeInfo->GdtrProfile.Limit = GdtrForBSP.Limit;\r
+  mExchangeInfo->IdtrProfile.Base  = (UINTN) IdtForAP;\r
+  mExchangeInfo->IdtrProfile.Limit = IdtrForBSP.Limit;\r
 \r
   mExchangeInfo->BufferStart = (UINT32) mStartupVector;\r
   mExchangeInfo->Cr3         = (UINT32) (AsmReadCr3 ());\r
@@ -1507,7 +1582,7 @@ PrepareAPStartupVector (
 \r
 /**\r
   Prepares memory region for processor configuration.\r
-  \r
+\r
   This function prepares memory region for processor configuration.\r
 \r
 **/\r
@@ -1525,13 +1600,13 @@ PrepareMemoryForConfiguration (
   for (Index = 0; Index < MAX_CPU_NUMBER; Index++) {\r
     InitializeSpinLock (&mMPSystemData.CpuData[Index].CpuDataLock);\r
   }\r
-  \r
+\r
   PrepareAPStartupVector ();\r
 }\r
 \r
 /**\r
   Gets the processor number of BSP.\r
-  \r
+\r
   @return  The processor number of BSP.\r
 \r
 **/\r
@@ -1555,7 +1630,7 @@ GetBspNumber (
                                     &ProcessorContextBuffer\r
                                     );\r
     ASSERT_EFI_ERROR (Status);\r
-    \r
+\r
     if (ProcessorContextBuffer.Designation == EfiCpuBSP) {\r
       break;\r
     }\r
@@ -1568,9 +1643,9 @@ GetBspNumber (
 /**\r
   Entrypoint of MP Services Protocol thunk driver.\r
 \r
-  @param[in] ImageHandle    The firmware allocated handle for the EFI image.  \r
+  @param[in] ImageHandle    The firmware allocated handle for the EFI image.\r
   @param[in] SystemTable    A pointer to the EFI System Table.\r
-  \r
+\r
   @retval EFI_SUCCESS       The entry point is executed successfully.\r
 \r
 **/\r
@@ -1589,8 +1664,8 @@ InitializeMpServicesProtocol (
   // Locates Framework version MP Services Protocol\r
   //\r
   Status = gBS->LocateProtocol (\r
-                  &gFrameworkEfiMpServiceProtocolGuid, \r
-                  NULL, \r
+                  &gFrameworkEfiMpServiceProtocolGuid,\r
+                  NULL,\r
                   (VOID **) &mFrameworkMpService\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r
index c4e4b2b127a41bef705a27cd49141a32d32b0fb5..414cc96cf1453ddfce13d325d2b3d4c9f59dfdb0 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Include file for PI MP Services Protocol Thunk.\r
 \r
-Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -46,8 +46,11 @@ Module Name:
 //\r
 // Local APIC register definition for IPI.\r
 //\r
+#define APIC_REGISTER_SPURIOUS_VECTOR_OFFSET  0xF0\r
 #define APIC_REGISTER_ICR_LOW_OFFSET          0x300\r
 #define APIC_REGISTER_ICR_HIGH_OFFSET         0x310\r
+#define APIC_REGISTER_LINT0_VECTOR_OFFSET     0x350\r
+#define APIC_REGISTER_LINT1_VECTOR_OFFSET     0x360\r
 \r
 typedef struct {\r
   UINTN             Lock;\r
@@ -55,6 +58,7 @@ typedef struct {
   UINTN             StackSize;\r
   VOID              *ApFunction;\r
   IA32_DESCRIPTOR   GdtrProfile;\r
+  IA32_DESCRIPTOR   IdtrProfile;\r
   UINT32            BufferStart;\r
   UINT32            Cr3;\r
 } MP_CPU_EXCHANGE_INFO;\r
@@ -159,7 +163,7 @@ GetNumberOfProcessors (
   @retval EFI_SUCCESS           Processor information successfully returned.\r
   @retval EFI_DEVICE_ERROR      Caller processor is AP.\r
   @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL\r
-  @retval EFI_NOT_FOUND         Processor with the handle specified by ProcessorNumber does not exist. \r
+  @retval EFI_NOT_FOUND         Processor with the handle specified by ProcessorNumber does not exist.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -188,7 +192,7 @@ GetProcessorInfo (
   @param  FailedCpuList         The list of processor numbers that fail to finish the function before\r
                                 TimeoutInMicrosecsond expires.\r
 \r
-  @retval EFI_SUCCESS           In blocking mode, all APs have finished before the timeout expired. \r
+  @retval EFI_SUCCESS           In blocking mode, all APs have finished before the timeout expired.\r
   @retval EFI_SUCCESS           In non-blocking mode, function has been dispatched to all enabled APs.\r
   @retval EFI_DEVICE_ERROR      Caller processor is AP.\r
   @retval EFI_NOT_STARTED       No enabled AP exists in the system.\r
@@ -289,7 +293,7 @@ SwitchBSP (
   @retval EFI_DEVICE_ERROR       Caller processor is AP.\r
   @retval EFI_NOT_FOUND          Processor with the handle specified by ProcessorNumber does not exist.\r
   @retval EFI_INVALID_PARAMETERS ProcessorNumber specifies the BSP.\r
-  \r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -445,7 +449,7 @@ ApProcWrapper (
 \r
 /**\r
   Function to wake up a specified AP and assign procedure to it.\r
-  \r
+\r
   @param  ProcessorNumber  Handle number of the specified processor.\r
   @param  Procedure        Procedure to assign.\r
   @param  ProcArguments    Argument for Procedure.\r
@@ -460,7 +464,7 @@ WakeUpAp (
 \r
 /**\r
   Terminate AP's task and set it to idle state.\r
-  \r
+\r
   This function terminates AP's task due to timeout by sending INIT-SIPI,\r
   and sends it to idle state.\r
 \r
@@ -491,7 +495,7 @@ ChangeCpuState (
 \r
 /**\r
   Gets the processor number of BSP.\r
-  \r
+\r
   @return  The processor number of BSP.\r
 \r
 **/\r
index 073ce1c613ad28ef2cf7532dfa37cc221ebe9111..d0269760a6212d70780b58c4bc0caf553c536a34 100644 (file)
@@ -1,7 +1,7 @@
 ;------------------------------------------------------------------------------\r
 ; Include file for X64 MpFuncs.asm\r
 ;\r
-; Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
 ; This program and the accompanying materials\r
 ; are licensed and made available under the terms and conditions of the BSD License\r
 ; which accompanies this distribution.  The full text of the license may be found at\r
@@ -20,7 +20,8 @@ StackStartAddressLocation     equ        LockLocation + 08h
 StackSizeLocation             equ        LockLocation + 10h\r
 CProcedureLocation            equ        LockLocation + 18h\r
 GdtrLocation                  equ        LockLocation + 20h\r
-BufferStartLocation           equ        LockLocation + 2Ch\r
-Cr3OffsetLocation             equ        LockLocation + 30h\r
+IdtrLocation                  equ        LockLocation + 2Ah\r
+BufferStartLocation           equ        LockLocation + 34h\r
+Cr3OffsetLocation             equ        LockLocation + 38h\r
 \r
 ;-------------------------------------------------------------------------------\r
index dc21c144a83d478e7f8cb0e1204447c6874f5ec7..2c9feb07b05df4b0459fa398e0303d8c8a2743ec 100644 (file)
@@ -1,7 +1,7 @@
 #------------------------------------------------------------------------------\r
 # X64 assembly file for AP startup vector.\r
 #\r
-# Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -66,6 +66,11 @@ RendezvousFunnelProcStart:
         .byte 0x66                    # db         66h\r
         .byte 0x2E,0xF,0x1,0x14       # lgdt       fword ptr cs:[si]\r
 \r
+        .byte 0xBE\r
+        .word IdtrLocation\r
+        .byte 0x66                    # db         66h\r
+        .byte 0x2E,0xF,0x1,0x1C       # lidt       fword ptr cs:[si]\r
+\r
         .byte 0x33,0xC0               # xor        ax,  ax\r
         .byte 0x8E,0xD8               # mov        ds,  ax\r
 \r
index ad74c2dace4c0fbec677a802fca17560904f67e6..91bdb224512410df8a18889798442d4add0460a6 100644 (file)
@@ -1,7 +1,7 @@
 ;------------------------------------------------------------------------------\r
 ; X64 assembly file for AP startup vector.\r
 ;\r
-; Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
 ; This program and the accompanying materials\r
 ; are licensed and made available under the terms and conditions of the BSD License\r
 ; which accompanies this distribution.  The full text of the license may be found at\r
@@ -14,7 +14,7 @@
 \r
 .code\r
 \r
-include  AsmInclude.inc \r
+include  AsmInclude.inc\r
 ;-------------------------------------------------------------------------------------\r
 \r
 ;-------------------------------------------------------------------------------------\r
@@ -34,7 +34,7 @@ RendezvousFunnelProcStart::
         db 8ch,  0c8h                 ; mov        ax,  cs\r
         db 8eh,  0d8h                 ; mov        ds,  ax\r
         db 8eh,  0c0h                 ; mov        es,  ax\r
-        db 8eh,  0d0h                 ; mov        ss,  ax \r
+        db 8eh,  0d0h                 ; mov        ss,  ax\r
         db 33h,  0c0h                 ; xor        ax,  ax\r
         db 8eh,  0e0h                 ; mov        fs,  ax\r
         db 8eh,  0e8h                 ; mov        gs,  ax\r
@@ -48,15 +48,20 @@ RendezvousFunnelProcStart::
         db 0BEh\r
         dw Cr3OffsetLocation          ; mov        si, Cr3Location\r
         db 66h,  8Bh, 0Ch             ; mov        ecx,dword ptr [si]          ; ECX is keeping the value of CR3\r
-        \r
+\r
         db 0BEh\r
         dw GdtrLocation               ; mov        si, GdtrProfile\r
         db 66h                        ; db         66h\r
         db 2Eh,  0Fh, 01h, 14h        ; lgdt       fword ptr cs:[si]\r
 \r
+        db 0BEh\r
+        dw IdtrLocation               ; mov        si, IdtrProfile\r
+        db 66h                        ; db         66h\r
+        db 2Eh,  0Fh, 01h, 1Ch        ; lidt       fword ptr cs:[si]\r
+\r
         db 33h,  0C0h                 ; xor        ax,  ax\r
         db 8Eh,  0D8h                 ; mov        ds,  ax\r
-        \r
+\r
         db 0Fh,  20h, 0C0h            ; mov        eax, cr0                    ; Get control register 0\r
         db 66h,  83h, 0C8h, 01h       ; or         eax, 000000001h             ; Set PE bit (bit #0)\r
         db 0Fh,  22h, 0C0h            ; mov        cr0, eax\r
@@ -81,25 +86,25 @@ ProtectedModeStart::
         db 0Fh,  22h,  0E0h           ; mov        cr4, eax\r
 \r
         db 0Fh,  22h,  0D9h           ; mov        cr3, ecx\r
-        \r
+\r
         db 8Bh,  0F2h                 ; mov        esi, edx                    ; Save wakeup buffer address\r
-        \r
+\r
         db 0B9h\r
         dd 0C0000080h                 ; mov        ecx, 0c0000080h             ; EFER MSR number.\r
         db 0Fh,  32h                  ; rdmsr                                  ; Read EFER.\r
         db 0Fh,  0BAh, 0E8h, 08h      ; bts        eax, 8                      ; Set LME=1.\r
         db 0Fh,  30h                  ; wrmsr                                  ; Write EFER.\r
-        \r
+\r
         db 0Fh,  20h,  0C0h           ; mov        eax, cr0                    ; Read CR0.\r
         db 0Fh,  0BAh, 0E8h, 1Fh      ; bts        eax, 31                     ; Set PG=1.\r
         db 0Fh,  22h,  0C0h           ; mov        cr0, eax                    ; Write CR0.\r
 \r
 LONG_JUMP::\r
-        \r
+\r
         db 67h,  0EAh                 ; far jump\r
         dd 0h                         ; 32-bit offset\r
         dw 38h                        ; 16-bit selector\r
-        \r
+\r
 LongModeStart::\r
 \r
         mov         ax,  30h\r
@@ -146,13 +151,13 @@ Releaselock::
         sub         rsp, 20h\r
         call        rax\r
         add         rsp, 20h\r
-        \r
+\r
 GoToSleep::\r
 \r
         cli\r
         hlt\r
         jmp         $-2\r
-        \r
+\r
 RendezvousFunnelProc   ENDP\r
 RendezvousFunnelProcEnd::\r
 \r
@@ -160,7 +165,7 @@ RendezvousFunnelProcEnd::
 ;-------------------------------------------------------------------------------------\r
 ;  AsmGetAddressMap (&AddressMap);\r
 ;-------------------------------------------------------------------------------------\r
-AsmGetAddressMap   PROC  \r
+AsmGetAddressMap   PROC\r
 \r
         mov         rax, offset RendezvousFunnelProcStart\r
         mov         qword ptr [rcx], rax\r
@@ -169,9 +174,9 @@ AsmGetAddressMap   PROC
         mov         qword ptr [rcx+18h], LongModeStart - RendezvousFunnelProcStart\r
         mov         qword ptr [rcx+20h], LONG_JUMP - RendezvousFunnelProcStart\r
         mov         qword ptr [rcx+28h], RendezvousFunnelProcEnd - RendezvousFunnelProcStart\r
-        \r
+\r
         ret\r
-        \r
+\r
 AsmGetAddressMap   ENDP\r
 \r
 END\r