Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MemPhysMarkAddrRange: ;;;void MemPhysMarkAddrRange(eax:baseaddr, ecx:length)
- ;ebx will be my bitmap base
- ;edx will be my subword len
- ;esi is my whatever register
- ;edi is if it's necessary to align the length
- ;eax is the index
- push ebp
- mov ebp, esp
- sub esp, 8
- push ebx
- push edx
- push esi
- push edi
- xor edi, edi
- test ecx, 0xFFF
- jz .no_partial_block
- inc edi
- .no_partial_block:
- shr ecx, 12
- shr eax, 12
- mov ebx, eax
- and ebx, 31
- mov edx, 32
- sub edx, ebx
- cmp ecx, edx
- jge .len_big_enough
- mov edx, ecx
- .len_big_enough:
- sub ecx, edx
- mov esi, 1
- add edx, edi
- shl esi, dl
- dec esi
- shl esi, bl
- shr eax, 5
- or dword [physmem_bitmap + eax * 4], esi
- inc eax
- mov esi, ecx
- shr esi, 5
- add esi, eax
- .fill_loop_top:
- cmp eax, esi
- je .fill_loop_done
- mov dword [physmem_bitmap + eax * 4], 0xFFFFFFFF
- inc eax
- jmp .fill_loop_top
- .fill_loop_done:
- and ecx, 31
- jz .no_remaining_bits
- mov esi, 1
- shl esi, cl
- dec esi
- or dword [physmem_bitmap + eax * 4], esi
- .no_remaining_bits:
- pop edi
- pop esi
- pop edx
- pop ebx
- ret
Add Comment
Please, Sign In to add comment