aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2011-06-03 17:21:28 +0100
committerIan Campbell <ian.campbell@citrix.com>2011-06-03 17:21:28 +0100
commitab0e7218e783e44e31001069e7201e67d1b9e38c (patch)
treeec421ab2c444e6a90940388470032e92f91bcd43 /tools/firmware
parent4bf3ca7bdbf89882bfa887f451843192fa275461 (diff)
downloadxen-ab0e7218e783e44e31001069e7201e67d1b9e38c.tar.gz
xen-ab0e7218e783e44e31001069e7201e67d1b9e38c.tar.bz2
xen-ab0e7218e783e44e31001069e7201e67d1b9e38c.zip
hvmloader: reduce minimum allocation alignment from 1024 bytes to 16.
1024 bytes create a lot of wastage when the majority of allocations are of BIOS table data structures which are generally happy with much lower alignment. I conservatively chose 16 bytes. Most callers pass 0 for the alignment anyway, for the rombios high code allocation I kept it 1024 byte aligned since it was the only case that didn't seem obviously ok with a smaller alignment. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/firmware')
-rw-r--r--tools/firmware/hvmloader/32bitbios_support.c2
-rw-r--r--tools/firmware/hvmloader/util.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/tools/firmware/hvmloader/32bitbios_support.c b/tools/firmware/hvmloader/32bitbios_support.c
index 44e89fd636..abd17754f1 100644
--- a/tools/firmware/hvmloader/32bitbios_support.c
+++ b/tools/firmware/hvmloader/32bitbios_support.c
@@ -67,7 +67,7 @@ static uint32_t relocate_32bitbios(char *elfarray, uint32_t elfarraysize)
*/
reloc_size = reloc_off;
printf("%d bytes of ROMBIOS high-memory extensions:\n", reloc_size);
- highbiosarea = mem_alloc(reloc_size, 0);
+ highbiosarea = mem_alloc(reloc_size, 1024);
BUG_ON(highbiosarea == NULL);
printf(" Relocating to 0x%x-0x%x ... ",
(uint32_t)&highbiosarea[0],
diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index 4d80845fc7..90bd39971e 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -312,9 +312,9 @@ void *mem_alloc(uint32_t size, uint32_t align)
xen_pfn_t mfn;
uint32_t s, e;
- /* Align to at least one kilobyte. */
- if ( align < 1024 )
- align = 1024;
+ /* Align to at least 16 bytes. */
+ if ( align < 16 )
+ align = 16;
s = (reserve + align) & ~(align - 1);
e = s + size - 1;
@@ -366,9 +366,9 @@ void *scratch_alloc(uint32_t size, uint32_t align)
{
uint32_t s, e;
- /* Align to at least one kilobyte. */
- if ( align < 1024 )
- align = 1024;
+ /* Align to at least 16 bytes. */
+ if ( align < 16 )
+ align = 16;
s = (scratch_start + align - 1) & ~(align - 1);
e = s + size - 1;