Changeset 77
- Timestamp:
- Apr 8, 2017, 12:26:14 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bootcode/airboot.asm
r76 r77 120 120 BIOS_AUXPARMS_DEFAULT EQU (AUX_INIT_PARMS SHL 8) OR BIOS_COM_PORT 121 121 122 ; Default byte value for BIOS_BootDisk variabls 123 BIOS_BOOTDISK_DEFAULT EQU 80h 122 124 123 125 … … 492 494 ; =MICROSOFT JUMP DEPARTMENT= 493 495 494 495 496 ; Push all registers with values provided by the BIOS 496 497 ; on the stack. 497 498 pusha 498 ; Temporary save SS and SP so we still have access to this499 ; stack after we have setup our own.500 mov dx,ss501 mov bx,sp502 499 503 500 ; … … 539 536 rep movsw 540 537 538 ; Temporary save SS and SP so we still have access to this 539 ; stack after we have setup our own. 540 mov cx,ss 541 mov bx,sp 542 541 543 ; Code an intersegment jump to the new location. 542 544 ; jmp BootBaseSeg:BootBaseExec … … 570 572 571 573 572 ; 573 ; Some small space for variables. 574 ; 574 ; Base of some MBR variables 575 575 ORIGIN 0003Ch 576 577 MBR_Variables: 576 578 577 579 ; Comport settings. … … 581 583 BIOS_AuxParms dw BIOS_AUXPARMS_DEFAULT 582 584 583 585 ; When the BIOS turns over control to the MBR, DL holds the BIOS disk-number 586 ; from which the boot was initiated. This would normally be 80h, corresponding 587 ; to the first physical disk. However, some modern BIOSses can directly boot 588 ; from other disks, so AirBoot cannot assume being loaded from 80h anymore. 589 ; So here we store the BIOS disk-number passed in DL when AirBoot got control. 590 BIOS_BootDisk db BIOS_BOOTDISK_DEFAULT ; Get overwritten with 'DL' 591 592 ; Reserved space for future variables. 584 593 IFDEF AUX_DEBUG 585 reserved db 6dup('X')594 reserved db 5 dup('X') 586 595 ELSE 587 reserved db 6dup(0)596 reserved db 5 dup(0) 588 597 ENDIF 589 598 … … 594 603 ; SECOND ENTRY-POINT 595 604 ; ----------------------------------------------------------------------------- 605 596 606 ; 597 607 ; We arrive here after the first jump using the 'A' of the … … 685 695 ; 686 696 ; When we arrive here we are running at 8000:0000. 687 ; DX:BX contains the SS:SP of the old stack.697 ; CX:BX contains the SS:SP of the old stack. 688 698 ; 689 699 … … 704 714 705 715 ; 706 ; Push the old SS:SP which was saved in DX:BX on the new stack.707 ; 708 push dx ; Old SS716 ; Push the old SS:SP which was saved in CX:BX on the new stack. 717 ; 718 push cx ; Old SS 709 719 push bx ; Old SP 710 720 721 ; 722 ; Store the BIOS disk-number AirBoot was loaded from. 723 ; 724 mov [BIOS_BootDisk], dl 711 725 712 726 ; Load the configuration-sectors from disk. 713 727 ; These are the main configuration sector and the various 714 728 ; tables that follow it upto but not including the MBR backup. 715 mov bx, offset Configuration 716 mov dx, 0080h ; First harddrive717 mov cx, 0037h ; Config sector is at 55d (CHS)718 719 ; Call the i/o-part720 call MBR_LoadConfig729 mov bx, offset Configuration ; Location in RAM 730 mov cx, 0037h ; Config sector is at 55d 731 mov al, (MBR_BackUpMBR - Configuration) / 200h 732 mov ah, 02h 733 ; DL is already loaded with BIOS disk-number 734 int 13h ; Call BIOS service 721 735 jnc MBR_ConfigCopy_NoError 722 736 723 737 ; Some error occured 724 738 MBR_ConfigCopy_LoadError: 725 call MBR_LoadError ; Will Abort BootUp 726 727 ; Load the code sectors 739 jmp MBR_LoadError ; Will Abort BootUp 740 741 ; Load the code-sectors from disk. 742 ; [MBR_CodeSecs] is filled in by the FIXCODE helper that post 743 ; processes the AIRBOOT loader image after it has been built. 728 744 MBR_ConfigCopy_NoError: 729 mov bx, offset FurtherMoreLoad ; Directly after MBR in mem 730 mov dx, 0080h ; First harddrive 731 mov cx, 0002h ; Start at second sector 732 mov ah, 02h ; Read sectors 733 734 ; This location is in the MBR. 735 ; It is filled in by the FIXCODE helper that post processes 736 ; the AIRBOOT loader image after it has been built. 737 ; FIXCODE also embeds the MBR protection-image. 738 mov al, ds:[10h] ; Number of code sectors 739 int 13h ; Call BIOS service 745 mov bx, offset FurtherMoreLoad ; Directly after MBR 746 mov cx, 0002h ; Start at 2nd sector 747 mov al, [MBR_CodeSecs] ; Number of code sectors 748 mov ah, 02h ; Read sectors 749 ; DL is already loaded with BIOS disk-number 750 int 13h ; Call BIOS service 740 751 jnc MBR_RealStart_NoError 741 jmp MBR_ConfigCopy_LoadError 742 752 753 ; Some error occured 754 jmp MBR_LoadError ; Will Abort BootUp 755 756 757 ; I13X Signatures 758 ORIGIN 000d0h 743 759 744 760 ; [v1.05+] … … 756 772 ; the v1.x and v2.x LVM MBR-code. Other code might depend on 757 773 ; their presence. Let's protect their location. 758 ORIGIN 000d0h759 774 db 'I13X',0,'I13X',0 760 775 … … 805 820 ;------------------------------------------------------------------------------ 806 821 807 808 809 ; This is an ugly kludge function to create space for the 810 ; double 'I13X' signature. 811 ; It loads the configuration sectors, but bx,cx and dx are not initialized 812 ; in this function. That's done around line 500. 813 ; Putting this few bytes here creates just enough room. 814 MBR_LoadConfig Proc Near 815 ; Changed from conditional assembler to calculated value 816 ; Fixes issue: #2987 -- "air-boot doesn't remember drive letter" 817 ; Size of the ab-configuration in 512 byte sectors 818 mov al, (MBR_BackUpMBR - Configuration) / 200h 819 mov ah,02h 820 int 13h 821 ret 822 MBR_LoadConfig EndP 822 ; Disk Signature 823 ORIGIN 001B8h 823 824 824 825 … … 827 828 ; with the dummy PTE that it uses to look for IBM-BM 828 829 ; on the second harddisk. 829 ORIGIN 001B8h830 831 830 ; AiR-BOOT installer will merge the field 832 831 ; from the MBR it replaces. … … 840 839 841 840 842 ;843 841 ; Partition Table. 844 ;845 842 ORIGIN 001BEh 846 843 … … 870 867 ; ----------------------------------------------------------------------------- 871 868 872 869 ; First sector the rest of the loader image 873 870 ORIGIN 00200h 874 871 … … 930 927 ; ----------------------------------------------------------------------------- 931 928 929 ; The entry-point jumped to from the MBR code 932 930 ORIGIN 00400h 933 931 934 932 935 ; ############################################ 936 ; # ENTRY-POINT AFTER ALL THE INITIAL HASSLE # 937 ; ############################################ 933 ;############################################################################## 934 ;# AiR_BOOT_Start :: This is where the real work begins # 935 ;# -------------------------------------------------------------------------- # 936 ;# At this point, all of AirBoot is loaded, including its configuration. # 937 ;# First, some setup is done, which includes the initialization of variables # 938 ;# in the BSS. After that, disks are scanned for partitions and the required # 939 ;# house keeping is done to incorporate changes from the previous boot. Then # 940 ;# the partition list is prepared and the menu is presented. # 941 ;############################################################################## 938 942 ; BOOKMARK: AiR_BOOT_Start (AiR-BOOT now completely loaded) 939 943 AiR_BOOT_Start: … … 954 958 pop [OldSS] 955 959 960 961 ; Verify we still got the BIOS disk in DL 962 IFDEF AUX_DEBUG 963 mov ax, dx 964 call AuxIO_TeletypeHexWord 965 call AuxIO_TeletypeNL 966 mov ax, bx 967 call AuxIO_TeletypeHexWord 968 call AuxIO_TeletypeNL 969 xor ah, ah 970 mov al, [BIOS_BootDisk] 971 call AuxIO_TeletypeHexWord 972 call AuxIO_TeletypeNL 973 ENDIF 956 974 957 975 ; ----------------------------------------------------------------------------- … … 1039 1057 1040 1058 1041 1042 1043 1059 ;! 1044 1060 ;! DEBUG_BLOCK … … 1058 1074 ; PARTITION SCAN 1059 1075 ; ----------------------------------------------------------------------------- 1076 1077 1078 1079 1080 1081 1060 1082 ; 1061 1083 ; BOOKMARK: Scan all partitions
Note:
See TracChangeset
for help on using the changeset viewer.