VirtualBox

Changeset 40754 in vbox


Ignore:
Timestamp:
Apr 3, 2012 10:59:59 AM (13 years ago)
Author:
vboxsync
Message:

BIOS: Do a basic sanity check on floppy boot sectors, too.

Location:
trunk/src/VBox/Devices/PC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS-new/boot.c

    r38699 r40754  
    297297    }
    298298   
    299     // Don't check boot sectors on floppies and don't read CMOS - byte
    300     // 0x38 in CMOS always has the low bit clear.
    301     // There is *no* requirement whatsoever for a valid boot sector to
    302     // have a 55AAh signature. UNIX boot floppies typically have no such
     299    // There is *no* requirement whatsoever for a valid floppy boot sector
     300    // to have a 55AAh signature. UNIX boot floppies typically have no such
    303301    // signature. In general, it is impossible to tell a valid bootsector
    304302    // from an invalid one.
     
    317315#endif // BX_ELTORITO_BOOT
    318316   
    319     if (bootchk == 0) {
    320         if (read_word(bootseg,0x1fe) != 0xaa55 ||
    321             read_word(bootseg,0) == read_word(bootseg,2)) {
    322             print_boot_failure(bootcd, bootlan, bootdrv, 0, lastdrive);
    323             return 0x00000000;
    324         }
     317    if (read_word(bootseg,0) == read_word(bootseg,2)
     318      || (bootchk == 0 && read_word(bootseg,0x1fe) != 0xaa55))
     319    {
     320        print_boot_failure(bootcd, bootlan, bootdrv, 0, lastdrive);
     321        return 0x00000000;
    325322    }
    326323   
  • trunk/src/VBox/Devices/PC/BIOS/rombios.c

    r40648 r40754  
    87178717
    87188718#ifdef VBOX
    8719   // Don't check boot sectors on floppies and don't read CMOS - byte
    8720   // 0x38 in CMOS always has the low bit clear.
    8721   // There is *no* requirement whatsoever for a valid boot sector to
    8722   // have a 55AAh signature. UNIX boot floppies typically have no such
     8719  // There is *no* requirement whatsoever for a valid floppy boot sector
     8720  // to have a 55AAh signature. UNIX boot floppies typically have no such
    87238721  // signature. In general, it is impossible to tell a valid bootsector
    87248722  // from an invalid one.
     
    87458743#endif // BX_ELTORITO_BOOT
    87468744
    8747   if (bootchk == 0) {
    8748     if (read_word(bootseg,0x1fe) != 0xaa55 ||
    8749         read_word(bootseg,0) == read_word(bootseg,2)) {
     8745  if (read_word(bootseg,0) == read_word(bootseg,2)
     8746    || (bootchk == 0 && read_word(bootseg,0x1fe) != 0xaa55))
     8747  {
    87508748#ifdef VBOX
    8751       print_boot_failure(bootcd, bootlan, bootdrv, 0, lastdrive);
     8749    print_boot_failure(bootcd, bootlan, bootdrv, 0, lastdrive);
    87528750#else /* !VBOX */
    8753       print_boot_failure(bootcd, bootdrv, 0, lastdrive);
     8751    print_boot_failure(bootcd, bootdrv, 0, lastdrive);
    87548752#endif /* VBOX */
    8755       return 0x00000000;
    8756       }
    8757     }
     8753    return 0x00000000;
     8754  }
    87588755
    87598756#if BX_ELTORITO_BOOT
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette