> + AllocSize = EFI_PAGES_TO_SIZE ( > + EFI_SIZE_TO_PAGES ( > + CpuMpData->CpuCount * AP_SAFE_STACK_SIZE + ApLoopFuncSize > + ) > + ); > + Status = gBS->AllocatePages ( > + AllocateMaxAddress, > + EfiReservedMemoryType, > + EFI_SIZE_TO_PAGES (AllocSize), > + &Address > + );
Hmm? You convert size to pages, pages to size, size to pages again. Also you don't want stack and code being on the same page, so I guess the logic you actually need is this: StackPages = EFI_SIZE_TO_PAGES(CpuMpData->CpuCount * AP_SAFE_STACK_SIZE); FuncPages = EFI_SIZE_TO_PAGES(ApLoopFuncSize) gBS->AllocatePages(..., StackPages + FuncPages, ...); > +// > +// Union holds the relocate APs loop entries for different cases > +// > +typedef union { > + VOID *Data; > + ASM_RELOCATE_AP_LOOP_AMD64 Amd64Entry; // 64-bit AMD Processor > + ASM_RELOCATE_AP_LOOP GenericEntry; // Intel Processor (32-bit or > 64-bit), or 32-bit AMD Processor > +} RELOCATE_AP_LOOP_ENTRY; I'm sure I've mentioned this before. The special case you have to handle is not running on a AMD Processor, but AmdSev being active (i.e. UseSevEsAPMethod == True). Otherwise it should be just standard Ia32 and X64, there should be no need to check whenever you are running on a AMD processor. take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#99795): https://edk2.groups.io/g/devel/message/99795 Mute This Topic: https://groups.io/mt/96807120/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-