Skip to content

Commit

Permalink
Silicon/RK3588: Fix inconsistent Base System RAM length (#104)
Browse files Browse the repository at this point in the history
The Base System RAM  section nominally starts at `mSystemMemoryBase` but
computes its length as if it starts at `0`. This happens to be fine
since `mSystemMemoryBase` actually is `0`, so this doesn't cause any
real problems, but it seems inconsistent to use a symbol in one place
and an implicitly-hard-coded `0` elsewhere.

Fix is to use subtract the value of `mSystemMemoryBase` from the length.
Since `mSystemMemoryBase` is `0`, this is a no-op, but it makes the
table use consistent logic, and might avoid a future issue if this code
is ever copy-pasted somewhere that base is not 0.
  • Loading branch information
idigdoug authored Nov 23, 2023
1 parent 66d2245 commit 9529bc4
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ArmPlatformGetVirtualMemoryMap (
// Base System RAM
VirtualMemoryTable[Index].PhysicalBase = mSystemMemoryBase;
VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
VirtualMemoryTable[Index].Length = MIN (mSystemMemorySize, 0xF0000000UL);
VirtualMemoryTable[Index].Length = MIN (mSystemMemorySize, 0xF0000000UL - mSystemMemoryBase);
VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
VirtualMemoryInfo[Index].Type = RK3588_MEM_BASIC_REGION;
VirtualMemoryInfo[Index++].Name = L"System RAM";
Expand Down

0 comments on commit 9529bc4

Please sign in to comment.