From a1639a3b9b4bb8871f9eca46b74d7c8a353b245c Mon Sep 17 00:00:00 2001 From: Abdur-Rahman Mansoor Date: Fri, 12 Jul 2024 15:38:45 -0400 Subject: [PATCH] more fixes in alloc_dptr --- drivers/nvme/nvme.asm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/nvme/nvme.asm b/drivers/nvme/nvme.asm index 90b0c53..0d17d18 100644 --- a/drivers/nvme/nvme.asm +++ b/drivers/nvme/nvme.asm @@ -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