/* If ModuleName is NULL, then ASSERT(). If there is no additional space for HOB creation, then ASSERT(). */
VOID EFIAPI BuildModuleHob(IN CONST EFI_GUID *ModuleName, IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule, IN UINT64 ModuleLength, IN EFI_PHYSICAL_ADDRESS EntryPoint)
/* If ModuleName is NULL, then ASSERT(). If there is no additional space for HOB creation, then ASSERT(). */
VOID EFIAPI BuildModuleHob(IN CONST EFI_GUID *ModuleName, IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule, IN UINT64 ModuleLength, IN EFI_PHYSICAL_ADDRESS EntryPoint)
{
  EFI_HOB_MEMORY_ALLOCATION_MODULE  *Hob;
  ASSERT (
    ((MemoryAllocationModule & (EFI_PAGE_SIZE - 1)) == 0) &&
    ((ModuleLength & (EFI_PAGE_SIZE - 1)) == 0)
    );
  Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16)sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE));
  if (Hob == NULL) {
    return;
  }
  CopyGuid (&(Hob->MemoryAllocationHeader.Name), &gEfiHobMemoryAllocModuleGuid);
  Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule;
  Hob->MemoryAllocationHeader.MemoryLength      = ModuleLength;
  Hob->MemoryAllocationHeader.MemoryType        = EfiBootServicesCode;
  ZeroMem (Hob->MemoryAllocationHeader.Reserved, sizeof (Hob->MemoryAllocationHeader.Reserved));
  CopyGuid (&Hob->ModuleName, ModuleName);
  Hob->EntryPoint = EntryPoint;
}