2
0
mirror of https://git.missingno.dev/kolibrios-nvme-driver/ synced 2024-11-10 02:20:27 +01:00

more fixes in alloc_dptr

This commit is contained in:
Abdur-Rahman Mansoor 2024-07-12 15:38:45 -04:00
parent 48fef9b8d7
commit a1639a3b9b

View File

@ -559,7 +559,8 @@ proc alloc_dptr stdcall, ns:dword, prps_ptr:dword, numsectors:dword, prp_list_pt
mov eax, [buf]
invoke GetPhysAddr
mov dword [edi], eax
mov eax, [numsectors]
mov edx, [numsectors]
mov eax, edx
mov [numsectors], 0
cmp eax, dword [esi + NSINFO.pg_sectors]
jbe @f
@ -569,7 +570,6 @@ proc alloc_dptr stdcall, ns:dword, prps_ptr:dword, numsectors:dword, prp_list_pt
@@:
mov esi, [ns]
mov edx, [numsectors]
mov eax, dword [esi + NSINFO.pg_sectors]
; is the buffer offset portion equal to 0?
@ -583,9 +583,9 @@ proc alloc_dptr stdcall, ns:dword, prps_ptr:dword, numsectors:dword, prp_list_pt
shl eax, 1 ; it is page aligned, so set eax to 2 memory pages
@@:
; is the number of sectors greater than to one or two memory pages?
; is the number of sectors greater than one or two memory pages?
cmp edx, eax
jae .build_prp_list
ja .build_prp_list
; set PRP2
mov eax, dword [edi]
@ -607,7 +607,7 @@ proc alloc_dptr stdcall, ns:dword, prps_ptr:dword, numsectors:dword, prp_list_pt
@@:
mov edx, dword [edi]
and edx, PAGE_SIZE - 1
and edx, not (PAGE_SIZE - 1)
add edx, PAGE_SIZE
stdcall build_prp_list, eax, edx, [prp_list_ptr]
test eax, eax