Changeset 45 for trunk/BOOTCODE/SETUP
- Timestamp:
- Apr 12, 2014, 12:36:45 AM (12 years ago)
- File:
-
- 1 edited
-
trunk/BOOTCODE/SETUP/PART_SET.ASM (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BOOTCODE/SETUP/PART_SET.ASM
r43 r45 637 637 jnc PSCPN_LVMGotError ; Not Found? -> display error and halt 638 638 639 ; 640 ; While AiR-BOOT v1.0.8+ displays the LVM VolumeName, the LVM PartitionName 641 ; is used here to compare to the IPT. 642 ; The IPT has the LVM VolumeName, so if they differ the compare will fail 643 ; and the user-entry will noy be written to the LVM-info sector. 644 ; 645 add si, LocLVM_PartitionName 639 640 ; Point to LVM VolumeName 641 add si, LocLVM_VolumeName 646 642 647 643 648 644 xchg si, di ; SI-IPTEntry, DI-LVM PartName 649 645 jmp PSCPN_CheckPartName ; Check, if match... 646 647 650 648 651 649 PSCPN_LVMGotError: … … 691 689 ; Rousseau: Because AiR-BOOT v1.0.8 uses the LVM_VolumeName, which is copied 692 690 ; to the IPT, this compare fails when the LVM_PartitionName is not 693 ; the same as the LVM_VolumeName. 694 ; This is a protection against editing the Label when these names differ.695 ; MiniLVM assigns the same value to both, so partitions created with MiniLVM696 ; can be edited. 691 ; the same as the LVM_VolumeName. In that case, only the LVM_VolumeName 692 ; is updated. If they are the same, both are upated so they are the same 693 ; again after the edit. 694 697 695 PSCPN_CheckPartName: 698 696 699 ; SI = IPT_Enty 697 ; Do no synchronization initially. 698 mov [SyncLvmLabels],0 699 700 ; SI = IPT_Enty, DI points to LVM VolumeName. 700 701 701 702 ; If the partition is an LVM partition then disable editing completely. … … 712 713 713 714 jmp PSCPN_AllDone 715 716 ; SI = IPT_Enty, DI points to LVM VolumeName. 714 717 no_type_35h: 718 719 ; 720 ; Compare LVM VolumeName and PartitionName and 721 ; set flag if they are the same and need to be synced after user edit. 722 ; 723 push si 724 push di 725 mov si,di ; Pointer to LVM V-name in SI 726 add di,LocLVM_LabelLen ; Pointer to LVM P-name in DI 727 mov cx,LocLVM_LabelLen ; Length of LVM label 728 cld 729 repe cmpsb ; Compare V and P labels 730 jnz LVM_Labels_not_equal 731 mov [SyncLvmLabels],1 ; Same so set flag for later 732 LVM_Labels_not_equal: 733 pop di 734 pop si 735 715 736 716 737 mov cx, 11 ; Partition-Name-Length = 11 Bytes … … 725 746 mov ChangePartNameSave, 1 ; Remember, so we will save to BR 726 747 748 ; SI = IPT_Enty, DI points to LVM PartitionName. 727 749 PSCPN_LetUserEditPartName: 728 750 ; User will now edit the volume label... … … 746 768 747 769 ; Make DI point to LVM VolumeName in LVM-entry 748 sub di,20 749 750 ; -------------------------------------------------[LVM SAVE VOLUME NAME]--- 751 ; Copy 11 bytes from IPT into LVM VolumeName, back-padd with zero's 752 mov cx, 11 753 push si 754 rep movsb 755 pop si 756 xor al, al 757 mov cx, 9 758 rep stosb 770 ;~ sub di,20 771 772 ; Points to LVM VolumeName. 773 push di 774 775 ; -------------------------------------------------[LVM SAVE VOLUME NAME]--- 776 ; Copy 11 bytes from IPT into LVM VolumeName, back-padd with zero's 777 mov cx, 11 778 push si 779 rep movsb 780 pop si 781 782 ; Padd with zero's, but the editor still might have left spaces 783 ; at the end of the 11-byte part. We correct that below. 784 xor al, al 785 mov cx, 9 786 rep stosb 759 787 760 788 … … 768 796 ; Correct LVM VolumeName 769 797 ; 770 push di771 798 mov cx,20 772 799 vn_padd_next: … … 782 809 jmp vn_padd_next 783 810 vn_padded: 811 812 ; Points to LVM VolumeName 784 813 pop di 785 814 786 787 788 789 ; ----------------------------------------------[LVM SAVE PARTITION NAME]--- 790 ; Copy 11 bytes from IPT into LVM PartitionName, back-padd with zero's 791 mov cx, 11 792 push si 793 rep movsb 794 pop si 795 xor al, al 796 mov cx, 9 797 rep stosb 798 799 800 ; 801 ; The AiR-BOOT Label Editor inserts spaces when a label is edited 802 ; and characters are backspaced. 803 ; This is fine for filesystem labels, which are space padded, 804 ; but the LVM VolumeName and PartitionName need to be zero padded. 805 ; So, below we replace all trailing spaces with zero's. 806 ; 807 ; Correct LVM PartitionName 808 ; 809 push di 810 mov cx,20 811 pn_padd_next: 812 jcxz pn_padded 813 dec di 814 dec cx 815 mov al,[di] 816 test al,al 817 jz pn_padd_next 818 cmp al,' ' 819 jnz pn_padded 820 mov byte ptr [di],0 821 jmp pn_padd_next 822 pn_padded: 823 pop di 824 815 ; See if LVM-labels need to be synced. 816 test [SyncLvmLabels],1 817 jz LVM_no_sync_labels 818 819 ; Sync LVM-labels. 820 mov si,di 821 add di,LocLVM_LabelLen 822 mov cx,LocLVM_LabelLen 823 cld 824 rep movsb 825 826 827 LVM_no_sync_labels: 825 828 826 829 ; Update LVM-CRC now... … … 917 920 ; Collect Hide-Partition-Config and put it into Hide-Table 918 921 mov dl, PartSetup_ActivePart 922 923 IFDEF AUX_DEBUG 924 pusha 925 mov al,dl ; Partition the hiding is set for. 926 call AuxIO_TeletypeHexByte 927 call AuxIO_TeletypeNL 928 popa 929 ENDIF 930 919 931 call PARTHIDESETUP_CollectHideConfigAndPutToTable 920 932 ; Simply return to Partition Setup … … 932 944 933 945 PHSM_KeyToogle: 946 947 IFDEF AUX_DEBUG 948 pusha 949 mov al,dl ; Index of partition to set Special Marker on. 950 call AuxIO_TeletypeHexByte 951 call AuxIO_TeletypeNL 952 popa 953 ENDIF 954 934 955 call PART_GetPartitionPointer ; Holt den Pointer der Partition (DL) nach SI 935 956 mov al, [si+LocIPT_Flags] … … 1269 1290 ; ============================================================================= 1270 1291 1292 1293 ; 1294 ; Rousseau: Adjusted for packed hidden-part-table ! 1295 ; Needs to be re-written. 1296 ; 1271 1297 ; This is called by MBRS_PS_HiddenSetup 1272 1298 ; In: DL - Partition, where to save Hide-Config 1273 1299 ; Destroyed: None, but Locate-Pointer 1274 PARTHIDESETUP_GetHideConfigAndSpread Proc Near Uses ax dx si di 1275 ; First check HideFeature-Flag on selected partition. 1276 ; if it's not set, don't do anything... 1277 call PART_GetPartitionPointer ; Holt den Pointer der Partition (DL) nach SI 1278 mov al, [si+LocIPT_Flags] 1279 test al, Flags_HideFeature 1280 jz PHSGHCAS_EndOfEntries 1281 PHSGHCAS_SomethingHidden: 1282 ; Calculate, where to get Hide-Config 1283 mov ax, LocIPT_MaxPartitions 1284 mul dl 1285 mov di, offset HidePartitionTable 1286 add di, ax ; We got the pointer 1287 ; So process Hide-Config. Read out Byte-Entries, each points to a partition 1288 ; 0FFh is end-marker / maximum entries = CFG_Partitions 1289 mov cl, CFG_Partitions 1290 PHSGHCAS_SpreadLoop: 1291 mov dl, [di] 1292 inc di 1293 cmp dl, 0FFh 1294 je PHSGHCAS_EndOfEntries 1295 call PART_GetPartitionPointer ; Pointer for partition DL to SI 1296 mov al, [si+LocIPT_Flags] 1297 or al, Flags_SpecialMarker ; Set marker 1298 mov [si+LocIPT_Flags], al 1299 dec cl 1300 jnz PHSGHCAS_SpreadLoop 1301 PHSGHCAS_EndOfEntries: 1302 ret 1300 PARTHIDESETUP_GetHideConfigAndSpread Proc Near Uses ax bx dx si di 1301 ; First check HideFeature-Flag on selected partition. 1302 ; if it's not set, don't do anything... 1303 call PART_GetPartitionPointer ; Holt den Pointer der Partition (DL) nach SI 1304 mov al, [si+LocIPT_Flags] 1305 test al, Flags_HideFeature 1306 jz PHSGHCAS_EndOfEntries 1307 PHSGHCAS_SomethingHidden: 1308 ; Calculate, where to get Hide-Config 1309 mov ax, LocHPT_LenOfHPT ; Size of a hidden-part-table entry. 1310 mul dl ; Multiply by partition-index. 1311 mov di, offset HidePartitionTable 1312 add di, ax ; We got the pointer 1313 1314 ; So process Hide-Config. Read out Bitfield-Entries, 1315 ; each points to a partition. 1316 ; 3Fh is end-marker / maximum entries = CFG_Partitions 1317 mov cl, CFG_Partitions 1318 mov bx,di ; Pointer to hidden-parts entry for this partition. 1319 mov ch,0 ; Start index in hidden-parts entry for this partition. 1320 mov dh,6 ; Bitfields are 6 bits wide. 1321 PHSGHCAS_SpreadLoop: 1322 mov dl,ch ; Load bitfield index from CH. 1323 call CONV_GetBitfieldValue ; Get value of bitfield. 1324 mov dl,al ; Partition index in DL. 1325 ;~ mov dl, [di] 1326 ;~ inc di 1327 ;~ cmp dl, 0FFh 1328 cmp dl,3fh ; Max value for 6-bits field. 1329 je PHSGHCAS_EndOfEntries 1330 call PART_GetPartitionPointer ; Pointer for partition DL to SI 1331 mov al, [si+LocIPT_Flags] 1332 or al, Flags_SpecialMarker ; Set marker 1333 mov [si+LocIPT_Flags], al 1334 inc ch ; Next bitfield. 1335 dec cl 1336 jnz PHSGHCAS_SpreadLoop 1337 PHSGHCAS_EndOfEntries: 1338 ret 1303 1339 PARTHIDESETUP_GetHideConfigAndSpread EndP 1304 1340 1341 1342 ; 1343 ; Rousseau: Adjusted for packed hidden-part-table ! 1344 ; Needs to be re-written. 1345 ; 1305 1346 ; This is called by MBRS_PS_HiddenSetup 1306 1347 ; In: DL - Partition, where to save Hide-Config 1307 1348 ; Destroyed: None, but Locate-Pointer 1308 PARTHIDESETUP_CollectHideConfigAndPutToTable Proc Near Uses ax si es di ; checken ! 1309 ; First calculate, where to put Hide-Config 1310 mov ax, LocIPT_MaxPartitions 1311 mul dl 1312 push cs 1313 pop es 1314 mov di, offset HidePartitionTable 1315 add di, ax ; We got the pointer 1316 push di 1317 push di 1318 mov cx, LocIPT_MaxPartitions 1319 mov al, 0FFh 1320 rep stosb ; Fill up with FFh 1321 pop di 1322 ; Now walk through the IPT collecting all SpecialMarkers 1323 ; For each do a byte-entry containing the number of the partition 1324 mov si, offset PartitionTable 1325 xor ch, ch 1326 mov cl, CFG_Partitions 1327 PHSCHCAPTT_CollectLoop: 1328 mov bl, [si+LocIPT_Flags] 1329 test bl, Flags_SpecialMarker 1330 jz PHSCHCAPTT_NoMarker 1331 mov ds:[di], ch ; Write byte-Entry 1332 inc di 1333 xor bl, Flags_SpecialMarker ; Reset Flag 1334 mov [si+LocIPT_Flags], bl 1335 PHSCHCAPTT_NoMarker: 1336 add si, LocIPT_LenOfIPT 1337 inc ch 1338 dec cl 1339 jnz PHSCHCAPTT_CollectLoop 1340 pop si ; Original Hide-Config Pointer -> SI 1341 ; Now check, if we have written anything 1342 cmp si, di 1343 jne PHSCHCAPTT_SomethingToHide 1344 ; Nothing to hide...so UNSET the Hidden-Feature Flag 1345 call PART_GetPartitionPointer ; Holt den Pointer der Partition (DL) nach SI 1346 mov al, [si+LocIPT_Flags] 1347 mov ah, Flags_HideFeature 1348 not ah 1349 and al, ah 1350 mov [si+LocIPT_Flags], al 1351 ret 1352 1353 PHSCHCAPTT_SomethingToHide: 1354 mov ax, si 1355 add ax, LocIPT_MaxPartitions 1356 cmp di, ax 1357 jae PHSCHCAPTT_AllUsed 1358 ; Set END-marker 1359 mov al, 0FFh 1360 stosb ; Write byte-Entry 1361 PHSCHCAPTT_AllUsed: 1362 1363 ; Something to hide...so SET the Hidden-Feature Flag 1364 call PART_GetPartitionPointer ; Holt den Pointer der Partition (DL) nach SI 1365 mov al, [si+LocIPT_Flags] 1366 or al, Flags_HideFeature 1367 mov [si+LocIPT_Flags], al 1368 ret 1349 PARTHIDESETUP_CollectHideConfigAndPutToTable Proc Near Uses ax si es di 1350 ; First calculate, where to put Hide-Config 1351 ;~ mov ax, LocIPT_MaxPartitions 1352 mov ax, LocHPT_LenOfHPT ; Length of an HPT-entry. 1353 mul dl ; Partition to store info for. 1354 push cs 1355 pop es 1356 mov di, offset HidePartitionTable ; Packed hideparttable. 1357 add di, ax ; We got the pointer in DI. 1358 1359 ;~ push di 1360 1361 ; Fill hide-part-table entry with 'unused' marker. 1362 ; Note that the entry is actually an array of 45 6-bit bitfields. 1363 ; Below fills 34 bytes = 45 6-bit bitfields. 1364 push di 1365 mov cx, LocHPT_LenOfHPT 1366 mov al, 0FFh 1367 rep stosb ; Fill up with FFh 1368 pop di 1369 1370 ;~ mov bp,di 1371 1372 ; Now walk through the IPT collecting all SpecialMarkers. 1373 ; For each do a bitfield-entry containing the number of the partition. 1374 mov si, offset PartitionTable 1375 xor ch, ch ; Partition index 1376 mov cl, CFG_Partitions ; Nr. of partitions in IPT 1377 mov ah,0 ; Next hide-index to write. 1378 1379 ; 1380 ; Collect all partitions that have the special marker set. 1381 ; This marker was set by toggling the hide/unhide option in the setup menu. 1382 ; 1383 PHSCHCAPTT_CollectLoop: 1384 1385 ; Get marker and test it. 1386 mov bl, [si+LocIPT_Flags] 1387 test bl, Flags_SpecialMarker 1388 1389 ; No marker. 1390 jz PHSCHCAPTT_NoMarker 1391 1392 ; Setup stuff for bitfield operation. 1393 push dx ; Save partition pointer. 1394 push bx ; Save marker. 1395 mov bx,di ; Get pointer to HPT-entry. 1396 mov dl,ah ; Index in entry. 1397 mov dh,6 ; Bitfield width. 1398 push ax ; Save index. 1399 mov al,ch ; Partition index to store. 1400 1401 1402 IFDEF AUX_DEBUG 1403 pushf 1404 pusha 1405 push ax 1406 mov al,dl 1407 call AuxIO_TeletypeHexByte 1408 mov al,':' 1409 call AuxIO_Teletype 1410 mov ax,bx 1411 call AuxIO_TeletypeHexWord 1412 mov al,':' 1413 call AuxIO_Teletype 1414 mov ax,bp 1415 call AuxIO_TeletypeHexWord 1416 mov al,':' 1417 call AuxIO_Teletype 1418 mov ax,sp 1419 call AuxIO_TeletypeHexWord 1420 mov al,':' 1421 call AuxIO_Teletype 1422 pop ax 1423 call AuxIO_TeletypeHexByte 1424 call AuxIO_TeletypeNL 1425 popa 1426 popf 1427 ENDIF 1428 1429 call CONV_SetBitfieldValue ; Store bitfield. 1430 pop ax ; Restore index. 1431 pop bx ; Restore marker. 1432 pop dx ; Restore partition pointer. 1433 1434 inc ah ; Advance to next index. 1435 1436 ;~ mov ds:[di], ch ; Write byte-Entry 1437 ;~ inc di 1438 xor bl, Flags_SpecialMarker ; Reset Flag 1439 mov [si+LocIPT_Flags], bl ; Store it in IPT 1440 1441 1442 PHSCHCAPTT_NoMarker: 1443 add si, LocIPT_LenOfIPT ; Advance to next partition in IPT. 1444 inc ch ; Next partition-index. 1445 dec cl ; Decrement partitions to process. 1446 jnz PHSCHCAPTT_CollectLoop ; Are we done yet ? 1447 1448 ;~ pop si ; Original Hide-Config Pointer -> SI 1449 ; Now check, if we have written anything 1450 ;~ cmp si, di 1451 test ah,ah ; See if we had to store anything. 1452 jne PHSCHCAPTT_SomethingToHide ; Yep, go to write end-marker. 1453 1454 ; Nothing to hide...so UNSET the Hidden-Feature Flag 1455 call PART_GetPartitionPointer ; Use DL to get part-pointer in SI. 1456 mov al, [si+LocIPT_Flags] ; Get flags. 1457 mov ah, Flags_HideFeature ; Hide mask. 1458 not ah ; Complement. 1459 and al, ah ; Clear hide-flag. 1460 mov [si+LocIPT_Flags], al ; Store it. 1461 ;~ pop bp 1462 ret ; Return to caller. 1463 1464 PHSCHCAPTT_SomethingToHide: 1465 cmp ah, LocIPT_MaxPartitions ; See if index is at end. 1466 jae PHSCHCAPTT_AllUsed ; Yep, no need to store end-marker. 1467 1468 ; Write end-marker. 1469 push dx ; Save partition pointer. 1470 mov al,3fh ; End marker (6-bit) 1471 mov dl,ah ; Index in HPT-entry. 1472 mov dh,6 ; Bitfield width. 1473 mov bx,di ; Get pointer to HPT-entry. 1474 call CONV_SetBitfieldValue ; Store end-marker. 1475 pop dx ; Restore partition pointer. 1476 1477 ;~ mov ax, si 1478 ;~ add ax, LocIPT_MaxPartitions 1479 ;~ cmp di, ax 1480 ;~ jae PHSCHCAPTT_AllUsed 1481 ; Set END-marker 1482 ;~ mov al, 0FFh 1483 ;~ stosb ; Write byte-Entry 1484 PHSCHCAPTT_AllUsed: 1485 1486 ; Something to hide...so SET the Hidden-Feature Flag 1487 call PART_GetPartitionPointer ; Use DL to get part-pointer in SI. 1488 mov al, [si+LocIPT_Flags] ; Get flags. 1489 or al, Flags_HideFeature ; Set hide-flag. 1490 mov [si+LocIPT_Flags], al ; Store it. 1491 ;~ pop bp 1492 ret ; Return to caller. 1369 1493 PARTHIDESETUP_CollectHideConfigAndPutToTable EndP 1370 1494
Note:
See TracChangeset
for help on using the changeset viewer.
