# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1302013752 -3600
# Node ID 2da3ecf0587edd56d37bd6d81b50906c92f1b47c
# Parent 007f810ee29857cc08c5ee8b82941119bc381130
tools: hvmloader: abort build if BIOS is too big
No good can come of only copy part of the BIOS into place, so lets
cause the build to break if the BIOS is too large rather than simply
truncating it.
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
diff -r 007f810ee298 -r 2da3ecf0587e tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c Tue Apr 05 15:29:12 2011 +0100
+++ b/tools/firmware/hvmloader/hvmloader.c Tue Apr 05 15:29:12 2011 +0100
@@ -702,7 +702,7 @@ static void build_e820_table(void)
int main(void)
{
int option_rom_sz = 0, vgabios_sz = 0, etherboot_sz = 0;
- int rombios_sz, smbios_sz;
+ int smbios_sz;
uint32_t etherboot_phys_addr, option_rom_phys_addr, bios32_addr;
struct bios_info *bios_info;
@@ -726,10 +726,8 @@ int main(void)
SMBIOS_MAXIMUM_SIZE);
printf("Loading ROMBIOS ...\n");
- rombios_sz = sizeof(rombios);
- if ( rombios_sz > 0x10000 )
- rombios_sz = 0x10000;
- memcpy((void *)ROMBIOS_PHYSICAL_ADDRESS, rombios, rombios_sz);
+ BUILD_BUG_ON(sizeof(rombios) > ROMBIOS_MAXIMUM_SIZE);
+ memcpy((void *)ROMBIOS_PHYSICAL_ADDRESS, rombios, sizeof(rombios));
bios32_addr = highbios_setup();
if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode )
@@ -804,10 +802,9 @@ int main(void)
printf(" %05x-%05x: SMBIOS tables\n",
SMBIOS_PHYSICAL_ADDRESS,
SMBIOS_PHYSICAL_ADDRESS + smbios_sz - 1);
- if ( rombios_sz )
- printf(" %05x-%05x: Main BIOS\n",
- ROMBIOS_PHYSICAL_ADDRESS,
- ROMBIOS_PHYSICAL_ADDRESS + rombios_sz - 1);
+ printf(" %05x-%05x: Main BIOS\n",
+ ROMBIOS_PHYSICAL_ADDRESS,
+ ROMBIOS_PHYSICAL_ADDRESS + sizeof(rombios) - 1);
build_e820_table();
dump_e820_table();
diff -r 007f810ee298 -r 2da3ecf0587e tools/firmware/rombios/config.h
--- a/tools/firmware/rombios/config.h Tue Apr 05 15:29:12 2011 +0100
+++ b/tools/firmware/rombios/config.h Tue Apr 05 15:29:12 2011 +0100
@@ -15,6 +15,8 @@
#define SMBIOS_MAXIMUM_SIZE 0x00005000
#define ROMBIOS_PHYSICAL_ADDRESS 0x000F0000
+#define ROMBIOS_MAXIMUM_SIZE (0x00100000 - ROMBIOS_PHYSICAL_ADDRESS)
+
/* Offsets from E820_PHYSICAL_ADDRESS. */
#define E820_NR_OFFSET 0x0
#define E820_OFFSET 0x8
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|