]> git.proxmox.com Git - mirror_edk2.git/blobdiff - InOsEmuPkg/Unix/Sec/SecMain.c
InOsEmuPkg: Add an OS malloc/valloc/free based implementation of the MemoryAllocation...
[mirror_edk2.git] / InOsEmuPkg / Unix / Sec / SecMain.c
index 86554ed8d615903d51d27cd731e5424313860c11..bcf4104b1bdcb683e7393aa01000a5054bbeea0d 100644 (file)
@@ -624,6 +624,45 @@ SecUnixPeiAutoScan (
 }
 
 
+/*++
+
+Routine Description:
+ Check to see if an address range is in the EFI GCD memory map.
+ This is all of GCD for system memory passed to DXE Core. FV 
+ mapping and other device mapped into system memory are not
+ inlcuded in the check. 
+
+Arguments:
+  Index      - Which memory region to use
+  MemoryBase - Return Base address of memory region
+  MemorySize - Return size in bytes of the memory region
+
+Returns:
+  TRUE -  Address is in the EFI GCD memory map
+  FALSE - Address is NOT in memory map
+
+**/
+BOOLEAN
+EfiSystemMemoryRange (
+  IN  VOID *MemoryAddress
+  )
+{
+  UINTN                 Index;
+  EFI_PHYSICAL_ADDRESS  MemoryBase;
+  
+  MemoryBase = (EFI_PHYSICAL_ADDRESS)(UINTN)MemoryAddress;
+  for (Index = 0; Index < gSystemMemoryCount; Index++) {
+    if ((MemoryBase >= gSystemMemory[Index].Memory) &&
+        (MemoryBase < (gSystemMemory[Index].Memory + gSystemMemory[Index].Size)) ) {
+      return TRUE;
+    }
+  }
+  
+  return FALSE;
+}
+
+
 /*++
 
 Routine Description: