Changeset 101319 in vbox
- Timestamp:
- Sep 29, 2023 3:25:06 PM (18 months ago)
- svn:sync-xref-src-repo-rev:
- 159319
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/boot.c
r98103 r101319 178 178 } 179 179 180 181 #define BOOT_CHK_WORDS 8 182 183 /* Check if the first n words of a boot sector 184 * are identical. Only consider the boot sector 185 * valid if they're not. 186 */ 187 static int valid_bootsect(uint16_t __far *boot) 188 { 189 int i; 190 uint16_t word1; 191 192 word1 = boot[0]; 193 for (i = 1; i < BOOT_CHK_WORDS; ++i) { 194 if (word1 != boot[i]) 195 break; 196 } 197 198 return i != BOOT_CHK_WORDS; 199 } 200 180 201 // returns bootsegment in ax, drive in bl 181 202 uint32_t BIOSCALL int19_function(uint8_t bseqnr) … … 334 355 // NB: It is somewhat common for failed OS installs to have the 335 356 // 0x55AA signature and a valid partition table but zeros in the 336 // rest of the boot sector. We do a quick check by comparing the first 337 // and third word of boot sector; if identical, the boot sector is 338 // extremely unlikely to be valid. 357 // rest of the boot sector. We check the first few words; if identical, 358 // the boot sector is extremely unlikely to be valid. 339 359 if (bootdrv != 0) bootchk = 0; 340 360 else bootchk = 1; /* disable 0x55AA signature check on drive A: */ … … 346 366 #endif // BX_ELTORITO_BOOT 347 367 348 if ( read_word(bootseg,0) == read_word(bootseg,4)368 if (!valid_bootsect(MK_FP(bootseg,0)) 349 369 || (bootchk == 0 && read_word(bootseg,0x1fe) != 0xaa55)) 350 370 {
Note:
See TracChangeset
for help on using the changeset viewer.