Changeset 101438 in vbox for trunk/src/VBox/Devices/EFI/Firmware/ArmPlatformPkg
- Timestamp:
- Oct 13, 2023 12:46:05 PM (17 months ago)
- svn:sync-xref-src-repo-rev:
- 159497
- Location:
- trunk/src/VBox/Devices/EFI/Firmware/ArmPlatformPkg/PrePeiCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware/ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S
r99464 r101438 39 39 bl ASM_PFX(ArmPlatformIsPrimaryCore) 40 40 41 #ifndef VBOX 41 42 // Get the top of the primary stacks (and the base of the secondary stacks) 42 43 MOV64 (x1, FixedPcdGet64(PcdCPUCoresStackBase) + FixedPcdGet32(PcdCPUCorePrimaryStackSize)) 44 #else 45 // 46 // The VirtualBox platform has the following layout: 47 // 48 // 0 128MiB RAM size + 128MiB -64KiB Max phys address 49 // +----------+------------------------+-----------------------------+-------------+---------+----------+---------+-----------+------------+ 50 // | UEFI | | | | | | Misc | FDT/ACPI | VBox | 51 // | firmware | RAM ..... => | Not assigned address space | <= PCI MMIO | PCI PIO | PCI ECAM | MMIO | table | Descriptor | 52 // | region | | | | | | region | region | region | 53 // +----------+------------------------+-----------------------------+-------------+---------+----------+---------+-----------+------------+ 54 // 55 // In order to have as few as hardcoded addresses as possible in the firmware 56 // VirtualBox installs a descriptor at the end of the physical address space 57 // where all the other information is stored. 58 // 59 // First the start of the region is determined by reading the size of the 60 // physical address space. From there the memory and stack is set up and 61 // the C entry point is called. 62 // 63 // Note: Only the VBox descriptor and UEFI firmware region are at a fixed location. 64 // Everything else can float around freely in theory to give us the most flexibility. 65 // 66 67 // Save the result from ArmPlatformIsPrimaryCore(). 68 mov x6, x0 69 70 // Get the number of physical address bits 71 bl ASM_PFX(ArmGetPhysicalAddressBits) 72 73 // 74 // Determine the start of the VBox descriptor region. 75 // 76 mov x1, #1 77 lsl x1, x1, x0 // Determine first invalid address 78 sub x1, x1, #65536 // Get at start of VBox descriptor region. 79 80 // 81 // Get at the ram base and use the beginning as our temporary stack. 82 // 83 ldr x1, [x1, #16] 84 85 // Get the top of the primary stacks (and the base of the secondary stacks) 86 add x1, x1, FixedPcdGet32(PcdCPUCorePrimaryStackSize) 87 88 // Restore the result from ArmPlatformIsPrimaryCore(). 89 mov x0, x6 90 #endif 43 91 44 92 // x0 is equal to 1 if I am the primary core … … 82 130 _SetupPrimaryCoreStack: 83 131 mov sp, x1 132 #ifndef VBOX 84 133 MOV64 (x8, FixedPcdGet64 (PcdCPUCoresStackBase)) 134 #else 135 sub x8, x1, FixedPcdGet32(PcdCPUCorePrimaryStackSize) 136 #endif 85 137 MOV64 (x9, FixedPcdGet32 (PcdInitValueInTempStack) |\ 86 138 FixedPcdGet32 (PcdInitValueInTempStack) << 32) -
trunk/src/VBox/Devices/EFI/Firmware/ArmPlatformPkg/PrePeiCore/MainUniCore.c
r99464 r101438 8 8 9 9 #include "PrePeiCore.h" 10 11 #ifdef VBOX 12 # include <Library/VBoxArmPlatformLib.h> 13 #endif 10 14 11 15 VOID … … 35 39 // the base of the primary core stack 36 40 PpiListSize = ALIGN_VALUE (PpiListSize, CPU_STACK_ALIGNMENT); 41 #ifndef VBOX 37 42 TemporaryRamBase = (UINTN)PcdGet64 (PcdCPUCoresStackBase) + PpiListSize; 43 #else 44 TemporaryRamBase = (UINTN)VBoxArmPlatformRamBaseStartGetPhysAddr() + PpiListSize; 45 #endif 38 46 TemporaryRamSize = (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - PpiListSize; 39 47 -
trunk/src/VBox/Devices/EFI/Firmware/ArmPlatformPkg/PrePeiCore/PrePeiCore.c
r99464 r101438 14 14 #include <Library/PrintLib.h> 15 15 #include <Library/SerialPortLib.h> 16 17 #ifdef VBOX 18 # include <Library/VBoxArmPlatformLib.h> 19 #endif 16 20 17 21 #include "PrePeiCore.h" … … 43 47 44 48 // Copy the Common and Platform PPis in Temporary Memory 49 #ifndef VBOX 45 50 ListBase = PcdGet64 (PcdCPUCoresStackBase); 51 #else 52 ListBase = (UINTN)VBoxArmPlatformRamBaseStartGetPhysAddr(); 53 #endif 46 54 CopyMem ((VOID *)ListBase, gCommonPpiTable, sizeof (gCommonPpiTable)); 47 55 CopyMem ((VOID *)(ListBase + sizeof (gCommonPpiTable)), PlatformPpiList, PlatformPpiListSize); … … 94 102 ArmEnableInstructionCache (); 95 103 104 #ifndef VBOX 96 105 InvalidateDataCacheRange ( 97 106 (VOID *)(UINTN)PcdGet64 (PcdCPUCoresStackBase), 98 107 PcdGet32 (PcdCPUCorePrimaryStackSize) 99 108 ); 109 #else 110 InvalidateDataCacheRange ( 111 (VOID *)(UINTN)VBoxArmPlatformRamBaseStartGetPhysAddr(), 112 PcdGet32 (PcdCPUCorePrimaryStackSize) 113 ); 114 #endif 100 115 } 101 116 -
trunk/src/VBox/Devices/EFI/Firmware/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
r99464 r101438 38 38 ArmPkg/ArmPkg.dec 39 39 ArmPlatformPkg/ArmPlatformPkg.dec 40 VBoxPkg/VBoxPkg.dec # VBox: Added 40 41 41 42 [LibraryClasses] … … 49 50 PrintLib 50 51 SerialPortLib 52 VBoxArmPlatformLib # VBox: Added 51 53 52 54 [Ppis]
Note:
See TracChangeset
for help on using the changeset viewer.