diff --git a/drivers/nvme/nvme.asm b/drivers/nvme/nvme.asm index 10a6970..e7547a9 100644 --- a/drivers/nvme/nvme.asm +++ b/drivers/nvme/nvme.asm @@ -118,13 +118,27 @@ proc add_nvme_disk stdcall, pci:dword push esi mov esi, [pci] + + ; NOTE: If the pcidev.num or pcidev.nsid is more than 9 then + ; this fails to build the string correctly. Ignoring this issue + ; for now since who has more than 9 NVMe SSDs on a desktop computer + ; and a NSID bigger than 9 is also unlikely. + ; + ; Still, will address this problem in the future. push 0 ; null terminator - push dword [esi + pcidev.nsid] - push "n" - push dword [esi + pcidev.num] + movzx eax, byte [esi + pcidev.nsid] + add al, "0" + mov byte [esp], al + dec esp + mov byte [esp], "n" + dec esp + movzx eax, byte [esi + pcidev.num] + add al, "0" + mov byte [esp], al push "nvme" - invoke DiskAdd, disk_functions, esp, [esi + pcidev.nsinfo], 0 - add esp, 20 + mov eax, esp + invoke DiskAdd, disk_functions, eax, [esi + pcidev.nsinfo], 0 + add esp, 10 test eax, eax jz @f invoke DiskMediaChanged, eax, 1