Relocate edk2 to high memory before boot

This may allow Linux to boot more easily?
This commit is contained in:
Zhuowei Zhang 2019-02-25 14:16:55 -08:00
parent 372e6ee8ec
commit b923cb5bdf
3 changed files with 26 additions and 1 deletions

View File

@ -18,7 +18,30 @@
.align 3 .align 3
ASM_FUNC(ArmPlatformPeiBootAction) ASM_FUNC(ArmPlatformPeiBootAction)
startlabel:
// check if we're located at expected location
adr x4, .
ldr x5, =ArmPlatformPeiBootAction
cmp x4, x5
bne docopy
ret ret
docopy:
// find our start address by getting our expected offset, then subtracting it from our actual address
ldr x6, =FixedPcdGet64 (PcdFdBaseAddress)
sub x5, x5, x6 // x5 now holds offset of ArmPlatformPeiBootAction from start of FD base
sub x4, x4, x5 // x4 now holds address of actual FD base
// tweak the return address
sub lr, lr, x4
add lr, lr, x6
ldr x5, =FixedPcdGet64 (PcdFdSize)
// crap memcpy
loop:
ldp x2, x3, [x4], #16
stp x2, x3, [x6], #16
subs x5, x5, #16
b.ne loop
ret
.ltorg
//UINTN //UINTN
//ArmPlatformIsPrimaryCore ( //ArmPlatformIsPrimaryCore (

View File

@ -42,3 +42,5 @@
gArmTokenSpaceGuid.PcdArmPrimaryCoreMask gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
gArmTokenSpaceGuid.PcdSystemMemoryBase gArmTokenSpaceGuid.PcdSystemMemoryBase
gArmTokenSpaceGuid.PcdSystemMemorySize gArmTokenSpaceGuid.PcdSystemMemorySize
gArmTokenSpaceGuid.PcdFdBaseAddress
gArmTokenSpaceGuid.PcdFdSize

View File

@ -25,7 +25,7 @@
################################################################################ ################################################################################
[FD.PIXEL3XL_UEFI] [FD.PIXEL3XL_UEFI]
BaseAddress = 0x80080000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in NOR Flash. BaseAddress = 0xd0000000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in NOR Flash.
Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
ErasePolarity = 1 ErasePolarity = 1