Changeset 152
- Timestamp:
- Apr 8, 2017, 12:27:55 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bootcode/regular/driveio.asm
r151 r152 382 382 383 383 IFDEF AUX_DEBUG 384 IF 1384 IF 0 385 385 DBG_TEXT_OUT_AUX 'DriveIO_LoadLVMSector:' 386 386 PUSHRF … … 414 414 mov cx, wptr cs:[CurPartition_Location+6] ; BIOS cyl & sec 415 415 416 ; Do the actual loading. 417 ; This is in a separate function so that LVM records can also be 418 ; loaded using the MBR/EBR LBA addresses from IPT entries. 419 call DriveIO_LoadLVMSectorXBR 420 jc DIOLLVMS_NoLVMSector 421 422 ; We're done, indicate success and return 423 clc 424 jmp DIOLLVMS_Done 425 426 DIOLLVMS_NoLVMSector: 427 428 ; Clear the sector buffer 429 mov si, offset [LVMSector] 430 call ClearSectorBuffer 431 mov bptr [si+LocLVM_SignatureStart], 0 432 433 ; Indicate no valid LVM sector was loaded 434 stc 435 436 DIOLLVMS_Done: 437 438 ret 439 DriveIO_LoadLVMSector EndP 440 441 442 443 444 445 ;------------------------------------------------------------------------------ 446 ; Attempts to load the corresponding LVM sector for a partition 447 ;------------------------------------------------------------------------------ 448 ; IN : AX - LBA lo of MBR or EBR 449 ; : BX - LBA hi of MBR or EBR 450 ; ; DL - BIOS disk number 451 ; ; SI - Pointer to sector buffer (usually [LVMSec]) 452 ; OUT : CF=0 - A valid LVM sector was loaded 453 ; NOTE : LocIPT_AbsolutePartTable and LocIPT_Drive can provide LBA and DISK 454 ;------------------------------------------------------------------------------ 455 DriveIO_LoadLVMSectorXBR Proc Near 456 457 IFDEF AUX_DEBUG 458 IF 1 459 DBG_TEXT_OUT_AUX 'DriveIO_LoadLVMSectorXBR:' 460 PUSHRF 461 call DEBUG_DumpRegisters 462 ;~ call AuxIO_DumpSector 463 ;~ call AuxIO_DumpParagraph 464 ;~ call AuxIO_TeletypeNL 465 POPRF 466 ENDIF 467 ENDIF 468 469 ; Save all registers 470 pusha 471 416 472 ; Calculate the entry in the DISKINFO array for this disk, 417 473 ; and put the LVM_SPT in DI … … 423 479 ; If the LVM_SPT is ZERO, no LVM info is present and we quit with CY 424 480 test di, di ; See if it is 0 425 jz D IOLLVMS_NoLVMSector; Quit if so481 jz DriveIO_LoadLVMSectorXBR_no_lvm ; Quit if so 426 482 427 483 ; Adjust the location to point to the LVM sector … … 431 487 sbb bx, 0 ; Propagate borrow to LBA hi 432 488 433 ; Load the LVM sector into [LVMSector] 434 mov si, offset [LVMSector] ; Points to sector buffer 489 ; Load the LVM sector into sector buffer pointed to by SI 435 490 mov di, ds ; Segment of that buffer 436 491 call DriveIO_ReadSectorLBA ; Read the LVM sector … … 441 496 PUSHRF 442 497 call DEBUG_DumpRegisters 443 call AuxIO_DumpSector 498 ;~ call AuxIO_DumpSector 499 mov cx, 3 500 @@: 501 call AuxIO_DumpParagraph 502 call AuxIO_TeletypeNL 503 add si, 16 504 loop @B 444 505 ;~ call AuxIO_DumpParagraph 445 506 ;~ call AuxIO_TeletypeNL … … 448 509 ENDIF 449 510 450 jc D IOLLVMS_NoLVMSector; Quit on error511 jc DriveIO_LoadLVMSectorXBR_no_lvm ; Quit on error 451 512 452 513 ; Check the validity of the LVM sector, quit with CY if invalid 453 514 call LVM_ValidateSector ; Check signature and CRC 454 jnc D IOLLVMS_NoLVMSector; Quit if not valid515 jnc DriveIO_LoadLVMSectorXBR_no_lvm ; Quit if not valid 455 516 456 517 ; We're done, indicate success and return 457 518 clc 458 jmp DIOLLVMS_Done 459 460 DIOLLVMS_NoLVMSector: 461 462 ; Clear the sector buffer 463 mov si, offset [LVMSector] 464 call ClearSectorBuffer 465 mov bptr [si+LocLVM_SignatureStart], 0 466 519 jmp DriveIO_LoadLVMSectorXBR_done 520 521 DriveIO_LoadLVMSectorXBR_no_lvm: 467 522 ; Indicate no valid LVM sector was loaded 468 523 stc 469 524 470 DIOLLVMS_Done: 471 472 ret 473 DriveIO_LoadLVMSector EndP 474 525 DriveIO_LoadLVMSectorXBR_done: 526 ; Restore all registers 527 popa 528 529 ret 530 DriveIO_LoadLVMSectorXBR EndP 475 531 476 532 … … 501 557 502 558 IFDEF AUX_DEBUG 503 IF 1559 IF 0 504 560 DBG_TEXT_OUT_AUX 'DriveIO_SaveLVMSector:' 505 561 PUSHRF … … 513 569 ; Quit with CY if LVM is ignored in SETUP 514 570 test byte ptr [CFG_IgnoreLVM], 1 ; ZF=0 means ignore LVM 515 jnz DIOSLVMS_SevereError ; Quit if so 516 517 ; Check the validity of the LVM sector, quit with CY if invalid 518 call LVM_ValidateSector ; Check signature and CRC 519 jnc DIOSLVMS_SevereError ; Quit if not valid 571 jnz DIOSLVMS_NoLVMSector ; Quit if so 520 572 521 573 ; Load the location of the current partition being acted upon. … … 532 584 mov cx, wptr cs:[CurPartition_Location+6] ; BIOS cyl & sec 533 585 586 ; Do the actual saving. 587 ; This is in a separate function so that LVM records can also be 588 ; saved using the MBR/EBR LBA addresses from IPT entries. 589 call DriveIO_SaveLVMSectorXBR 590 jc DIOSLVMS_NoLVMSector 591 592 ; We're done, indicate success and return 593 clc 594 jmp DIOSLVMS_Done 595 596 DIOSLVMS_NoLVMSector: 597 ; Indicate no valid LVM sector was saved 598 stc 599 600 DIOSLVMS_Done: 601 ret 602 DriveIO_SaveLVMSector EndP 603 604 605 ;------------------------------------------------------------------------------ 606 ; Attempts to save the corresponding LVM sector for a partition 607 ;------------------------------------------------------------------------------ 608 ; IN : AX - LBA lo of MBR or EBR 609 ; : BX - LBA hi of MBR or EBR 610 ; ; DL - BIOS disk number 611 ; ; SI - Pointer to sector buffer (usually [LVMSec]) 612 ; OUT : CF=0 - A valid LVM sector was saved 613 ; NOTE : LocIPT_AbsolutePartTable and LocIPT_Drive can provide LBA and DISK 614 ;------------------------------------------------------------------------------ 615 DriveIO_SaveLVMSectorXBR Proc Near 616 617 ; Save all registers 618 pusha 619 620 ; Check the validity of the LVM sector, quit with CY if invalid 621 push ax ; Save LBA lo 622 call LVM_ValidateSector ; Check signature and CRC 623 pop ax ; Restore LBA lo 624 jnc DriveIO_SaveLVMSectorXBR_no_lvm ; Quit if not valid 625 534 626 ; Calculate the entry in the DISKINFO array for this disk, 535 627 ; and put the LVM_SPT in DI … … 541 633 ; If the LVM_SPT is ZERO, no LVM info is present and we quit with CY 542 634 test di, di ; See if it is 0 543 jz D IOSLVMS_SevereError; Quit if so635 jz DriveIO_SaveLVMSectorXBR_no_lvm ; Quit if so 544 636 545 637 ; Adjust the location to point to the LVM sector … … 549 641 sbb bx, 0 ; Propagate borrow to LBA hi 550 642 643 ; Save the LVM sector pointed to by SI 644 mov di, ds ; Segment of that buffer 645 call DriveIO_WriteSectorLBA ; Read the LVM sector 646 551 647 IFDEF AUX_DEBUG 552 648 IF 1 … … 561 657 ENDIF 562 658 563 ; Save the LVM sector pointed to by SI 564 mov di, ds ; Segment of that buffer 565 call DriveIO_WriteSectorLBA ; Read the LVM sector 566 clc 567 jc DIOSLVMS_SevereError ; Quit on error 659 jc DriveIO_SaveLVMSectorXBR_no_lvm ; Quit on error 568 660 569 661 ; We're done, indicate success and return 570 662 clc 571 jmp D IOSLVMS_Done572 573 D IOSLVMS_SevereError:574 ; Indicate no valid LVM sector was saved663 jmp DriveIO_SaveLVMSectorXBR_done 664 665 DriveIO_SaveLVMSectorXBR_no_lvm: 666 ; Indicate no valid LVM sector was loaded 575 667 stc 576 668 577 DIOSLVMS_Done: 578 ret 579 DriveIO_SaveLVMSector EndP 669 DriveIO_SaveLVMSectorXBR_done: 670 ; Restore all registers 671 popa 672 673 ret 674 DriveIO_SaveLVMSectorXBR EndP 580 675 581 676
Note:
See TracChangeset
for help on using the changeset viewer.