Changeset 43 for trunk/BOOTCODE/AIR-BOOT.ASM
- Timestamp:
- Apr 11, 2014, 11:48:01 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BOOTCODE/AIR-BOOT.ASM
r42 r43 1 1 ; 2 ; BSS moet op A000 liggen3 ; Segmented werkt niet4 ; Moet met Tasm/DOS assembleren5 ; Wat we dus *niet* willen !!6 ;7 8 9 10 2 ; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz 11 3 ; … … 25 17 ; AiR-BOOT. If not, see <http://www.gnu.org/licenses/>. 26 18 ; 27 28 29 ;IFDEF JWASM30 ; db 'JWASM'31 ;ENDIF32 ;IFDEF TASM33 ; db 'TASM'34 ;ENDIF35 36 37 38 ;IF DEBUG_LEVEL EQ 039 ; db 'L0'40 ;ELSE41 ; db 'Lx'42 ;ENDIF43 44 45 ; ---------------------------------46 ; Rousseau: Fixes and Enhancements47 ; ---------------------------------48 ;49 ; v1.0.8-rc2-bld2012021350 ;-----------------------51 ; # Removed requirement for LVM P and V name to be the same to edit #52 ; However, when both are the same before the edit, the V name will be53 ; synved to the P name to have them both the same again after the edit.54 ; If they differ, only the V name is updated.55 ;56 ; # Trying to edit the label of a type 0x35 partition now shows a popup #57 ; The user is informed that type 0x35 labels cannot be edited.58 ;59 ; # Type 0x35 partitions cannot be added to the AB-menu anymore #60 ; They are not bootable anyway. The user is informed by a popup.61 ;62 ; # De-tasemized the Assembler sources for JWasm compatibility #63 ; AiR-BOOT can now be built using JWasm, which is now the preferred64 ; assembler.65 ;66 ; # Completely reworked the build-system #67 ; Everything is now done with Makefiles using WMake, Wlink and the68 ; C/C++ Compilers from the Open Watcom development tools together with JWasm.69 ; This obsoletes tasm, tlink and exe2bin.70 ;71 ; # Cross-Platform support #72 ; AiR-BOOT and it's helpers can now be built on: DOS, Win32, OS/2 and Linux.73 ;74 ; # Rewrote FIXCODE.ASM in C so the tool-chain is not dependent on a DOS .COM75 ; program for embedding the MBR-protection. DOS,Win32,OS/2 and Linux76 ; versions of FIXCODE are now used. (EXE[MZ|PE|LX] and ELF)77 ;78 ; v1.0.8-rc1-bld2012012479 ; ----------------------80 ; # Changed version format to be more WarpIN compatible #81 ; This is a cosmetic change only, the internal format has not changed.82 ;83 ; # Show LVM VolumeName instead of LVM PartitionName #84 ; Previous versions of AiR-BOOT used the LVM PartitionName as the Label85 ; if LVM-info was present for the partition.86 ; This is inconsistent with MiniLVM which shows the LVM VolumeName.87 ; Starting with v1.0.8 the LVM VolumeName is displayed.88 ;89 ; # LVM Partition and Volume name Synchronization #90 ; Changing the Label of a partition with LVM-info now synchronizes91 ; the LVM Partition Name with the LVM Volume Name.92 ; This is the same behavior as MiniLVM.93 ; Note however that the Label can only be changed when both the94 ; LVM PartitionName and LVM VolumeName are the same.95 ; See protected editing below.96 ;97 ; # Protected editing of the Label when LVM-info is present #98 ; When the LVM VolumeName differs from the LVM PartitionName, the user can99 ; edit the label but it will not be saved to the LVM record on disk.100 ; This is to protect configurations created with the classic LVM tool.101 ; Since MiniLVM assigns the same name to both the Partition and the Volume,102 ; the Label can be edited and will be saved for such partitions.103 ; To further protect a given configuration, LVM volumes with type 0x35104 ; cannot be edited at all. This is to ensure that the LVM PartitionNames105 ; remain unique when Spanning Volumes are used.106 ;107 ; # Editing the Label appended spaces #108 ; When editing and changing the Label of a System using SETUP,109 ; trailing spaces were stored in the LVM Volume and Partition names.110 ; These labels need to be padded with zero's.111 ; This has been fixed.112 ; This bug is also present in v1.06.113 ;114 ; # Reworked Primary Partition <-> LVM-info association #115 ; The previous way was to use a 1:1 correspondence between the PT-index116 ; and the LVM-index. However, when the PT is cross-linked, lower entries117 ; pointing to higher locations on the disk, or vice-versa, incorrect118 ; LVM-info was associated. Such a cross-linked PT is sometimes generated119 ; by the LVM engine when creating or deleting multiple partitions at once.120 ; Best is to intermediately save after creating or deleting a partition121 ; with (Mini)LVM.122 ; The new way is to search the LVM-entries for the partition requested.123 ;124 ; # Reworked MBR-code to provide two I13X signatures #125 ; The normal LVM MBR-code uses a special setup to indicate Int13X capability.126 ; It contains the instruction, MOV EAX,'X31I', and some software checks127 ; for the presence of the 'I13X' string in the MBR.128 ; However, the location of this instruction differs between eCS 1.x and129 ; eCS 2.x LVM MBR-code.130 ; For compatibility, the v1.0.8 MBR has the 'I13X' string at both locations.131 ;132 ; # Fixed booting older eCS installations on HPFS #133 ; When restoring systems from archive or otherwise generated systems,134 ; the HPFS BPB sometimes lacked information that AiR-BOOT did not fill in.135 ; The result was that a wrong partition was booted or that booting136 ; stalled with the "unable to operate harddisk" message.137 ; This has been fixed.138 ;139 ; # Fixed booting Windows from a logical partition with loader on FAT32 #140 ; Depending on the configuration, sometimes the NTLDR could not be found.141 ; This has been fixed.142 ;143 ; # Fixed drive-letter feature which was broken in v1.07 #144 ; a) v1.07 did remember the drive-letter feature was active for a partition,145 ; but it failed to store the drive-letter because too few configuration146 ; sectors were saved. This resulted in arbitrary values to be assigned147 ; to the drive-letter for the partition.148 ; b) The JFS PBR-code does not use the in-memory BPB but uses the one149 ; that is on disk. This prevented AiR-BOOT from passing the user assigned150 ; drive-letter. AiR-BOOT now inserts the drive-letter in the BPB on disk,151 ; but only if the partition is JFS.152 ; AB v1.06 is also unable to use the drive-letter feature on JFS.153 ; As a convenience, a drive-letter in the dl-feature pop-up can now be set154 ; to "Disabled" by pressing backspace.155 ; (As opposed to arrowing up/down to get to the "Disabled" entry)156 ;157 ; # Fixed stuck phase1 indicator when wrong name entered #158 ; When using SET(A)BOOT /4:NAME with the MEMDRIVE env-var set,159 ; and NAME being a non-existing partition, the phase1 indicator160 ; would stay stuck between reboots.161 ; This has been fixed.162 ;163 ; # Fixed DOS installer (AIRBOOT.COM) #164 ; Behavior should now be the same as the eCS and WIN installers.165 ; This re-enables the use of a bootable floppy or usb-stick166 ; to install AiR-BOOT.167 ;168 ; # Fixed booting from FloppyDrive #169 ; This is actually also broken in v1.06 when Int13X is forced on.170 ; Now regular BIOS calls are used when booting from floppydrive.171 ; A fresh AiR-BOOT installation now includes the floppydrive menu entry.172 ;173 ; # Fixed chainloading IBM Boot Manager #174 ; AiR-BOOT v1.06 could chainload IBM-BM but only when it resided on175 ; the first disk and was located below the 1024 cylinder and forced Int13X176 ; extensions were disabled.177 ; AiR-BOOT v1.0.8 can now chainload IBM-BM with forced Int13X extensions178 ; enabled (the default) and if IBM-BM resides above the 1024 cylinder limit.179 ; Also, chainloading IBM-BM from the second disk is supported.180 ; Do not use chainloading IBM-BM unless you really have a need to.181 ; See the AiR-BOOT Manual for "gotcha's" when using both AiR-BOOT and IBM-BM.182 ;183 ; # Corrected contact links #184 ; Version 1.07 still presented the old contact links to the sourceforge185 ; repository and the original author.186 ; This caused confusion with regard to issues with v1.07.187 ; This has been corrected.188 ;189 ; NOTE:190 ; AB v1.07 had a bug with saving and loading the correct size of the191 ; configuration. This broke the drive-letter feature.192 ; As a result, the CRC over the config was also calculated wrongly.193 ; While AB v1.0.8 fixes this, it has to use the v1.07 way of CRC calculation.194 ; Otherwise SET(A)BOOT from the eCS v2.1 would break on AB v1.0.8 because it195 ; sees a corrupt AiR-BOOT configuration.196 ; This means that the CRC over the AB config is calculated over 5 sectors197 ; instead of 7, just like in v1.07.198 ;199 ; NOTE:200 ; Because of space constraints most of the debug code has been commented201 ; out in this version.202 ; Possibly it will be re-enabled after code cleanup and changing to JWasm.203 ;204 ;205 ; v1.07206 ; -----207 ; # Huge Drives and LVM #208 ; When using disks >512GB under eComStation, the drive geometry changes to209 ; 127 or 255 sectors per track. Since LVM-info is written at the last sector210 ; of a track, and AiR-BOOT uses the geometry of the MBR, it cannot find the211 ; LVM-info and the eCS partition / volume bootsector.212 ; This has been fixed.213 ; Now, when an eCS-partition is discovered and the drive is >512GB, AiR-BOOT214 ; will use the eCS geometry to locate the LVM-info and the bootsector.215 ;216 ; # Special loader handling #217 ; The special handling of partition boot-loaders has been enhanced to218 ; enable booting of legacy systems on huge drives with or without OS/2219 ; extended geometry.220 ;221 ; # eComStation boot-through after phase 1 #222 ; Special functionality is implemented to directly boot a newly223 ; installed eCS system after completing phase 1 of the installation.224 ; This works in conjuntion with the OS/2 specific SET(A)BOOT.EXE program,225 ; also part of the AiR-BOOT package.226 ;227 ; # Math, Debug, Conv and Aux modules #228 ; These are used for 32-bit arithmatic on 16-bit code,229 ; debug the booting process, converting between data-types230 ; and outputting log-data to the com-port.231 ;232 ;233 ; v1.06234 ; -----235 ; This is the last version developed by Martin Kiewitz.236 ; It serves as the base for the versions above.237 ; Please do not post your feedback on sourceforge or bother Martin with238 ; regard to issues with the above versions.239 ; Use the eCS bug-tracker or the Trac project-page at netlabs and see the240 ; documentation of this newer versions for the relevant contact information.241 19 242 20 … … 262 40 ; instructions, to allow for automatic recoding by TASM. 263 41 ; This seems to be a TASM bug. (v2,v3,v4, dunno v5) 264 ; 265 ;JUMPS266 ; 42 IFDEF TASM 43 ;~ JUMPS 44 ENDIF 267 45 268 46 ; … … 272 50 ; 273 51 ;ModuleNames equ 1 274 275 276 277 278 279 ;280 ; An ORG directive resets the location counter where code and data is281 ; generated. If the location counter is reset back to a point where282 ; code or data already has been generated, this will be overwritten283 ; without warning.284 ; This macro is run at every ORG directive to check for this condition,285 ; and when it occurs further assembly is terminated.286 ; FIXME: Get JWasm and Tasm use some common ECHO/%OUT method.287 ; (Tasm only pases first word of non-quoted string to a macro)288 ;289 check_overlap MACRO loc290 291 ; Exit macro immediately if no overlap.292 ; We don't want to assign values to z_last_... if there is no293 ; overlap because they would then hold the values the last time this294 ; macro was called and not those of the last overlap.295 IF (loc - $) LE 0296 EXITM297 ENDIF298 299 ; Calculate the overlap.300 z_last_overlap_location = loc301 z_last_overlap_size = (loc - $)302 303 IFDEF JWASM304 ; Output message.305 ECHO306 ECHO ** ERROR: LOCATION OVERLAP DETECTED [JWASM] ! **307 ECHO . THIS IS MOST LIKELY CAUSED BY CODE / DATA308 ECHO . EXPANSION TOWARDS AN 'ORG' DIRECTIVE.309 ECHO . LOOK AT 'z_last_overlap_location' TO SEE WHERE.310 ECHO . LOOK AT 'z_last_overlap_size' TO SEE SIZE.311 ECHO . FORCING ERROR...312 ECHO313 ENDIF314 IFDEF TASM315 IF2316 ; Output message (only on pass2).317 %OUT318 %OUT ** ERROR: LOCATION OVERLAP DETECTED [TASM] ! **319 %OUT . THIS IS MOST LIKELY CAUSED BY CODE / DATA320 %OUT . EXPANSION TOWARDS AN 'ORG' DIRECTIVE.321 %OUT . LOOK AT 'z_last_overlap_location' TO WHERE.322 %OUT . LOOK AT 'z_last_overlap_size' TO SEE SIZE.323 %OUT . FORCING ERROR...324 %OUT325 ENDIF326 ENDIF327 328 ; Terminate assembly by forcing an error.329 .ERR330 331 ENDM332 333 334 52 335 53 … … 342 60 MaxDisks equ 64 343 61 344 ; 345 ; If defined then include DEBUG.ASM and output debug-info to serial-port. 346 ; 347 ;AuxDebug equ 1 348 349 ; Com-port for debugging, 0 is disabled 350 BiosComPort equ 0 62 ; Only when assembled with JWasm because Tasm generates too large code. 63 IFDEF JWASM 64 ; If defined then include DEBUG.ASM and output debug-info to serial-port. 65 AUX_DEBUG EQU 66 ELSE 67 ;~ AUX_DEBUG EQU 68 ENDIF 351 69 352 70 … … 363 81 364 82 ; 9600 bps, no parity, 1 stop-bit, 8 bits per char 365 AuxInitParms equ 11100011b 83 AUX_INIT_PARMS EQU 11100011b 84 85 ; Com-port for debugging, 0 is disabled 86 BIOS_COM_PORT EQU 1 366 87 367 88 ; Default word value for BIOS_AuxParms variable 368 89 ; Note that is has moved since v1.07 369 BIOS_AuxParmsDefault equ (AuxInitParms SHL 8) OR BiosComPort 90 BIOS_AUXPARMS_DEFAULT EQU (AUX_INIT_PARMS SHL 8) OR BIOS_COM_PORT 91 92 93 370 94 371 95 ; … … 373 97 ; 374 98 ReleaseCode equ -1 375 376 377 378 99 379 100 … … 542 263 543 264 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 265 ; ------------------------------------------ 266 ; Rousseau: # Changed this from .386 to .286 267 ; ------------------------------------------ 268 ; Because of the TASM-bug the processor had to be changed to turn JUMPS 269 ; off. Existing movzx instructions were replaced with 286 equivalent code. 270 ; Out of range relative jumps have been recoded. 271 ; TASM still generates an extra NOP after test [mem],1 272 ; instructions. 273 ; JWasm produces tighter code. 274 ; JWasm: 275 ; With segment overrides, the address is expanded to the bit-width. 276 ; So, .386 will generate a 32-bit address, even in a USE16 segment. 277 .286 278 279 ; This influences the uses directive and other stuff, 280 ; like calling-style and local variables. 281 ; The model itself,large, has no effect because we generate 282 ; a binairy image and not a segmented executable. 283 284 ; Tasm needs a memory model for USES on PROC to work. 285 IFDEF TASM 286 ;.model large, basic 287 .model tiny,c 288 ENDIF 568 289 569 290 ; … … 580 301 ; time. 581 302 ; 582 SEGMENTED EQU 1303 SEGMENTED EQU 583 304 584 305 IFDEF SEGMENTED 585 AIRBOOT GROUPIMAGE,VOLATILE306 AIRBOOT GROUP LDRIMAGE,VOLATILE 586 307 ENDIF 587 308 588 309 ; Our code-segment starts here. 589 IMAGESEGMENT USE16 PUBLIC 'MIXED'310 LDRIMAGE SEGMENT USE16 PUBLIC 'MIXED' 590 311 591 312 IFDEF SEGMENTED 592 ASSUMECS:AIRBOOT, DS:AIRBOOT, ES:nothing, SS:nothing313 ASSUME CS:AIRBOOT, DS:AIRBOOT, ES:nothing, SS:nothing 593 314 ELSE 594 ASSUME CS:IMAGE, DS:IMAGE,ES:nothing, SS:nothing315 ASSUME CS:LDRIMAGE,DS:LDRIMAGE,ES:nothing, SS:nothing 595 316 ENDIF 596 597 317 598 318 ;============================================================================== … … 638 358 639 359 ; ID String, Date (DD,MM,CC,YY), Version Number, Language ID 640 db 'AiRBOOT', 16h, 02h, 20h, 12h, 01h, 08h, TXT_LanguageID360 db 'AiRBOOT', 20h, 02h, 20h, 12h, 01h, 08h, TXT_LanguageID 641 361 642 362 ; Total Sectors Count. … … 709 429 710 430 711 712 431 ; Comport settings 713 432 ; It had to be moved to create room for the double I13X 714 433 ; signature. 715 434 ; It cannot be in the config-area (sector 55) 716 ; because that area 717 ; is crc-protected. 718 BIOS_AuxParms dw BIOS_AuxParmsDefault 719 720 ; 721 ; Reserved space 722 ; Should check overflow here, later... 723 ; 435 ; because that area is crc-protected and would not allow 'poking'. 436 here = $ 437 org 0003Ch 438 check_overlap here 439 BIOS_AuxParms dw BIOS_AUXPARMS_DEFAULT 440 724 441 reserved db 6 dup('X') 725 726 442 727 443 ; … … 733 449 ; want to change the AiR-BOOT signature 734 450 ; because of Microsoft inventions... 735 736 737 738 739 740 451 here = $ 741 452 org 044h … … 832 543 mov ds, ax ; Set DS==ES to Code Segment 833 544 545 834 546 ; If we are in debug-mode, all code is moved already, 835 547 ; so we can directly jump to it. … … 966 678 dw '$$' 967 679 680 681 here = $ 682 org 001beh 683 check_overlap here 968 684 969 685 ; Partition Table … … 1057 773 1058 774 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 775 ; ############################################## 1073 776 ; ## ENTRY-POINT AFTER ALL THE INITIAL HASSLE ## 1074 777 ; ############################################## 778 1075 779 1076 780 … … 1107 811 1108 812 813 mov ax, offset sobss 814 mov ax,offset BeginOfVariables 815 mov ax,offset [TrueSecs] 816 lea ax, [TrueSecs] 817 mov ax,word ptr [TrueSecs] 818 mov ax,offset EndOfVariables 819 mov ax, offset eobss 820 nop 821 ;~ mov ax, offset qqqq 822 1109 823 1110 824 ;jmp skip … … 1267 981 1268 982 1269 skip:983 skip: 1270 984 1271 985 … … 1441 1155 size_driveio = $-b_driveio 1442 1156 1157 b_lvm: 1158 Include SPECIAL/LVM.ASM ; LVM-specific code 1159 size_lvm = $-b_lvm 1160 1443 1161 b_videoio: 1444 1162 Include REGULAR/VIDEOIO.ASM ; Video I/O … … 1469 1187 size_other = $-b_other 1470 1188 1471 ; Rousseau: Special modules moved upwards.1472 1189 b_main: 1473 1190 Include SETUP/MAIN.ASM ; The whole AiR-BOOT SETUP 1474 1191 size_main = $-b_main 1192 1475 1193 1476 1194 … … 1481 1199 ENDIF 1482 1200 1201 1483 1202 b_math: 1484 1203 Include REGULAR/MATH.ASM ; Math functions (like 32-bit multiply) … … 1487 1206 1488 1207 1489 IFDEF AuxDebug 1208 1209 ; Various debugging routines, uses AUXIO and CONV 1210 IFDEF AUX_DEBUG 1490 1211 b_debug: 1491 ; Include REGULAR/DEBUG.ASM ; Various debugging routines, 1492 ; uses AUXIO and CONV 1212 Include REGULAR/DEBUG.ASM 1493 1213 size_debug = $-b_debug 1214 b_auxio: 1215 Include REGULAR/AUXIO.ASM ; Com-port support for debugging 1216 size_auxio = $-b_auxio 1494 1217 ENDIF 1495 1496 b_auxio:1497 ;Include REGULAR/AUXIO.ASM ; Com-port support for debugging1498 size_auxio = $-b_auxio1499 1500 ; Rousseau: moved upwards1501 ;IFDEF TXT_IncludeCyrillic1502 ; Include SPECIAL/CHARSET.ASM ; Charset Support (e.g. Cyrillic)1503 ;ENDIF1504 1505 b_lvm:1506 Include SPECIAL/LVM.ASM ; LVM-specific code1507 size_lvm = $-b_lvm1508 1218 1509 1219 … … 1603 1313 1604 1314 1605 1606 CODE_END: 1607 1608 ;org 06A00h - 4 1315 ; 1316 ; End of code marker. 1317 ; 1609 1318 db 'BABE' 1610 1611 ;org 06A00h1612 1319 db 'FACE' 1613 1320 1321 code_end: 1322 1323 1324 1325 here = $ 1326 org 06800h 1327 ; For some reason, this overlap check does not work !! 1328 ; I gues it's because 'here' has no definitive value yet 1329 ; and since JWasm is a single pass assembler, it won't 1330 ; change anymore. it is off by 1dh bytes. 1331 ; (Changing the ORG to 6700h produces an overlap of 11dh. 1332 ; This 1dh is by sheer coincidence the same length as the 1333 ; MBR_Prot signature on my system, but it's not related. 1334 check_overlap here 1335 1614 1336 ; 1615 1337 ; This is the AiR-BOOT MBR-Protection Image. 1616 ; 0 4600 / 200h = 34h = 52d sectors are before this point.1338 ; 06800 / 200h = 34h = 52d sectors are before this point. 1617 1339 ; The stuff generated here gets overwritten when the MBR_PROT.ASM 1618 1340 ; module, which is assembled separately, gets merged. 1619 1341 ; So you won't find the string below in the generated binary. 1620 1342 ; 1621 here = $ 1622 org 06800h 1623 check_overlap here 1624 1343 ; Hardcoded to 1k (1024 bytes) (MBR_PROT.ASM) 1625 1344 MBR_Protection db 'AiR-BOOT MBR-Protection Image' 1626 ; Hardcoded to 1k (1024 bytes) 1627 db 1024-($-MBR_Protection) dup(0) 1628 1629 1630 ;CODE_SEG ENDS 1631 1345 1346 ; Just fill. 1347 db 1024-($-MBR_Protection) dup('M') 1348 1349 ;LDRIMAGE ENDS 1632 1350 ;DATA_SEG SEGMENT USE16 PUBLIC 'CODE' 1351 1352 1353 1354 ;~ MYDATA SEGMENT COMMON 'MIXED' 1355 ;~ qqqq dw 'QQ' 1356 ;~ MYDATA ENDS 1633 1357 1634 1358 ;============================================================================== … … 1979 1703 ; 1980 1704 1981 IMAGEENDS1982 1983 ;DATA_SEG 1705 LDRIMAGE ENDS 1706 1707 ;DATA_SEG ENDS 1984 1708 1985 1709 ; … … 2000 1724 ; 2001 1725 org 02400h ; Uninitialized 2002 1726 ;~ org 00200h ; 200h geeft 3 floppies ! 2003 1727 2004 1728 ; This space actually gets initialized in PreCrap to NUL (till EndOfVariables) … … 2010 1734 2011 1735 ; Everything used to build a new IPT and reference it to the old one 1736 ; IETS OVERSCHRIJFT DIT !! 2012 1737 NewPartTable db 1536 dup (?) ; New Partition Table 1738 2013 1739 NewHidePartTable db partition_count * LocHPT_LenOfHPT dup (?) ; New Hide-Partition Table 2014 1740 NewDriveLetters db partition_count dup (?) ; Logical Drive-Letters … … 2167 1893 VOLATILE ENDS 2168 1894 ELSE 2169 IMAGEENDS1895 LDRIMAGE ENDS 2170 1896 ENDIF 1897 2171 1898 END AIR_BOOT 2172 1899 2173 2174
Note:
See TracChangeset
for help on using the changeset viewer.