Changeset 29 for trunk/BOOTCODE/REGULAR/PARTMAIN.ASM
- Timestamp:
- May 5, 2011, 2:00:00 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BOOTCODE/REGULAR/PARTMAIN.ASM
r23 r29 1 2 ; Disclaimer:3 ; =============4 ; The sourcecode is released via www.netlabs.org CVS *ONLY*.5 ; You MUST NOT upload it to other servers nor republish it in any way.6 ; The sourcecode is still COPYRIGHTED and NOT RELEASED UNDER GPL.7 ; It's (c) Copyright 1998-2003 by Martin Kiewitz.8 ; You may recompile the source and do *PRIVATE* modifications, but please keep9 ; in mind that modifying this code needs at least *some* assembly skill. If10 ; you mess up your system, because you needed to hack your way through, don't11 ; blame me. Releasing a customized version of AiR-BOOT, selling it in any form12 ; or reusing parts of this source is *PROHIBITED*. Ask me, if you have some13 ; idea about new functionality *before* developing the code, otherwise I will14 ; definitely reject it. Also please accept, that I have some basic design15 ; rules on AiR-BOOT and I will maintain them at all costs, so this won't get16 ; another GRUB.17 1 ; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz 2 ; 3 ; This file is part of AiR-BOOT 4 ; 5 ; AiR-BOOT is free software: you can redistribute it and/or modify it under 6 ; the terms of the GNU General Public License as published by the Free 7 ; Software Foundation, either version 3 of the License, or (at your option) 8 ; any later version. 9 ; 10 ; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY 11 ; WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS 12 ; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 13 ; details. 14 ; 15 ; You should have received a copy of the GNU General Public License along with 16 ; AiR-BOOT. If not, see <http://www.gnu.org/licenses/>. 17 ; 18 18 ;--------------------------------------------------------------------------- 19 19 ; AiR-BOOT / PARTiTiON REGULAR ROUTINES … … 24 24 xor bl, bl 25 25 mov dl, CFG_PartDefault 26 call PART_FixUp PartitionNumber26 call PART_FixUpSelectionNumber 27 27 mov CFG_PartDefault, dl 28 28 mov dl, CFG_PartLast 29 call PART_FixUp PartitionNumber29 call PART_FixUpSelectionNumber 30 30 mov CFG_PartLast, dl 31 31 mov dl, CFG_PartAutomatic 32 call PART_FixUp PartitionNumber32 call PART_FixUpSelectionNumber 33 33 mov CFG_PartAutomatic, dl 34 34 35 ; Fix-Up Linux Kernel Partition - If lost, search for FAT-16 36 mov bl, 06h 37 mov dl, CFG_LinuxKrnlPartition 38 call PART_FixUpPartitionNumber 39 mov CFG_LinuxKrnlPartition, dl 40 41 ; Fix-Up Linux Root Partition - If lost, search for Linux partition (83h) 42 mov bl, 83h 43 mov dl, CFG_LinuxRootPartition 44 call PART_FixUpPartitionNumber 45 mov CFG_LinuxRootPartition, dl 35 ; [Linux support removed since v1.02] 36 ; ; Fix-Up Linux Kernel Partition - If lost, search for FAT-16 37 ; mov bl, 06h 38 ; mov dl, CFG_LinuxKrnlPartition 39 ; call PART_FixUpPartitionNumber 40 ; mov CFG_LinuxKrnlPartition, dl 41 ; 42 ; ; Fix-Up Linux Root Partition - If lost, search for Linux partition (83h) 43 ; mov bl, 83h 44 ; mov dl, CFG_LinuxRootPartition 45 ; call PART_FixUpPartitionNumber 46 ; mov CFG_LinuxRootPartition, dl 46 47 ret 47 48 PART_FixUpDefaultPartitionValues EndP … … 62 63 ; BL - Requested Partition ID 63 64 ; Out: DL - New number of partition (guessed normally ;) 64 PART_FixUpPartitionNumber Proc Near Uses ax cx 65 cmp dl, 0FFh 66 je PFUPN_PartitionDisabled 65 PART_FixUpSelectionNumber Proc Near Uses ax cx 66 cmp dl, 080h 67 je PFUPN_SelectionDisabled 68 ja PFUPN_SpecialSelection 67 69 call PARTSCAN_GetXref ; DL - PartitionNo prev IPT 68 70 cmp dh, 0FFh ; DH -> Partition No in new IPT 69 je PFUPN_PartitionGone 70 PFUPN_PartitionDisabled: 71 ret 72 73 ; Partition is not referenced in New-IPT, so dig for requested partition 74 PFUPN_PartitionGone: 71 je PFUPN_SelectionGone 72 mov dl, dh 73 PFUPN_SelectionDisabled: 74 ret 75 76 PFUPN_SpecialSelection: 77 cmp dl, 0FEh ; Resume-BIOS? 78 ja PFUPN_SpecialSelectionFloppy 79 cmp CFG_ResumeBIOSbootSeq, 0 80 je PFUPN_SelectionGone 81 jmp PFUPN_Found 82 PFUPN_SpecialSelectionFloppy: 83 cmp CFG_IncludeFloppy, 0 84 je PFUPN_SelectionGone 85 jmp PFUPN_Found 86 87 ; Partition is not referenced in New-IPT or Resume-BIOS/Floppy selected, but 88 ; actual media is disabled...so dig for requested partition 89 PFUPN_SelectionGone: 75 90 mov cl, CFG_Partitions 76 91 or cl, cl … … 94 109 PFUPN_BootableSearchLoop: 95 110 call PART_GetPartitionPointer ; Gets SI for partition DL 96 mov al, cs:[si+LocIPT_Flags]111 mov al, ds:[si+LocIPT_Flags] 97 112 and al, Flags_BootAble 98 113 jnz PFUPN_Found … … 106 121 107 122 PFUPN_NothingFound: 108 mov dl, 0 FFh ; Now being Disabled123 mov dl, 080h ; Now being Disabled 109 124 PFUPN_Found: 110 125 ret 111 PART_FixUp PartitionNumber EndP126 PART_FixUpSelectionNumber EndP 112 127 113 128 ; ============================================================================ 114 ; In: CS:SI - IPT-Entry of partition115 ; ExecBaseSeg:Ptr - Actual Boot-Record of partition129 ; In: DS:SI - IPT-Entry of partition 130 ; DS:PartitionSector - Actual Boot-Record of partition 116 131 ; Out: *none* (BootRecordCRD updated) 117 132 PART_UpdateBootRecordCRC Proc Near Uses bx 118 push ds si 119 push ExecBaseSeg 120 pop ds 121 mov si, offset ExecBasePtr 122 mov bx, 4B4Dh ; Magic: 'MK' 123 call MBR_GetCheckOfSector 124 pop si ds 125 mov cs:[si+LocIPT_BootRecordCRC], bx 133 mov si, offset PartitionSector 134 mov bx, 4B4Dh ; Magic: 'MK' 135 call MBR_GetCheckOfSector 136 mov [si+LocIPT_BootRecordCRC], bx 126 137 ret 127 138 PART_UpdateBootRecordCRC EndP 139 140 ; Copies the device-name to the Resume-BIOS IPT entry 141 PART_UpdateResumeBIOSName Proc Near Uses ax bx cx si di 142 movzx bx, CFG_ResumeBIOSbootSeq 143 dec bx 144 shl bx, 1 145 mov si, wptr [ContinueBIOSbootTable+bx] 146 mov di, offset BIOScontIPTentry+LocIPT_Name 147 push di 148 mov cx, 11 149 mov al, ' ' 150 rep stosb 151 pop di 152 PURBN_BootDeviceCopyLoop: 153 lodsb 154 or al, al 155 jz PURBN_NoResumeBootSeq 156 stosb 157 jmp PURBN_BootDeviceCopyLoop 158 PURBN_NoResumeBootSeq: 159 ret 160 PART_UpdateResumeBIOSName EndP 128 161 129 162 ; ============================================================================ … … 166 199 PCMPP_NoResumeBootSeqInclude: 167 200 168 ; Now include all Linux Kernels, if any available... 169 movzx cx, LINUX_KernelNo 170 or cx, cx 171 jz PCMPP_NoLinuxKernels 172 mov ax, offset LINUX_KernelEntries 173 PCMPP_KernelLoop: 174 mov ds:[bx], ax 175 add bx, 2 176 add ax, LocIPT_LenOfIPT 177 dec cx 178 jnz PCMPP_KernelLoop 179 PCMPP_NoLinuxKernels: 201 ; [Linux support removed since v1.02] 202 ; ; Now include all Linux Kernels, if any available... 203 ; movzx cx, LINUX_KernelNo 204 ; or cx, cx 205 ; jz PCMPP_NoLinuxKernels 206 ; mov ax, offset LINUX_KernelEntries 207 ; PCMPP_KernelLoop: 208 ; mov ds:[bx], ax 209 ; add bx, 2 210 ; add ax, LocIPT_LenOfIPT 211 ; dec cx 212 ; jnz PCMPP_KernelLoop 213 ; PCMPP_NoLinuxKernels: 180 214 181 215 movzx cx, CFG_Partitions ; LocIPT_MaxPartitions … … 201 235 ; Gets a pointer to the given partition 202 236 ; In: DL - Number of partition 203 ; Out: SI - Pointer to it (use CS)237 ; Out: SI - Pointer to it 204 238 PART_GetPartitionPointer Proc Near Uses bx 205 239 cmp dl, 0FEh … … 208 242 movzx bx, dl 209 243 shl bx, 1 210 mov si, wptr cs:[PartitionPointers+bx]244 mov si, wptr [PartitionPointers+bx] 211 245 ret 212 246 PGPP_IsBIOSbootSeq: … … 250 284 jb PCTS_IsBIOSbootSeq 251 285 je PCTS_IsFloppy 252 cmp ax, offset LINUX_KernelEntries 253 jae PCTS_IsKernelEntry 286 ; [Linux support removed since v1.02] 287 ; cmp ax, offset LINUX_KernelEntries 288 ; jae PCTS_IsKernelEntry 254 289 sub ax, offset PartitionTable 255 290 mov bl, LocIPT_LenOfIPT … … 257 292 mov dl, al 258 293 ret 259 PCTS_IsKernelEntry: 260 mov dl, 0FDh 261 ret 294 ; [Linux support removed since v1.02] 295 ; PCTS_IsKernelEntry: 296 ; mov dl, 0FDh 297 ; ret 262 298 PCTS_IsBIOSbootSeq: 263 299 mov dl, 0FEh … … 271 307 ; Out: DL - Number of partition in filtered view 272 308 PART_ConvertFromStraight Proc Near Uses es di 309 cmp dl, 0FEh 310 jb PCFS_IsPartition 311 mov ax, offset BIOScontIPTentry 312 je PCFS_DoSearch 313 mov ax, offset FloppyIPTentry 314 jmp PCFS_DoSearch 315 PCFS_IsPartition: 273 316 ; First we get Partition-Offset in AX 274 317 movzx ax, dl … … 276 319 mul bl 277 320 add ax, offset PartitionTable 321 PCFS_DoSearch: 278 322 ; Now search for this offset in our filtered Partition-Pointer-Table 279 323 push cs … … 297 341 ; Destroyed: AX 298 342 PART_GetSizeElementPointer Proc Near Uses bx 299 cmp ax, offset LINUX_KernelEntries 300 jae PGSEP_IsKernelEntry 343 ; [Linux support removed since v1.02] 344 ; cmp ax, offset LINUX_KernelEntries 345 ; jae PGSEP_IsKernelEntry 301 346 mov si, offset PartitionSizeTable 302 347 sub ax, offset PartitionTable 303 jmp PGSEP_Continue 304 PGSEP_IsKernelEntry: 305 mov si, offset LINUX_KernelSizeTable 306 sub ax, offset LINUX_KernelEntries 307 PGSEP_Continue: 348 ; jmp PGSEP_Continue 349 ; [Linux support removed since v1.02] 350 ; PGSEP_IsKernelEntry: 351 ; mov si, offset LINUX_KernelSizeTable 352 ; sub ax, offset LINUX_KernelEntries 353 ; PGSEP_Continue: 308 354 mov bl, LocIPT_LenOfIPT 309 355 div bl ; Divide with IPTlength … … 381 427 ; install MBR Protection, if wanted 382 428 ; Special Boot Support, if needed (OS/2 Extended partitions) 429 ; Copy boot-sector to StartBase 383 430 ; run boot sector... 384 431 PART_StartPartition Proc Near Uses ax dx es di … … 389 436 call PART_ConvertToStraight ; ...we save straight view for later... 390 437 mov BootPartNo, dl 438 ; Straight - FFh -> Floppy boot 439 ; FEh -> BIOS continue (CD-ROM, ZIP, etc.) 391 440 392 441 ; We need straight pointers from now on, so calculate the table... … … 397 446 398 447 push si 399 mov dl, cs:[si+LocIPT_Drive]400 mov dh, cs:[si+LocIPT_SystemID]448 mov dl, [si+LocIPT_Drive] 449 mov dh, [si+LocIPT_SystemID] 401 450 ; Copy Partition-Name to BootingNow area for display purposes 402 451 add si, LocIPT_Name … … 411 460 mov si, offset TXT_BootingNow1 412 461 call MBR_Teletype 413 cmp dh, 0FDh 414 je PSP_IsKernel 462 ; [Linux support removed since v1.02] 463 ; cmp dh, 0FDh 464 ; je PSP_IsKernel 415 465 or dl, dl 416 466 jnz PSP_IsHarddisc … … 420 470 jmp PSP_IsFloppyCDROMetc 421 471 422 PSP_IsKernel: 423 IFDEF ReleaseCode 424 ; Save configuration on HDD boots (save CFG_LinuxLastKernel) 425 call DriveIO_SaveConfiguration 426 ENDIF 427 call MBR_Teletype ; Prints out BootingNow2 including KernelName 428 mov si, offset TXT_BootingNowKernel 429 call MBR_Teletype 430 jmp PSP_IsFloppyCDROMetc 472 ; [Linux support removed since v1.02] 473 ; PSP_IsKernel: 474 ; IFDEF ReleaseCode 475 ; ; Save configuration on HDD boots (save CFG_LinuxLastKernel) 476 ; call DriveIO_SaveConfiguration 477 ; ENDIF 478 ; call MBR_Teletype ; Prints out BootingNow2 including KernelName 479 ; mov si, offset TXT_BootingNowKernel 480 ; call MBR_Teletype 481 ; jmp PSP_IsFloppyCDROMetc 431 482 432 483 PSP_IsHarddisc: … … 440 491 pop si ; restores SI (IPT-pointer) 441 492 442 mov ax, wptr cs:[si+LocIPT_AbsolutePartTable+0]443 mov bx, wptr cs:[si+LocIPT_AbsolutePartTable+2]444 mov cx, wptr cs:[si+LocIPT_LocationPartTable+1]445 mov dh, bptr cs:[si+LocIPT_LocationPartTable+0]446 mov dl, cs:[si+LocIPT_Drive]493 mov ax, wptr [si+LocIPT_AbsolutePartTable+0] 494 mov bx, wptr [si+LocIPT_AbsolutePartTable+2] 495 mov cx, wptr [si+LocIPT_LocationPartTable+1] 496 mov dh, bptr [si+LocIPT_LocationPartTable+0] 497 mov dl, [si+LocIPT_Drive] 447 498 call DriveIO_LoadPartition ; Load Table... 448 499 ; --------------------------------------------------- MODIFY PARTITION TABLE 449 push ExecBaseSeg500 push cs 450 501 pop es 451 mov di, ExecBasePtr 452 add di, 446 ; DS:SI - Erster Partitionseintrag 502 mov di, offset PartitionSector+446 ; ES:DI - First Partitionentry 453 503 454 504 ; Remove all active-flags for safety reasons, primary partition table will … … 464 514 465 515 ; Put the partition-to-be-booted location into registers... 466 mov ax, wptr cs:[si+LocIPT_AbsoluteBegin+0]467 mov bx, wptr cs:[si+LocIPT_AbsoluteBegin+2]468 sub ax, wptr cs:[si+LocIPT_AbsolutePartTable+0]469 sbb bx, wptr cs:[si+LocIPT_AbsolutePartTable+2]516 mov ax, wptr [si+LocIPT_AbsoluteBegin+0] 517 mov bx, wptr [si+LocIPT_AbsoluteBegin+2] 518 sub ax, wptr [si+LocIPT_AbsolutePartTable+0] 519 sbb bx, wptr [si+LocIPT_AbsolutePartTable+2] 470 520 ; BX:AX - absolute position of partition relative to partition table 471 521 ; ...and search for it... … … 478 528 PSP_SearchMismatch: 479 529 add di, LocBRPT_LenOfEntry ; 16 Bytes per Partition-Entry 480 cmp di, 500+ ExecBasePtr530 cmp di, 500+offset PartitionSector 481 531 jb PSP_SearchLoop 482 532 jmp MBR_HaltSystem … … 493 543 ; If yes, set magic bytes 'I13X' at 3000:0 for boot-loader to recognize. 494 544 ; This method is (c) by IBM <g> 495 mov ax, wptr cs:[si+LocIPT_AbsoluteBegin+0]496 mov bx, wptr cs:[si+LocIPT_AbsoluteBegin+2]545 mov ax, wptr [si+LocIPT_AbsoluteBegin+0] 546 mov bx, wptr [si+LocIPT_AbsoluteBegin+2] 497 547 add ax, wptr es:[di+LocBRPT_AbsoluteLength+0] ; Add length to absolute 498 548 adc bx, wptr es:[di+LocBRPT_AbsoluteLength+2] ; begin location … … 515 565 516 566 ; now check, if we need to hide any partition 517 test byte ptr cs:[si+LocIPT_Flags], Flags_HideFeature567 test byte ptr [si+LocIPT_Flags], Flags_HideFeature 518 568 jz PSP_NoHideFeature 519 569 ; --------------------------------------------------------- PARTITION HIDING … … 532 582 mov cl, CFG_Partitions 533 583 PSP_PartitionsHideLoop: 534 mov dl, cs:[di]584 mov dl, es:[di] 535 585 inc di 536 586 cmp dl, 0FFh … … 543 593 ; So something got hidden and we have to remark a primary partition, 544 594 ; if we are booting something non-primary from 1st hdd. 545 cmp bptr ds:[si+LocIPT_Drive], 80h595 cmp bptr [si+LocIPT_Drive], 80h 546 596 ja PSP_HideAdjustPrimaryMark ; When booting any hdd, but 1st 547 mov ax, wptr ds:[si+LocIPT_AbsolutePartTable]548 mov bx, wptr ds:[si+LocIPT_AbsolutePartTable+2]597 mov ax, wptr [si+LocIPT_AbsolutePartTable] 598 mov bx, wptr [si+LocIPT_AbsolutePartTable+2] 549 599 or ax, ax 550 600 jnz PSP_HideAdjustPrimaryMark ; or booting non-primary partition … … 565 615 566 616 PSP_NoHideFeature: 617 ; Check, if we are supposed to ignore LVM altogether... 618 test [CFG_IgnoreLVM], 1 619 jnz PSP_NoLVMReassignment 620 ; --------------------------------------------------------- LVM REASSIGNMENT 621 ; Driveletter must be set for this partition 622 test byte ptr [si+LocIPT_Flags], Flags_DriveLetter 623 jz PSP_NoLVMReassignment 624 movzx bx, BootPartNo ; EntryNumber is straight view 625 mov al, bptr [DriveLetters+bx] 626 sub al, 3Dh ; Convert e.g. 80h -> 'C' 627 cmp al, bptr [PartitionVolumeLetters+bx] 628 je PSP_NoLVMReassignment ; If driveletters match -> no change 629 call LVM_DoLetterReassignment ; Give partition SI letter AL 630 PSP_NoLVMReassignment: 567 631 push si 568 632 ; ------------------------------------------------------- -"PLEASE WAIT..."- … … 584 648 ; -------------------------------------------------- SPECIAL BOOT PROCESSING 585 649 ; Check here, if the Boot shall be done via resume to BIOS... 586 mov al, bptr cs:[si+LocIPT_SystemID]650 mov al, bptr [si+LocIPT_SystemID] 587 651 cmp al, 0FEh ; Via BIOS ? (aka resume BIOS boot sequence) 588 652 je PSP_ResumeBIOSbootSeq 589 cmp al, 0FDh ; Kernel-Booting ? 590 je PSP_KernelBooting 653 ; [Linux support removed since v1.02] 654 ; cmp al, 0FDh ; Kernel-Booting ? 655 ; je PSP_KernelBooting 591 656 jmp PSP_StartNormal 592 657 … … 597 662 dw 0F000h 598 663 599 PSP_KernelBooting: 600 call LINUX_LoadKernel ; DS:SI - Entry Pointer to Kernel 601 db 0EAh ; if return to here -> Reboot 602 dw 0FFF0h 603 dw 0F000h 604 605 ; ================================================================== 606 ; FROM THIS POINT ON, ONLY *SI* REGISTER IS NEEDED TO BE PRESERVED 607 ; ================================================================== 664 ; [Linux support removed since v1.02] 665 ; PSP_KernelBooting: 666 ; call LINUX_LoadKernel ; DS:SI - Entry Pointer to Kernel 667 ; db 0EAh ; if return to here -> Reboot 668 ; dw 0FFF0h 669 ; dw 0F000h 670 671 ; ======================================================================= 672 ; FROM THIS POINT ON, ONLY DS and SI REGISTER IS NEEDED TO BE PRESERVED 673 ; ======================================================================= 608 674 609 675 PSP_StartNormal: 610 mov ax, wptr cs:[si+LocIPT_AbsoluteBegin+0]611 mov bx, wptr cs:[si+LocIPT_AbsoluteBegin+2]612 mov cx, cs:[si+LocIPT_LocationBegin+1]613 mov dh, cs:[si+LocIPT_LocationBegin+0]614 mov dl, cs:[si+LocIPT_Drive]676 mov ax, wptr [si+LocIPT_AbsoluteBegin+0] 677 mov bx, wptr [si+LocIPT_AbsoluteBegin+2] 678 mov cx, [si+LocIPT_LocationBegin+1] 679 mov dh, [si+LocIPT_LocationBegin+0] 680 mov dl, [si+LocIPT_Drive] 615 681 call DriveIO_LoadPartition ; Loads boot-sector... 616 682 617 683 test CFG_DetectVIBR, 1 618 684 jz PSP_NoVIBR 619 test byte ptr cs:[si+LocIPT_Flags], Flags_VIBR_Detection685 test byte ptr [si+LocIPT_Flags], Flags_VIBR_Detection 620 686 jz PSP_NoVIBR 621 687 ; ---------------------------------------------------------- CHECKS FOR VIBR 622 push ds si 623 push ExecBaseSeg 624 pop ds 625 mov si, offset ExecBasePtr 688 push si 689 mov si, offset PartitionSector 626 690 mov bx, 4B4Dh ; Magic: 'MK' 627 691 call MBR_GetCheckOfSector 628 pop si ds629 cmp cs:[si+LocIPT_BootRecordCRC], bx692 pop si 693 cmp [si+LocIPT_BootRecordCRC], bx 630 694 je PSP_NoVIBR 631 mov bx, cs:[si+LocIPT_BootRecordCRC]695 mov bx, [si+LocIPT_BootRecordCRC] 632 696 or bx, bx 633 697 jz PSP_NoVIBR … … 645 709 jz PSP_NoMBRprotect 646 710 ; -------------------------------------------------- INSTALLS MBR-PROTECTION 647 push si ; We needSI later...711 push ds si ; We need DS:SI later... 648 712 ; First subtract 1024 bytes from Base-Memory... 649 713 push ds … … 658 722 ; Now copy in our code (to DX:0)... 659 723 660 mov ax, cs 661 mov ds, ax 662 mov si, offset MBR_Protection ; DS:SI - Source Image 724 mov si, offset MBR_Protection ; DS:SI - Source Image 663 725 mov es, dx 664 xor di, di 726 xor di, di ; ES:DI - Destination 665 727 mov cx, 512 666 rep movsw 728 rep movsw ; Move 1024 bytes... 667 729 668 730 ; Now fill in variables... … … 671 733 mov ds, ax 672 734 mov si, 10h*4 673 xor di, di 735 xor di, di ; INT 10h Vector to MBR Protection 674 736 movsd 675 mov si, 13h*4 737 mov si, 13h*4 ; INT 13h Vector to MBR Protection 676 738 movsd 677 mov al, CFG_IgnoreWriteToMBR 739 mov al, CFG_IgnoreWriteToMBR ; Option to MBR Protection 678 740 stosb 679 741 … … 683 745 mov ax, 9 684 746 mov ds:[si], ax 685 mov ds:[si+2], dx 747 mov ds:[si+2], dx ; Vector hardcoded at DS:0009 686 748 ; MBR-Protection now active :) 687 pop si ; RestoreSI749 pop si ds ; Restore DS:SI 688 750 689 751 ; ------------------------------------------------ SPECIAL PARTITION SUPPORT 690 752 ; needed by OS/2 Warp / eComStation 691 753 PSP_NoMBRprotect: 692 cmp bptr cs:[si+LocIPT_SystemID], 08; I hate Microsuck NTFS check754 cmp bptr [si+LocIPT_SystemID], 08 ; I hate Microsuck NTFS check 693 755 je PSP_NoSpecialSupport 694 756 695 push ExecBaseSeg 696 pop es 697 mov di, ExecBasePtr ; ES:DI - Actual Boot-Record 757 mov di, offset PartitionSector ; ES:DI - Actual Boot-Record 698 758 ; Special Support Detection 699 759 mov ax, wptr es:[di+24] … … 707 767 jne PSP_NoSpecialSupport 708 768 ; Special Support needed 709 mov al, bptr cs:[si+LocIPT_Drive]769 mov al, bptr [si+LocIPT_Drive] 710 770 mov bptr es:[di+36], al ; Write Actual Drive-Letter 711 mov ax, cs:[si+LocIPT_AbsoluteBegin]771 mov ax, [si+LocIPT_AbsoluteBegin] 712 772 mov wptr es:[di+28], ax ; Fixing Hidden Sectors count 713 mov ax, cs:[si+LocIPT_AbsoluteBegin+2]773 mov ax, [si+LocIPT_AbsoluteBegin+2] 714 774 mov wptr es:[di+30], ax ; Done by OS/2 BootMan as well... 715 775 716 776 ; ------------------------------------------------ LOGICAL PARTITION SUPPORT 717 777 PSP_NoSpecialSupport: 718 test byte ptr cs:[si+LocIPT_Flags], Flags_DriveLetter778 test byte ptr [si+LocIPT_Flags], Flags_DriveLetter 719 779 jz PSP_NoLogicalSupport 720 780 721 781 movzx bx, BootPartNo ; EntryNumber is straight view 722 mov al, bptr cs:[DriveLetters+bx]782 mov al, bptr [DriveLetters+bx] 723 783 mov bptr es:[di+37], al ; Write Drive Letter (OS/2 only) 724 784 785 ; -------------------------------------------- COPY BOOT-RECORD TO STARTBASE 786 PSP_NoLogicalSupport: 787 push si 788 mov ax, StartBaseSeg 789 mov es, ax 790 mov cx, 256 791 mov si, offset PartitionSector 792 mov di, StartBasePtr 793 rep movsw 794 pop si 725 795 ; ---------------------------------------------------- NOW START BOOT-RECORD 726 PSP_NoLogicalSupport:727 796 xor ax, ax 728 797 xor bx, bx … … 732 801 xor dh, dh ; Drive supported by BIOS 733 802 mov dl, cs:[si+LocIPT_Drive] ; Drive Physical No 734 db 0EAh ; JUMP TO Entry Point...Bye Bye 735 dw ExecBasePtr 736 dw ExecBaseSeg 803 IFDEF ReleaseCode 804 db 0EAh ; JUMP TO Entry Point...Bye Bye 805 dw StartBasePtr 806 dw StartBaseSeg 807 ENDIF 737 808 PART_StartPartition EndP 738 809 … … 740 811 ; In: DL - Partition to hide 741 812 ; Destroyed: None 742 PART_HidePartition Proc Near Uses ax bx cx dx si esdi813 PART_HidePartition Proc Near Uses ax bx cx dx si di 743 814 call PART_GetPartitionPointer ; Pointer to partition (DL) -> SI 744 815 745 816 ; First load the partition table of that partition... 746 mov ax, wptr cs:[si+LocIPT_AbsolutePartTable+0]747 mov bx, wptr cs:[si+LocIPT_AbsolutePartTable+2]748 mov cx, wptr cs:[si+LocIPT_LocationPartTable+1]749 mov dh, bptr cs:[si+LocIPT_LocationPartTable+0]750 mov dl, cs:[si+LocIPT_Drive]817 mov ax, wptr [si+LocIPT_AbsolutePartTable+0] 818 mov bx, wptr [si+LocIPT_AbsolutePartTable+2] 819 mov cx, wptr [si+LocIPT_LocationPartTable+1] 820 mov dh, bptr [si+LocIPT_LocationPartTable+0] 821 mov dl, [si+LocIPT_Drive] 751 822 call DriveIO_LoadPartition 752 823 ; Partition-Table now LOADED 753 push ExecBaseSeg 754 pop es 755 mov di, ExecBasePtr 756 add di, 446 ; DS:SI - 1st partitionentry... 824 mov di, offset PartitionSector+446 ; ES:DI - 1st partitionentry... 757 825 758 826 ; Put our partition's location into registers... 759 mov ax, wptr cs:[si+LocIPT_AbsoluteBegin+0]760 mov bx, wptr cs:[si+LocIPT_AbsoluteBegin+2]761 sub ax, wptr cs:[si+LocIPT_AbsolutePartTable+0]762 sbb bx, wptr cs:[si+LocIPT_AbsolutePartTable+2]827 mov ax, wptr [si+LocIPT_AbsoluteBegin+0] 828 mov bx, wptr [si+LocIPT_AbsoluteBegin+2] 829 sub ax, wptr [si+LocIPT_AbsolutePartTable+0] 830 sbb bx, wptr [si+LocIPT_AbsolutePartTable+2] 763 831 ; BX:AX - absolute position of partition relative to partition table 764 832 ; ...and search for it... … … 771 839 PHP_SearchMismatch: 772 840 add di, LocBRPT_LenOfEntry ; 16 Bytes per partition entry 773 cmp di, 500+ ExecBasePtr841 cmp di, 500+offset PartitionSector 774 842 jb PHP_SearchLoop 775 843 jmp MBR_HaltSystem ; not found, something is wrong here … … 792 860 ; *not* the BIOS. This one *could* cause havoc to some systems, but I can't 793 861 ; do anything else. 794 ; =In this routine DS may not be equal CS= 795 PART_MarkFirstGoodPrimary Proc Near Uses ax si es di 796 push ExecBaseSeg 797 pop es 798 mov di, ExecBasePtr 799 add di, 446 ; DS:SI - First Partition-Entry 862 PART_MarkFirstGoodPrimary Proc Near Uses ax si di 863 mov di, offset PartitionSector+446 ; DS:SI - 1st partitionentry 800 864 ; First action to do: Remove the active flag from every partition 801 865 push di … … 827 891 PMPP_Search1NoHit: 828 892 add di, LocBRPT_LenOfEntry ; 16 Bytes per Partition-Entry 829 cmp di, 500+ ExecBasePtr893 cmp di, 500+offset PartitionSector 830 894 jb PMPP_Search1Loop 831 895 832 mov di, ExecBasePtr 833 add di, 446 ; DS:SI - First Partition-Entry 896 mov di, offset PartitionSector+446 ; DS:SI - 1st Partition-Entry 834 897 ; Second Search, hit on anything that is not an extended partition 835 898 ; (05 or 0Fh) … … 844 907 PMPP_Search2NoHit: 845 908 add di, LocBRPT_LenOfEntry ; 16 Bytes per Partition-Entry 846 cmp di, 500+ ExecBasePtr909 cmp di, 500+offset PartitionSector 847 910 jb PMPP_Search2Loop 848 911 jmp PMPP_SearchFailed … … 859 922 ; SI - Pointer to Name (8char) 860 923 ; Destroyed: *none* 861 PART_SearchFileSysName Proc Near Uses dsbx dx924 PART_SearchFileSysName Proc Near Uses bx dx 862 925 movzx bx, al 863 push cs864 pop ds865 926 mov si, offset FileSysIDs 866 927 PSFSN_SearchLoop: … … 892 953 ; In: AL - FileSysID 893 954 ; Out: AL - Hidden File-System-ID 894 PART_SearchFileSysHiddenID Proc Near Uses dsbx955 PART_SearchFileSysHiddenID Proc Near Uses bx 895 956 movzx bx, al 896 push cs897 pop ds898 957 mov si, offset FileSysIDs 899 958 PSFSHI_SearchLoop:
Note:
See TracChangeset
for help on using the changeset viewer.