From 3d95901b653c57571600a8fa263c4dbf840afce5 Mon Sep 17 00:00:00 2001 From: Abdur-Rahman Mansoor Date: Mon, 26 Aug 2024 17:19:26 -0400 Subject: [PATCH] fix: allocate correct number of PRPs for PRP list --- drivers/nvme/nvme.asm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/nvme.asm b/drivers/nvme/nvme.asm index 7de2678..0c88d7a 100644 --- a/drivers/nvme/nvme.asm +++ b/drivers/nvme/nvme.asm @@ -325,7 +325,7 @@ proc build_prp_list stdcall, nprps:dword, buf:dword, prp_list_ptr:dword mov eax, esi invoke GetPhysAddr mov dword [edi + ecx * 8], eax - mov dword [edi + ecx * 8 - 4], 0 + mov dword [edi + ecx * 8 + 4], 0 add esi, PAGE_SIZE inc ecx cmp ecx, ebx @@ -416,6 +416,11 @@ proc alloc_dptr stdcall, ns:dword, prps_ptr:dword, numsectors:dword, prp_list_pt mov eax, [numsectors] xor edx, edx div ecx + test [buf], PAGE_SIZE - 1 + jz @f + inc eax + +@@: stdcall build_prp_list, eax, ebx, [prp_list_ptr] test eax, eax jz .err