• Jeffrey Lee's avatar
    Fix OS_Memory 7 for discontiguous RAM · fb127e47
    Jeffrey Lee authored
    The current OS_Memory 7 implementation uses an address range structure
    returned by HAL_PhysInfo to decide which part of the physical address
    arrangement table to overwrite with RAM information. I suspect the
    original intention was for OS_Memory to use this address range to avoid
    marking the VRAM as DRAM (HAL_PhysInfo is expected to fill in the VRAM
    itself). But by overwriting everything between the start and the end
    address, OS_Memory will also overwrite any non-RAM areas which are
    sandwiched between RAM banks, e.g. the VideoCore-owned RAM on Pi models
    with >1GB RAM. There's also the problem that the address range returned
    by the HAL is using 32bit addresses, so it won't work as-is for RAM
    located above the 4GB barrier.
    
    Fix these issues by reworking the routine so that it ignores the address
    range returned by the HAL and instead detects VRAM by checking the
    IsVRAM flag in the PhysRamTable entry. And for detecting if the ROM is
    running from RAM, instead of using the address range we can rely on the
    flag available via OS_ReadSysInfo 8 (i.e. HAL_PlatformInfo), like
    OS_Memory 8 does.
    
    Also add a simple BASIC program (Dev.PhysInfo) to allow easy checking of
    HAL & OS physical address arrangement tables.
    
    Version 6.41. Tagged as 'Kernel-6_41'
    fb127e47
MemInfo 86.7 KB