VirtualBox

Changeset 5353 in vbox for trunk/src/VBox/Devices/PC


Ignore:
Timestamp:
Oct 17, 2007 1:36:00 PM (17 years ago)
Author:
vboxsync
Message:

Reinstated and refined boot sector validity check so that it recognizes
a bad boot sector after failed XP install.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS/rombios.c

    r5263 r5353  
    69056905  write_byte(0x40,0x40, BX_FLOPPY_ON_CNT);
    69066906
     6907#ifdef VBOX
     6908  // program data rate
     6909  val8 = read_byte(0x0040, 0x008b);
     6910  val8 >>= 6;
     6911  outb(0x03f7, val8);
     6912#endif
     6913
    69076914  // wait for drive readiness
    69086915  do {
     
    79777984  Bit8u  bootlan;
    79787985#endif /* VBOX */
    7979 #ifndef VBOX
    79807986  Bit8u  bootchk;
    7981 #endif /* !VBOX */
    79827987  Bit16u bootseg;
    79837988  Bit16u status;
     
    81828187  // have a 55AAh signature. UNIX boot floppies typically have no such
    81838188  // signature. In general, it is impossible to tell a valid bootsector
    8184   // from an invalid one; some heuristic would be needed - a JMP instruction
    8185   // in one of the first few bytes, absence of long sequences of identical
    8186   // bytes at the start or beginning or boot sector etc.
    8187   // The risk of attempting to boot an invalid floppy is low, certainly
    8188   // lower than the risk of refusing to boot a valid floppy.
    8189 #else /* !VBOX */
     8189  // from an invalid one.
     8190  // NB: It is somewhat common for failed OS installs to have the
     8191  // 0x55AA signature and a valid partition table but zeros in the
     8192  // rest of the boot sector. We do a quick check by comparing the first
     8193  // two words of boot sector; if identical, the boot sector is
     8194  // extremely unlikely to be valid.
     8195#endif
    81908196  // check signature if instructed by cmos reg 0x38, only for floppy
    81918197  // bootchk = 1 : signature check disabled
    81928198  // bootchk = 0 : signature check enabled
    81938199  if (bootdrv != 0) bootchk = 0;
     8200#ifdef VBOX
     8201  else bootchk = 1; /* disable 0x55AA signature check on drive A: */
     8202#else
    81948203  else bootchk = inb_cmos(0x38) & 0x01;
     8204#endif
    81958205
    81968206#if BX_ELTORITO_BOOT
     
    82018211
    82028212  if (bootchk == 0) {
    8203     if (read_word(bootseg,0x1fe) != 0xaa55) {
     8213    if (read_word(bootseg,0x1fe) != 0xaa55 ||
     8214        read_word(bootseg,0) == read_word(bootseg,2)) {
    82048215#ifdef VBOX
    82058216      print_boot_failure(bootcd, bootlan, bootdrv, 0, lastdrive);
     
    82108221      }
    82118222    }
    8212 #endif /* !VBOX */
    82138223
    82148224#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