]> git.proxmox.com Git - mirror_edk2.git/commitdiff
We enabled X64 native version NT32, and made it works on Windows 7 X64 OS.
authorJiamin Ma <mjmthy@gmail.com>
Sat, 12 Oct 2013 06:31:55 +0000 (06:31 +0000)
committerjyao1 <jyao1@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 12 Oct 2013 06:31:55 +0000 (06:31 +0000)
Signed-off-by: Jiamin Ma <mjmthy@gmail.com>
Reviewed by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed by: Liming Gao <liming.gao@intel.com>
Reviewed by: Jiewen Yao <jiewen.yao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14766 6f19259b-4bc3-4df7-8a09-765794883524

17 files changed:
Nt32Pkg/CpuRuntimeDxe/Cpu.c
Nt32Pkg/CpuRuntimeDxe/CpuIo.c
Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c
Nt32Pkg/Include/Common/WinNTInclude.h
Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c
Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c
Nt32Pkg/Nt32Pkg.dsc
Nt32Pkg/Nt32Pkg.fdf
Nt32Pkg/Sec/SecMain.c
Nt32Pkg/Sec/SecMain.inf
Nt32Pkg/Sec/StackX64.asm [new file with mode: 0644]
Nt32Pkg/SnpNt32Dxe/SnpNt32.c
Nt32Pkg/StallPei/Stall.c
Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c
Nt32Pkg/WinNtGopDxe/WinNtGopScreen.c
Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c

index d15ac989eac545e5ba59c177b164ee4ec943605e..9e7dfbb29fbaabd3d06689676daf8815608e6ac7 100644 (file)
@@ -1,6 +1,6 @@
 /**@file\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, 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
@@ -467,7 +467,7 @@ Returns:
   ASSERT (CpuVerStrLen <= SMBIOS_STRING_MAX_LENGTH);\r
 \r
 \r
-  TotalSize = sizeof(SMBIOS_TABLE_TYPE4) + CpuVerStrLen + 1 + 1;\r
+  TotalSize = (UINT32)(sizeof(SMBIOS_TABLE_TYPE4) + CpuVerStrLen + 1 + 1);\r
   SmbiosRecord = AllocatePool(TotalSize);\r
   ZeroMem(SmbiosRecord, TotalSize);\r
 \r
index 7f171e6094f4ef9d78c5b980b3500ffb5adab656..9c3478f0a384a7cdf5fc1c1febdcb2054877204a 100644 (file)
@@ -1,6 +1,6 @@
 /**@file\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, 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
@@ -326,11 +326,11 @@ Returns:
   }\r
 \r
   Width = (EFI_CPU_IO_PROTOCOL_WIDTH)(Width & 0x03);\r
-  if (Address - 1 + (1 << Width) * Count > Limit) {\r
+  if (Address - 1 + ((UINTN)1 << Width) * Count > Limit) {\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
-  AlignMask = (1 << Width) - 1;\r
+  AlignMask = ((UINTN)1 << Width) - 1;\r
   if ((UINTN) Buffer & AlignMask) {\r
     return EFI_UNSUPPORTED;\r
   }\r
index 00a5f18ef23b64fbfdc62905baf66b7cdb634e7c..3400516f0c3ce9e0a66fe0ebe301fc22e952eaad 100644 (file)
@@ -950,7 +950,7 @@ Returns:
     //\r
     // Check input parameters\r
     //\r
-    if (NumOfLba == 0 || (StartingLba + NumOfLba) > NumOfBlocks) {\r
+    if ((NumOfLba == 0) || ((StartingLba + NumOfLba) > NumOfBlocks)) {\r
       VA_END (args);\r
       return EFI_INVALID_PARAMETER;\r
     }\r
index 7d62c9d551256e842b3c57cf2e0c93357525f64b..3f4fb2373219fc69383a8d656594d97dae00784f 100644 (file)
@@ -1,6 +1,6 @@
 /**@file\r
 \r
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, 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
@@ -34,9 +34,11 @@ Abstract:
 #define GUID  _WINNT_DUP_GUID_____\r
 #define _LIST_ENTRY  _WINNT_DUP_LIST_ENTRY_FORWARD\r
 #define LIST_ENTRY   _WINNT_DUP_LIST_ENTRY\r
+#if defined (MDE_CPU_IA32)\r
 #define InterlockedIncrement _WINNT_DUP_InterlockedIncrement\r
 #define InterlockedDecrement _WINNT_DUP_InterlockedDecrement\r
 #define InterlockedCompareExchange64 _WINNT_DUP_InterlockedCompareExchange64\r
+#endif\r
 #undef UNALIGNED\r
 #undef CONST\r
 #undef VOID\r
@@ -45,7 +47,9 @@ Abstract:
 // WQBugBug: This typedef is to make "windows.h" buildable.\r
 //                   It should be removed after the root cause why\r
 //                   size_t is undefined when go into the line below is found.\r
+#if defined (MDE_CPU_IA32)\r
 typedef UINT32 size_t ;\r
+#endif\r
 \r
 #include "windows.h"\r
 \r
index b024a9157b385bd35381220202460b31fb32f8ee..e6f072e9962550d0c66ce1c0868c5e85933d9deb 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   OEM hook status code library functions with no library constructor/destructor\r
 \r
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2013, 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
@@ -145,7 +145,7 @@ OemHookStatusCodeReport (
     mWinNt->WriteFile (\r
               mStdOut,\r
               Buffer,\r
-              CharCount,\r
+              (DWORD)CharCount,\r
               (LPDWORD)&CharCount,\r
               NULL\r
               );\r
@@ -228,7 +228,7 @@ OemHookStatusCodeReport (
   mWinNt->WriteFile (\r
             mStdOut,\r
             Buffer,\r
-            CharCount,\r
+            (DWORD)CharCount,\r
             (LPDWORD)&CharCount,\r
             NULL\r
             );\r
index cacd78db1137dea88c0a8ec3b5081a0e3b926adc..5ae0b25c378f34388cd57f77a66562bc81c04afa 100644 (file)
@@ -1,6 +1,6 @@
 /**@file\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, 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
@@ -319,6 +319,6 @@ PeCoffGetSizeOfHeaders (
     SizeOfHeaders = 0;\r
   }\r
 \r
-  return SizeOfHeaders;\r
+  return (UINT32) SizeOfHeaders;\r
 }\r
 \r
index 882d1c4f4f8d4a1980f6c48909449426acacd3af..4e37683400c08fe2fd8707ef2a44d2cbf82b5a7a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   OEM hook status code library functions with no library constructor/destructor\r
 \r
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2013, 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
@@ -154,7 +154,7 @@ OemHookStatusCodeReport (
     mWinNt->WriteFile (\r
               mStdOut,\r
               Buffer,\r
-              CharCount,\r
+              (DWORD)CharCount,\r
               (LPDWORD)&CharCount,\r
               NULL\r
               );\r
@@ -237,7 +237,7 @@ OemHookStatusCodeReport (
   mWinNt->WriteFile (\r
             mStdOut,\r
             Buffer,\r
-            CharCount,\r
+            (DWORD)CharCount,\r
             (LPDWORD)&CharCount,\r
             NULL\r
             );\r
index 923bc4e7a9da2b17e98032d753c7a87ce75d2e22..56c97e51b13cb5a9b83310a67496d9e3ad605b02 100644 (file)
@@ -27,7 +27,7 @@
   PLATFORM_VERSION               = 0.4\r
   DSC_SPECIFICATION              = 0x00010005\r
   OUTPUT_DIRECTORY               = Build/NT32\r
-  SUPPORTED_ARCHITECTURES        = IA32\r
+  SUPPORTED_ARCHITECTURES        = IA32|X64\r
   BUILD_TARGETS                  = DEBUG|RELEASE\r
   SKUID_IDENTIFIER               = DEFAULT\r
   FLASH_DEFINITION               = Nt32Pkg/Nt32Pkg.fdf\r
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf\r
   DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf\r
   CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf\r
+  LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf\r
   \r
 !if $(SECURE_BOOT_ENABLE) == TRUE\r
   PlatformSecureLib|Nt32Pkg/Library/PlatformSecureLib/PlatformSecureLib.inf\r
 [PcdsFeatureFlag]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplBuildPageTables|FALSE\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|FALSE\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics|TRUE\r
 \r
 ################################################################################\r
 [PcdsDynamicDefault.common.DEFAULT]\r
   gEfiNt32PkgTokenSpaceGuid.PcdWinNtSerialPort|L"COM1!COM2"|VOID*|20\r
-  gEfiNt32PkgTokenSpaceGuid.PcdWinNtFileSystem|L".!..\..\..\..\EdkShellBinPkg\Bin\Ia32\Apps"|VOID*|106\r
   gEfiNt32PkgTokenSpaceGuid.PcdWinNtGop|L"UGA Window 1!UGA Window 2"|VOID*|52\r
   gEfiNt32PkgTokenSpaceGuid.PcdWinNtConsole|L"Bus Driver Console Window"|VOID*|52\r
   gEfiNt32PkgTokenSpaceGuid.PcdWinNtVirtualDisk|L"FW;40960;512"|VOID*|26\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0\r
 \r
+[PcdsDynamicDefault.Ia32]\r
+  gEfiNt32PkgTokenSpaceGuid.PcdWinNtFileSystem|L".!..\..\..\..\EdkShellBinPkg\Bin\Ia32\Apps"|VOID*|106\r
+\r
+[PcdsDynamicDefault.x64]\r
+  gEfiNt32PkgTokenSpaceGuid.PcdWinNtFileSystem|L".!..\..\..\..\EdkShellBinPkg\Bin\X64\Apps"|VOID*|106\r
+\r
 [PcdsDynamicHii.common.DEFAULT]\r
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupConOutColumn|L"SetupConsoleConfig"|gEfiNt32PkgTokenSpaceGuid|0x0|80\r
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupConOutRow|L"SetupConsoleConfig"|gEfiNt32PkgTokenSpaceGuid|0x4|25\r
 #       generated for it, but the binary will not be put into any firmware volume.\r
 #\r
 ###################################################################################################\r
-[Components.IA32]\r
+[Components]\r
   ##\r
   #  SEC Phase modules\r
   ##\r
-  Nt32Pkg/Sec/SecMain.inf\r
+  Nt32Pkg/Sec/SecMain.inf {\r
+  <BuildOptions>\r
+    # Add override here, because default X64_CC_FLAGS is already overriden in DSC\r
+    MSFT:*_*_X64_CC_FLAGS == /nologo /W4 /WX /Gy /c /D UNICODE /Od /FIAutoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE\r
+  }\r
 \r
   ##\r
   #  PEI Phase modules\r
       NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf\r
       DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf\r
     <BuildOptions>\r
-      *_*_IA32_CC_FLAGS =\r
+      *_*_*_CC_FLAGS =\r
   }\r
 \r
   MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {\r
 #\r
 ###################################################################################################\r
 [BuildOptions]\r
-  DEBUG_*_IA32_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000 /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE\r
-  RELEASE_*_IA32_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096\r
+  DEBUG_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000 /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE\r
+  RELEASE_*_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096\r
   *_*_IA32_CC_FLAGS = /D EFI_SPECIFICATION_VERSION=0x0002000A /D TIANO_RELEASE_VERSION=0x00080006\r
 \r
+# Add override here, because default X64_CC_FLAGS add /X\r
+  DEBUG_*_X64_CC_FLAGS     == /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm /D EFI_SPECIFICATION_VERSION=0x0002000A /D TIANO_RELEASE_VERSION=0x00080006\r
+RELEASE_*_X64_CC_FLAGS     == /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /D EFI_SPECIFICATION_VERSION=0x0002000A /D TIANO_RELEASE_VERSION=0x00080006\r
+NOOPT_*_X64_CC_FLAGS       == /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm /Od /D EFI_SPECIFICATION_VERSION=0x0002000A /D TIANO_RELEASE_VERSION=0x00080006\r
+\r
 #############################################################################################################\r
 # NOTE:\r
-# The following [Libraries.IA32] section is for building EDK module under the EDKII tool chain.\r
-# If you want build EDK module for Nt32 platform, please uncomment [Libraries.IA32] section and\r
+# The following [Libraries] section is for building EDK module under the EDKII tool chain.\r
+# If you want build EDK module for Nt32 platform, please uncomment [Libraries] section and\r
 # libraries used by that EDK module.\r
 # Currently, Nt32 platform do not has any EDK style module\r
 #\r
 #\r
-#[Libraries.IA32]\r
+#[Libraries]\r
   #\r
   # Libraries common to PEI and DXE\r
   #\r
index 7315d432fa5558bc8108c0485f07a4252f4744b2..8282fcf2f471c6430bc659503e0eb29c75cff666 100644 (file)
@@ -270,13 +270,9 @@ INF  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 # for binary shell, binary fat and logo module.\r
 #\r
 ################################################################################\r
-FILE APPLICATION = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile) {\r
-    SECTION PE32 = EdkShellBinPkg/FullShell/Ia32/Shell_Full.efi\r
-  }\r
+INF EdkShellBinPkg/FullShell/FullShell.inf\r
 \r
-FILE DRIVER = 961578FE-B6B7-44c3-AF35-6BC705CD2B1F {\r
-    SECTION PE32 = FatBinPkg/EnhancedFatDxe/Ia32/Fat.efi\r
-  }\r
+INF FatBinPkg/EnhancedFatDxe/Fat.inf\r
 \r
 FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {\r
     SECTION RAW = MdeModulePkg/Logo/Logo.bmp\r
@@ -391,3 +387,26 @@ FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
       }\r
     }\r
   }\r
+\r
+[Rule.Common.UEFI_APPLICATION.BINARY]\r
+  FILE APPLICATION = $(NAMED_GUID) {\r
+    COMPRESS PI_STD {\r
+      GUIDED {\r
+        PE32     PE32                    |.efi\r
+        UI       STRING="$(MODULE_NAME)" Optional\r
+        VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)\r
+      }\r
+    }\r
+  }\r
+\r
+[Rule.Common.UEFI_DRIVER.BINARY]\r
+  FILE DRIVER = $(NAMED_GUID) {\r
+    DXE_DEPEX    DXE_DEPEX Optional      |.depex\r
+    COMPRESS PI_STD {\r
+      GUIDED {\r
+        PE32     PE32                    |.efi\r
+        UI       STRING="$(MODULE_NAME)" Optional\r
+        VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)\r
+      }\r
+    }\r
+  }\r
index a1d43d2eba424c80f0502da518d6e5fdd1202327..602cca9b1bfed9b6ca8f5dcc0b16ab4388ecda24 100644 (file)
@@ -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
@@ -505,6 +515,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 +573,7 @@ PeiSwitchStacks (
   //\r
   ASSERT (FALSE);  \r
 }\r
+#endif\r
 \r
 VOID\r
 SecLoadFromCore (\r
index e9596b9b137977a66820fb837067f225e131abe1..fee68e095213f5e6e182cb0d07b3b5153f80c8ba 100644 (file)
   WinNtThunk.c\r
   FwVol.c\r
   SecMain.c\r
+\r
+[Sources.ia32]\r
   Stack.asm\r
 \r
+[Sources.x64]\r
+  StackX64.asm\r
+\r
 [Packages]\r
   MdePkg/MdePkg.dec\r
   MdeModulePkg/MdeModulePkg.dec\r
   MSFT:*_*_IA32_ASM_FLAGS == /nologo /W3 /WX /c /coff /Cx /Zd /W0 /Zi\r
   MSFT:*_*_IA32_ASMLINK_FLAGS       == /link /nologo /tiny\r
 \r
+  MSFT:*_*_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib\AMD64" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib\r
+  MSFT:*_*_X64_CC_FLAGS == /nologo /W4 /WX /Gy /c /D UNICODE /Od /FIAutoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE\r
+  MSFT:*_*_X64_PP_FLAGS == /nologo /E /TC /FIAutoGen.h\r
+  MSFT:*_*_X64_ASM_FLAGS == /nologo /W3 /WX /c /Cx /Zd /W0 /Zi\r
+  MSFT:*_*_X64_ASMLINK_FLAGS       == /link /nologo\r
+\r
   INTEL:*_*_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"C:\Program Files\Intel\Compiler\C++\9.1\IA32\Lib" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib\r
   INTEL:*_*_IA32_CC_FLAGS == /nologo /W4 /WX /Gy /c /D UNICODE /Od /FIAutoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE\r
   INTEL:*_*_IA32_PP_FLAGS == /nologo /E /TC /FIAutoGen.h\r
diff --git a/Nt32Pkg/Sec/StackX64.asm b/Nt32Pkg/Sec/StackX64.asm
new file mode 100644 (file)
index 0000000..2327e2e
--- /dev/null
@@ -0,0 +1,110 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2013, 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
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   Stack.asm\r
+;\r
+; Abstract:\r
+;\r
+;   Switch the stack from temporary memory to permenent memory.\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .code\r
+    \r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; SecSwitchStack (\r
+;   UINT32   TemporaryMemoryBase,\r
+;   UINT32   PermenentMemoryBase\r
+;   );\r
+;------------------------------------------------------------------------------    \r
+SecSwitchStack   PROC\r
+    mov [rsp + 08h], rcx\r
+    mov [rsp + 10h], rdx\r
+\r
+    ;\r
+    ; Save three register: eax, ebx, ecx\r
+    ;\r
+    push  rax\r
+    push  rbx\r
+    push  rcx\r
+    push  rdx\r
+    \r
+    ;\r
+    ; !!CAUTION!! this function address's is pushed into stack after\r
+    ; migration of whole temporary memory, so need save it to permenent\r
+    ; memory at first!\r
+    ;\r
+    \r
+    mov   rbx, [rsp + 28h]          ; Save the first parameter\r
+    mov   rcx, [rsp + 30h]          ; Save the second parameter\r
+    \r
+    ;\r
+    ; Save this function's return address into permenent memory at first.\r
+    ; Then, Fixup the esp point to permenent memory\r
+    ;\r
+    mov   rax, rsp\r
+    sub   rax, rbx\r
+    add   rax, rcx\r
+    mov   rdx, qword ptr [rsp]         ; copy pushed register's value to permenent memory\r
+    mov   qword ptr [rax], rdx    \r
+    mov   rdx, qword ptr [rsp + 8]\r
+    mov   qword ptr [rax + 8], rdx    \r
+    mov   rdx, qword ptr [rsp + 10h]\r
+    mov   qword ptr [rax + 10h], rdx    \r
+    mov   rdx, qword ptr [rsp + 18h]\r
+    mov   qword ptr [rax + 18h], rdx    \r
+    mov   rdx, qword ptr [rsp + 20h]    ; Update this function's return address into permenent memory\r
+    mov   qword ptr [rax + 20h], rdx    \r
+    mov   rsp, rax                     ; From now, esp is pointed to permenent memory\r
+        \r
+    ;\r
+    ; Fixup the ebp point to permenent memory\r
+    ;\r
+    mov   rax, rbp\r
+    sub   rax, rbx\r
+    add   rax, rcx\r
+    mov   rbp, rax                ; From now, ebp is pointed to permenent memory\r
+    \r
+    pop   rdx\r
+    pop   rcx\r
+    pop   rbx\r
+    pop   rax\r
+    ret\r
+SecSwitchStack   ENDP\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
+PeiSwitchStacks   PROC\r
+    mov  rax, rcx\r
+    mov  rcx, rdx\r
+    mov  rdx, r8\r
+    mov  r8, r9\r
+    mov  rsp, [rsp + 28h]\r
+    sub  rsp, 20h\r
+    call rax\r
+    jmp $\r
+    ret\r
+PeiSwitchStacks   ENDP\r
+\r
+    END\r
index 86414696c418e88c5f9379f1a12948dbd61eca5b..4dee182ad839db051532ea6d4c27d1c7a65fcff0 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, 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
@@ -704,7 +704,7 @@ SnpNt32ReceiveFilters (
   ReturnValue = GlobalData->NtNetUtilityTable.SetReceiveFilter (\r
                                                 Instance->InterfaceInfo.InterfaceIndex,\r
                                                 EnableBits,\r
-                                                McastFilterCount,\r
+                                                (UINT32)McastFilterCount,\r
                                                 McastFilter\r
                                                 );\r
 \r
@@ -863,7 +863,7 @@ SnpNt32GetStatus (
 {\r
 \r
   if (TxBuffer != NULL) {\r
-    *((UINT8 **) TxBuffer) = (UINT8 *) 1;\r
+    *((UINT8 **) TxBuffer) = (UINT8 *)(UINTN) 1;\r
   }\r
 \r
   if (InterruptStatus != NULL) {\r
@@ -933,8 +933,8 @@ SnpNt32Transmit (
 \r
   ReturnValue = GlobalData->NtNetUtilityTable.Transmit (\r
                                                 Instance->InterfaceInfo.InterfaceIndex,\r
-                                                HeaderSize,\r
-                                                BufferSize,\r
+                                                (UINT32)HeaderSize,\r
+                                                (UINT32)BufferSize,\r
                                                 Buffer,\r
                                                 SrcAddr,\r
                                                 DestAddr,\r
@@ -1189,7 +1189,7 @@ SnpNt32InitializeGlobalData (
     //\r
     //  Set the interface information.\r
     //\r
-    Instance->InterfaceInfo = NetInterfaceInfoBuffer[Index];\r
+    CopyMem (&Instance->InterfaceInfo, &NetInterfaceInfoBuffer[Index], sizeof(Instance->InterfaceInfo));\r
     //\r
     //  Initialize this instance\r
     //\r
@@ -1265,8 +1265,8 @@ SnpNt32InitializeInstanceData (
   //\r
   //  Copy Current/PermanentAddress MAC address\r
   //\r
-  Instance->Mode.CurrentAddress   = Instance->InterfaceInfo.MacAddr;\r
-  Instance->Mode.PermanentAddress = Instance->InterfaceInfo.MacAddr;\r
+  CopyMem (&Instance->Mode.CurrentAddress, &Instance->InterfaceInfo.MacAddr, sizeof(Instance->Mode.CurrentAddress));\r
+  CopyMem (&Instance->Mode.PermanentAddress, &Instance->InterfaceInfo.MacAddr, sizeof(Instance->Mode.PermanentAddress));\r
 \r
   //\r
   //  Since the fake SNP is based on a real NIC, to avoid conflict with the host\r
index e89338dcdfc2cc300314c3b07b827c65990c0f46..c00ada872d3105be1f308494c31681cce66dea54 100644 (file)
@@ -1,7 +1,7 @@
 /**@file\r
   EFI_PEI_STALL implementation for NT32 simulation environment.\r
   \r
-Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2013, 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
@@ -100,7 +100,7 @@ Stall (
   // so micro second units need be divided by 1000 to convert to ms\r
   //\r
   NtThunk = (EFI_WIN_NT_THUNK_PROTOCOL*) PeiNtService->NtThunk();\r
-  NtThunk->Sleep ((Microseconds + 999) / 1000); \r
+  NtThunk->Sleep ((DWORD)((Microseconds + 999) / 1000)); \r
   \r
   return EFI_SUCCESS;\r
 }\r
index 12924e659fbab77db9475d748767c5e8aebd792f..f9f286705f7d54772339562bbb10bed28ef3a8f7 100644 (file)
@@ -529,7 +529,7 @@ Returns:
   BlockIo = &Private->BlockIo;\r
   BlockIo->Revision = EFI_BLOCK_IO_PROTOCOL_REVISION;\r
   BlockIo->Media = &Private->Media;\r
-  BlockIo->Media->BlockSize = Private->BlockSize;\r
+  BlockIo->Media->BlockSize = (UINT32)Private->BlockSize;\r
   BlockIo->Media->LastBlock = Private->NumberOfBlocks - 1;\r
   BlockIo->Media->MediaId = 0;;\r
 \r
@@ -626,10 +626,10 @@ Returns:
   //\r
   Private->NtHandle = Private->WinNtThunk->CreateFile (\r
                                             Private->Filename,\r
-                                            Private->ReadMode,\r
-                                            Private->ShareMode,\r
+                                            (DWORD)Private->ReadMode,\r
+                                            (DWORD)Private->ShareMode,\r
                                             NULL,\r
-                                            Private->OpenMode,\r
+                                            (DWORD)Private->OpenMode,\r
                                             0,\r
                                             NULL\r
                                             );\r
@@ -658,7 +658,7 @@ Returns:
   Status = SetFilePointer64 (Private, 0, &FileSize, FILE_END);\r
 \r
   if (EFI_ERROR (Status)) {\r
-    FileSize = MultU64x32 (Private->NumberOfBlocks, Private->BlockSize);\r
+    FileSize = MultU64x32 (Private->NumberOfBlocks, (UINT32)Private->BlockSize);\r
     if (Private->DeviceType == EfiWinNtVirtualDisks) {\r
       DEBUG ((EFI_D_ERROR, "PlOpenBlock: Could not get filesize of %s\n", Private->Filename));\r
       Status = EFI_UNSUPPORTED;\r
@@ -667,10 +667,10 @@ Returns:
   }\r
 \r
   if (Private->NumberOfBlocks == 0) {\r
-    Private->NumberOfBlocks = DivU64x32 (FileSize, Private->BlockSize);\r
+    Private->NumberOfBlocks = DivU64x32 (FileSize, (UINT32)Private->BlockSize);\r
   }\r
 \r
-  EndOfFile = MultU64x32 (Private->NumberOfBlocks, Private->BlockSize);\r
+  EndOfFile = MultU64x32 (Private->NumberOfBlocks, (UINT32)Private->BlockSize);\r
 \r
   if (FileSize != EndOfFile) {\r
     //\r
@@ -832,7 +832,7 @@ Returns:
     return EFI_MEDIA_CHANGED;\r
   }\r
 \r
-  if ((UINT32) Buffer % Private->Media.IoAlign != 0) {\r
+  if ((UINTN) Buffer % Private->Media.IoAlign != 0) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -858,7 +858,7 @@ Returns:
   //\r
   // Seek to End of File\r
   //\r
-  DistanceToMove = MultU64x32 (Lba, BlockSize);\r
+  DistanceToMove = MultU64x32 (Lba, (UINT32)BlockSize);\r
   Status = SetFilePointer64 (Private, DistanceToMove, &DistanceMoved, FILE_BEGIN);\r
 \r
   if (EFI_ERROR (Status)) {\r
index 607caad2e9a491da85e704f8fdd37f0118d57ea8..b15d621b3b2c28fe8ef2174deda2ab6788925d9c 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, 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
@@ -379,7 +379,7 @@ WinNtGopSetMode (
     //\r
     // Adjust the window size\r
     //\r
-    Private->WinNtThunk->MoveWindow (Private->WindowHandle, Rect.left, Rect.top, Width, Height, TRUE);\r
+    Private->WinNtThunk->MoveWindow (Private->WindowHandle, Rect.left, Rect.top, (INT32)Width, (INT32)Height, TRUE);\r
 \r
   }\r
 \r
@@ -582,10 +582,10 @@ WinNtGopBlt (
     //\r
     // Mark the area we just blted as Invalid so WM_PAINT will update.\r
     //\r
-    Rect.left   = DestinationX;\r
-    Rect.top    = DestinationY;\r
-    Rect.right  = DestinationX + Width;\r
-    Rect.bottom = DestinationY + Height;\r
+    Rect.left   = (LONG)DestinationX;\r
+    Rect.top    = (LONG)DestinationY;\r
+    Rect.right  = (LONG)(DestinationX + Width);\r
+    Rect.bottom = (LONG)(DestinationY + Height);\r
     Private->WinNtThunk->InvalidateRect (Private->WindowHandle, &Rect, FALSE);\r
 \r
     //\r
@@ -900,7 +900,7 @@ WinNtGopThreadWinMain (
   Private->WindowsClass.hInstance     = NULL;\r
   Private->WindowsClass.hIcon         = Private->WinNtThunk->LoadIcon (NULL, IDI_APPLICATION);\r
   Private->WindowsClass.hCursor       = Private->WinNtThunk->LoadCursor (NULL, IDC_ARROW);\r
-  Private->WindowsClass.hbrBackground = (HBRUSH) COLOR_WINDOW;\r
+  Private->WindowsClass.hbrBackground = (HBRUSH)(UINTN)COLOR_WINDOW;\r
   Private->WindowsClass.lpszMenuName  = NULL;\r
   Private->WindowsClass.lpszClassName = WIN_NT_GOP_CLASS_NAME;\r
   Private->WindowsClass.hIconSm       = Private->WinNtThunk->LoadIcon (NULL, IDI_APPLICATION);\r
@@ -963,7 +963,7 @@ WinNtGopThreadWinMain (
     Private->WinNtThunk->DispatchMessage (&Message);\r
   }\r
 \r
-  return Message.wParam;\r
+  return (DWORD)Message.wParam;\r
 }\r
 \r
 \r
index 63ab71fb2baa09acf5f4ce2582f03a30cefe95b1..1c300b6930f2568262d2eb628978b36bb4fcb562 100644 (file)
@@ -1,6 +1,6 @@
 /**@file\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, 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
@@ -1593,7 +1593,7 @@ Returns:
     Status = PrivateFile->WinNtThunk->ReadFile (\r
                                         PrivateFile->LHandle,\r
                                         Buffer,\r
-                                        *BufferSize,\r
+                                        (DWORD)*BufferSize,\r
                                         (LPDWORD)BufferSize,\r
                                         NULL\r
                                         ) ? EFI_SUCCESS : EFI_DEVICE_ERROR;\r
@@ -1764,7 +1764,7 @@ Returns:
   Status = PrivateFile->WinNtThunk->WriteFile (\r
                                       PrivateFile->LHandle,\r
                                       Buffer,\r
-                                      *BufferSize,\r
+                                      (DWORD)*BufferSize,\r
                                       (LPDWORD)BufferSize,\r
                                       NULL\r
                                       ) ? EFI_SUCCESS : EFI_DEVICE_ERROR;\r