Changeset 101
- Timestamp:
- Apr 8, 2017, 12:26:55 AM (8 years ago)
- Location:
- trunk/bootcode
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bootcode/regular/other.asm
r95 r101 562 562 ret 563 563 MBR_TeletypeSyncPos EndP 564 565 ; Check if a memory block is all zeros 566 ; IN : BX pointer to memblock 567 ; CX length to check, zero length is interpreted as block is zero 568 ; OUT : ZF=1 block if all zeros 569 ; NOTE: Segment used is DS, which should be the same as ES 570 IsMemBlockZero Proc Near Uses ax di 571 push es ; Save ES just to be sure 572 push ds ; Segment to use 573 pop es ; Pop in ES because ES is required for scasb 574 mov di, bx ; Pointer to memblock 575 xor al, al ; Compare to zero 576 repe scasb ; Scan the block, will leave ZF=1 if all zeros 577 mov bx, di ; Update pointer (points past last byte compared) 578 pop es ; Restore ES 579 ret 580 IsMemBlockZero EndP 581 582 ; Check if a loaded sector is all zeros 583 ; IN : BX pointer to memblock 584 ; OUT : ZF=1 block if all zeros 585 ; NOTE: Segment used is DS, which should be the same as ES 586 IsSectorZero Proc Near Uses cx 587 mov cx, sector_size ; Normal size of a sector (512 bytes) 588 call IsMemBlockZero ; Check the memory block 589 ret 590 IsSectorZero EndP -
trunk/bootcode/special/lvm.asm
r100 r101 112 112 ; Out: Carry set, if LVM CRC valid 113 113 ; Destroyed: None 114 LVM_CheckSectorCRC Proc Near Uses ax dx 115 call LVM_GetSectorCRC 114 LVM_CheckSectorCRC Proc Near Uses ax bx dx 115 mov bx, si 116 call IsSectorZero ; Zero sector implies bad CRC 117 jz LVMCSCRC_BadCRC 118 call LVM_GetSectorCRC ; Only use after CRC table is valid 116 119 cmp ax, word ptr [si+LocLVM_CRC] 117 120 jne LVMCSCRC_BadCRC 118 121 cmp dx, word ptr [si+LocLVM_CRC+2] 119 122 jne LVMCSCRC_BadCRC 120 stc 123 stc ; Indicate CRC is OK 121 124 ret 122 125 LVMCSCRC_BadCRC: 123 clc 126 clc ; Indicate BAD CRC 124 127 ret 125 128 LVM_CheckSectorCRC EndP
Note:
See TracChangeset
for help on using the changeset viewer.