WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 07 of 11] tools: hvmloader: abort build if BIOS is to

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 07 of 11] tools: hvmloader: abort build if BIOS is too big
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Tue, 05 Apr 2011 16:46:32 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Tue, 05 Apr 2011 08:54:22 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1302018385@xxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1302018385@xxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.4
# 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

<Prev in Thread] Current Thread [Next in Thread>