]> xenbits.xensource.com Git - seabios.git/commitdiff
Make sure to clear global variables before use.
authorKevin O'Connor <kevin@koconnor.net>
Fri, 6 Feb 2009 00:51:12 +0000 (19:51 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Fri, 6 Feb 2009 00:51:12 +0000 (19:51 -0500)
On reset, the global variables may not be zero - so zero them explicitly.

src/ata.c
src/coreboot.c
src/post.c

index 17bfda04caa355652b8710db9c1e2c8d788bd3a9..cab1eda7cdb869c283d32e6e2dce7fee86b0f559 100644 (file)
--- a/src/ata.c
+++ b/src/ata.c
@@ -861,6 +861,8 @@ ata_detect()
 static void
 ata_init()
 {
+    memset(&ATA, 0, sizeof(ATA));
+
     // hdidmap and cdidmap init.
     u8 device;
     for (device=0; device < CONFIG_MAX_ATA_DEVICES; device++) {
index 051cd80538b753f8c2af973cdb5a520ba74b2462..99bf57000a8ce11b4d73fd1284db3e0ed90c8c5f 100644 (file)
@@ -192,6 +192,12 @@ void
 coreboot_fill_map()
 {
     dprintf(3, "Attempting to find coreboot table\n");
+
+    // Init variables set in coreboot table memory scan.
+    PirOffset = 0;
+    RsdpAddr = 0;
+
+    // Find coreboot table.
     struct cb_header *cbh = find_cb_header(0, 0x1000);
     if (!cbh)
         goto fail;
index 8ae5fcc0f6c91de68cd5ed24809b1f9e92a09c84..5f3cfaadc74056eedf66282806723b5080fb5c91 100644 (file)
@@ -156,6 +156,8 @@ init_boot_vectors()
         return;
     dprintf(3, "init boot device ordering\n");
 
+    memset(&IPL, 0, sizeof(IPL));
+
     // Floppy drive
     struct ipl_entry_s *ip = &IPL.table[0];
     ip->type = IPL_TYPE_FLOPPY;