X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=ArmPlatformPkg%2FPrePi%2FAArch64%2FModuleEntryPoint.S;h=2069161b957dd2b52ccc749cc1c63e9c8045c675;hp=2c4a7e5324e97b17a17262404ac39cf01fb05fb7;hb=0bcf71c13c8ce9ad254da901420badb74420a6df;hpb=5dbacdb21b59748e885c2eccae370b81271ab795 diff --git a/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S b/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S index 2c4a7e5324..2069161b95 100644 --- a/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S +++ b/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S @@ -12,24 +12,8 @@ // #include -#include -#include -#include -.text -.align 3 - -GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore) -GCC_ASM_IMPORT(ArmReadMpidr) -GCC_ASM_IMPORT(ArmPlatformPeiBootAction) -GCC_ASM_IMPORT(ArmPlatformStackSet) -GCC_ASM_EXPORT(_ModuleEntryPoint) -GCC_ASM_EXPORT(mSystemMemoryEnd) - -StartupAddr: .8byte ASM_PFX(CEntryPoint) -mSystemMemoryEnd: .8byte 0 - -ASM_PFX(_ModuleEntryPoint): +ASM_FUNC(_ModuleEntryPoint) // Do early platform specific actions bl ASM_PFX(ArmPlatformPeiBootAction) @@ -45,29 +29,17 @@ _SetSVCMode: _SystemMemoryEndInit: ldr x1, mSystemMemoryEnd - // Is mSystemMemoryEnd initialized? - cmp x1, #0 - bne _SetupStackPosition - - LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryBase), x1) - LoadConstantToReg (FixedPcdGet32(PcdSystemMemorySize), x2) - sub x2, x2, #1 - add x1, x1, x2 - // Update the global variable - adr x2, mSystemMemoryEnd - str x1, [x2] - _SetupStackPosition: // r1 = SystemMemoryTop // Calculate Top of the Firmware Device - LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), x2) - LoadConstantToReg (FixedPcdGet32(PcdFdSize), x3) + MOV64 (x2, FixedPcdGet64(PcdFdBaseAddress)) + MOV32 (x3, FixedPcdGet32(PcdFdSize) - 1) sub x3, x3, #1 add x3, x3, x2 // x3 = FdTop = PcdFdBaseAddress + PcdFdSize // UEFI Memory Size (stacks are allocated in this region) - LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), x4) + MOV32 (x4, FixedPcdGet32(PcdSystemMemoryUefiRegionSize)) // // Reserve the memory for the UEFI region (contain stacks on its top) @@ -98,9 +70,7 @@ _SetupAlignedStack: _SetupOverflowStack: // Case memory at the top of the address space. Ensure the top of the stack is EFI_PAGE_SIZE // aligned (4KB) - LoadConstantToReg (EFI_PAGE_MASK, x11) - and x11, x11, x1 - sub x1, x1, x11 + and x1, x1, ~EFI_PAGE_MASK _GetBaseUefiMemory: // Calculate the Base of the UEFI Memory @@ -109,22 +79,19 @@ _GetBaseUefiMemory: _GetStackBase: // r1 = The top of the Mpcore Stacks // Stack for the primary core = PrimaryCoreStack - LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2) + MOV32 (x2, FixedPcdGet32(PcdCPUCorePrimaryStackSize)) sub x12, x1, x2 // Stack for the secondary core = Number of Cores - 1 - LoadConstantToReg (FixedPcdGet32(PcdCoreCount), x0) - sub x0, x0, #1 - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x1) - mul x1, x1, x0 + MOV32 (x1, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreSecondaryStackSize)) sub x12, x12, x1 // x12 = The base of the MpCore Stacks (primary stack & secondary stacks) mov x0, x12 mov x1, x10 //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize) - LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2) - LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x3) + MOV32 (x2, FixedPcdGet32(PcdCPUCorePrimaryStackSize)) + MOV32 (x3, FixedPcdGet32(PcdCPUCoreSecondaryStackSize)) bl ASM_PFX(ArmPlatformStackSet) // Is it the Primary Core ? @@ -133,26 +100,22 @@ _GetStackBase: cmp x0, #1 bne _PrepareArguments -_ReserveGlobalVariable: - LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), x0) - // InitializePrimaryStack($GlobalVariableSize, $Tmp1, $Tmp2) - InitializePrimaryStack(x0, x1, x2) - _PrepareArguments: mov x0, x10 mov x1, x11 mov x2, x12 - mov x3, sp // Move sec startup address into a data register // Ensure we're jumping to FV version of the code (not boot remapped alias) - ldr x4, StartupAddr + ldr x4, =ASM_PFX(CEntryPoint) + + // Set the frame pointer to NULL so any backtraces terminate here + mov x29, xzr // Jump to PrePiCore C code // x0 = MpId // x1 = UefiMemoryBase // x2 = StacksBase - // x3 = GlobalVariableBase blr x4 _NeverReturn: