Author: mcayland Date: Mon Jan 13 10:46:59 2014 New Revision: 1255 URL: http://tracker.coreboot.org/trac/openbios/changeset/1255
Log: OFMEM: allocate retained memory top downwards
Not only does this match the behaviour of the other routines, but it also fixes a bug whereby the first free physical memory location was 0x0 and so page zero was being returned for use by SUNW,retain clients. Due to the way in which PCI/ISA devices are mapped in QEMU (e.g. IDE ioports) then clients could inadvertantly start writing to device registers.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Modified: trunk/openbios-devel/libopenbios/ofmem_common.c
Modified: trunk/openbios-devel/libopenbios/ofmem_common.c ============================================================================== --- trunk/openbios-devel/libopenbios/ofmem_common.c Mon Jan 13 10:46:56 2014 (r1254) +++ trunk/openbios-devel/libopenbios/ofmem_common.c Mon Jan 13 10:46:59 2014 (r1255) @@ -599,7 +599,7 @@ " align=" FMT_ucellx "\n", phys, size, align);
- retain_phys = ofmem_claim_phys_( phys, size, align, 0, get_ram_size(), 0 ); + retain_phys = ofmem_claim_phys_( phys, size, align, 0, get_ram_size(), 1 /* reverse */ );
/* Add to the retain_phys_range list */ retained->retain_phys_range[retained->numentries].next = NULL;