This code produces 128 K of temporary memory for the SEC stack by directly\r
allocate memory space with ReadWrite and Execute attribute.\r
\r
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2016-2020 Hewlett Packard Enterprise Development LP<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
**/\r
return EFI_UNSUPPORTED;\r
}\r
\r
- //\r
- // Allocate enough memory space for emulator\r
- //\r
- gSystemMemory[Index].Memory = (EFI_PHYSICAL_ADDRESS)(UINTN)VirtualAlloc (NULL, (SIZE_T)(gSystemMemory[Index].Size), MEM_COMMIT, PAGE_EXECUTE_READWRITE);\r
- if (gSystemMemory[Index].Memory == 0) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
-\r
*MemoryBase = gSystemMemory[Index].Memory;\r
*MemorySize = gSystemMemory[Index].Size;\r
\r
exit (1);\r
}\r
\r
+ //\r
+ // Allocate "physical" memory space for emulator. It will be reported out later throuth MemoryAutoScan()\r
+ //\r
+ for (Index = 0, Done = FALSE; !Done; Index++) {\r
+ ASSERT (Index < gSystemMemoryCount);\r
+ gSystemMemory[Index].Size = ((UINT64)_wtoi (MemorySizeStr)) * ((UINT64)SIZE_1MB);\r
+ gSystemMemory[Index].Memory = (EFI_PHYSICAL_ADDRESS)(UINTN)VirtualAlloc (NULL, (SIZE_T)(gSystemMemory[Index].Size), MEM_COMMIT, PAGE_EXECUTE_READWRITE);\r
+ if (gSystemMemory[Index].Memory == 0) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ //\r
+ // Find the next region\r
+ //\r
+ for (Index1 = 0; MemorySizeStr[Index1] != '!' && MemorySizeStr[Index1] != 0; Index1++) {\r
+ }\r
+\r
+ if (MemorySizeStr[Index1] == 0) {\r
+ Done = TRUE;\r
+ }\r
+\r
+ MemorySizeStr = MemorySizeStr + Index1 + 1;\r
+ }\r
+\r
//\r
// Allocate space for gSystemMemory Array\r
//\r
SecPrint ("\n\r");\r
}\r
\r
- //\r
- // Calculate memory regions and store the information in the gSystemMemory\r
- // global for later use. The autosizing code will use this data to\r
- // map this memory into the SEC process memory space.\r
- //\r
- for (Index = 0, Done = FALSE; !Done; Index++) {\r
- //\r
- // Save the size of the memory and make a Unicode filename SystemMemory00, ...\r
- //\r
- gSystemMemory[Index].Size = ((UINT64)_wtoi (MemorySizeStr)) * ((UINT64)SIZE_1MB);\r
-\r
- //\r
- // Find the next region\r
- //\r
- for (Index1 = 0; MemorySizeStr[Index1] != '!' && MemorySizeStr[Index1] != 0; Index1++) {\r
- }\r
-\r
- if (MemorySizeStr[Index1] == 0) {\r
- Done = TRUE;\r
- }\r
-\r
- MemorySizeStr = MemorySizeStr + Index1 + 1;\r
- }\r
-\r
- SecPrint ("\n\r");\r
-\r
//\r
// Hand off to SEC Core\r
//\r