> 
> +  MaxCpusPerHob = (MAX_UINT16 - sizeof (EFI_HOB_GUID_TYPE) - sizeof
> (MP_HAND_OFF)) / sizeof (PROCESSOR_HAND_OFF);

Above formula assumes the maximum HOB length could be 0xFFFF.
But actually the maximum HOB length could be only 0xFFF8 because
PeiCore::PeiCreateHob() contains following logic:

  if (0x10000 - Length <= 0x7) {
    return EFI_INVALID_PARAMETER;
  }
  Length = (UINT16)((Length + 0x7) & (~0x7));

The if-check is to guarantee (Length + 0x7) & ~0x7 doesn't produce value 0
when the Length > 0xFFF8.

So, that means the formula should use 0xFFF8 instead of 0xFFFF (MAX_UINT16).


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115707): https://edk2.groups.io/g/devel/message/115707
Mute This Topic: https://groups.io/mt/104472313/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to