Changeset 95387 in vbox
- Timestamp:
- Jun 27, 2022 11:47:22 AM (2 years ago)
- Location:
- trunk/src/VBox/ValidationKit/bootsectors/bs3kit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3Linker.cpp
r93115 r95387 316 316 free(paInputs); 317 317 318 /* Avoid output sizes that makes the FDC code think it's a single sided 319 floppy. The BIOS always report double sided floppies, and even if we 320 the bootsector adjust it's bMaxHeads value when getting a 20h error 321 we end up with a garbaged image (seems somewhere in the BIOS/FDC it is 322 still treated as a double sided floppy and we get half the data we want and 323 with gaps). */ 324 uint32_t cbOutput = ftell(pOutput); 325 if ( cbOutput == 512 * 8 * 40 /* 160kB 5"1/4 */ 326 || cbOutput == 512 * 9 * 40 /* 180kB 5"1/4 */) 327 { 328 static uint8_t const s_abZeroSector[512] = { 0 }; 329 if (fwrite(s_abZeroSector, sizeof(uint8_t), sizeof(s_abZeroSector), pOutput) != sizeof(s_abZeroSector)) 330 { 331 fprintf(stderr, "error: fwrite failed (padding)\n"); 332 rcExit = 1; 333 } 334 } 335 318 336 /* Finally, close the output file (can fail because of buffered data). */ 319 if (fclose( stderr) != 0)337 if (fclose(pOutput) != 0) 320 338 { 321 339 fprintf(stderr, "error: Error closing '%s'.\n", pszOutput); … … 323 341 } 324 342 325 fclose( pOutput);343 fclose(stderr); 326 344 return rcExit; 327 345 } -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-bootsector.asm
r93115 r95387 45 45 ;; Enabled load progress dots. 46 46 %define BS3KIT_BOOTSECTOR_LOAD_DOTS 47 48 ;; Halts on failure location. For debugging. 49 ;%define HLT_ON_FAILURE 1 47 50 48 51 … … 252 255 %if 0 253 256 mov al, '=' 254 call NAME(bs3PrintChrInAl)257 call bs3PrintChrInAl 255 258 %endif 256 259 … … 319 322 mov ah, 08h 320 323 int 13h 324 %ifndef HLT_ON_FAILURE 321 325 jc .failure 326 %else 327 jnc .ok_geometry_call 328 cli 329 hlt 330 .ok_geometry_call: 331 %endif 322 332 and cl, 63 ; only the sector count. 323 333 mov bMaxSector, cl … … 376 386 mov ax, 0201h ; al=1 sector; ah=read function 377 387 int 13h 388 %ifndef HLT_ON_FAILURE 378 389 jc .failure 390 %else 391 jnc .read_ok 392 cli 393 hlt 394 .read_ok: 395 %endif 379 396 380 397 ; advance to the next sector/head/cylinder. … … 442 459 443 460 cmp ah, 9 ; DMA 64KB crossing error 461 %if 0 ; This hack doesn't work. If the FDC is in single sided mode we end up with a garbled image. Probably "missing" sides. 462 je .read_one 463 464 cmp ah, 20h ; Controller error, probably because we're reading side 1 on a single sided floppy 444 465 jne .failure 466 cmp bMaxHead, 0 467 je .failure 468 cmp dh, 1 469 jne .failure 470 xor dh, dh 471 mov bMaxHead, dh 472 inc ch 473 jmp .the_load_loop 474 .read_one 475 %else 476 jne .failure 477 %endif 445 478 mov ax, 1 ; Retry reading a single sector. 446 jmp .read_again479 jmp .read_again 447 480 448 481 ; advance to the next sector/head/cylinder and address. … … 486 519 ret 487 520 521 %ifndef HLT_ON_FAILURE 488 522 ; 489 523 ; Something went wrong, display a message. 490 524 ; 491 525 .failure: 492 %if 1 ; Disable to save space for debugging. 526 %if 1 ; Disable to save space for debugging. 527 %if 1 493 528 push ax 529 %endif 494 530 495 531 ; print message … … 502 538 503 539 ; panic 540 %if 1 504 541 pop ax 505 %if 1506 542 mov al, ah 507 543 push bs3PrintHexInAl 508 %endif544 %endif 509 545 call Bs3Panic 510 546 .s_szErrMsg: 511 547 db 13, 10, 'rd err! ' 512 %else548 %else 513 549 hlt 514 550 jmp .failure 551 %endif 515 552 %endif 516 553 .s_szErrMsgEnd:
Note:
See TracChangeset
for help on using the changeset viewer.