]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/Sec/SecMain.c
Move Smbios measurement from TCG driver to Smbios driver.
[mirror_edk2.git] / Nt32Pkg / Sec / SecMain.c
index a1d43d2eba424c80f0502da518d6e5fdd1202327..e6eb3cf45e05575f17adf15104a49dd0acb2e0b6 100644 (file)
@@ -1,6 +1,6 @@
 /**@file\r
 \r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2015, 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
@@ -109,6 +109,16 @@ SecNt32PeCoffRelocateImage (
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext\r
   );\r
 \r
+VOID\r
+EFIAPI\r
+PeiSwitchStacks (\r
+  IN      SWITCH_STACK_ENTRY_POINT  EntryPoint,\r
+  IN      VOID                      *Context1,  OPTIONAL\r
+  IN      VOID                      *Context2,  OPTIONAL\r
+  IN      VOID                      *Context3,  OPTIONAL\r
+  IN      VOID                      *NewStack\r
+  );\r
+\r
 VOID\r
 SecPrint (\r
   CHAR8  *Format,\r
@@ -129,7 +139,7 @@ SecPrint (
   WriteFile (\r
     GetStdHandle (STD_OUTPUT_HANDLE), \r
     Buffer,\r
-    CharCount,\r
+    (DWORD)CharCount,\r
     (LPDWORD)&CharCount,\r
     NULL\r
     );\r
@@ -173,6 +183,10 @@ Returns:
   CHAR16                *MemorySizeStr;\r
   CHAR16                *FirmwareVolumesStr;\r
   UINTN                 *StackPointer;\r
+  UINT32                ProcessAffinityMask;\r
+  UINT32                SystemAffinityMask;\r
+  INT32                 LowBit;\r
+\r
 \r
   //\r
   // Enable the privilege so that RTC driver can successfully run SetTime()\r
@@ -189,6 +203,20 @@ Returns:
 \r
   SecPrint ("\nEDK II SEC Main NT Emulation Environment from www.TianoCore.org\n");\r
 \r
+  //\r
+  // Determine the first thread available to this process.\r
+  //\r
+  if (GetProcessAffinityMask (GetCurrentProcess (), &ProcessAffinityMask, &SystemAffinityMask)) {\r
+    LowBit = (INT32)LowBitSet32 (ProcessAffinityMask);\r
+    if (LowBit != -1) {\r
+      //\r
+      // Force the system to bind the process to a single thread to work\r
+      // around odd semaphore type crashes.\r
+      //\r
+      SetProcessAffinityMask (GetCurrentProcess (), (INTN)(BIT0 << LowBit));\r
+    }\r
+  }\r
+\r
   //\r
   // Make some Windows calls to Set the process to the highest priority in the\r
   //  idle class. We need this to have good performance.\r
@@ -505,6 +533,7 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+#if defined (MDE_CPU_IA32)\r
 /**\r
   Transfers control to a function starting with a new stack.\r
 \r
@@ -562,6 +591,7 @@ PeiSwitchStacks (
   //\r
   ASSERT (FALSE);  \r
 }\r
+#endif\r
 \r
 VOID\r
 SecLoadFromCore (\r