mirror of
https://git.missingno.dev/kolibrios-nvme-driver/
synced 2024-12-22 05:48:47 +01:00
fix: running LOADDRV on NVMe driver more than once (#2)
Credits to @Burer for finding this bug, and @Doczom for providing a solution.
This commit is contained in:
parent
867a675261
commit
aa0a75e715
@ -526,6 +526,16 @@ proc detect_nvme
|
||||
ret
|
||||
|
||||
.found_dev:
|
||||
; skip PCIDEV.owner check if the PCI device pointer has already been
|
||||
; allocated (without this check, more than 1 NVMe device cannot be
|
||||
; registered)
|
||||
mov eax, dword [p_nvme_devices]
|
||||
test eax, eax
|
||||
jnz @f
|
||||
cmp dword [esi + PCIDEV.owner], 0
|
||||
jnz .err
|
||||
|
||||
@@:
|
||||
PDEBUGF DBG_INFO, "PCI(%u.%u.%u): Detected NVMe device...\n", [esi + PCIDEV.bus], [esi + PCIDEV.devfn]
|
||||
cmp dword [pcidevs_len], TOTAL_PCIDEVS
|
||||
jne @f
|
||||
@ -538,8 +548,9 @@ proc detect_nvme
|
||||
jnz @f ; was the pointer already allocated?
|
||||
invoke KernelAlloc, sizeof.pcidev * TOTAL_PCIDEVS
|
||||
test eax, eax
|
||||
jz .err_no_mem
|
||||
jz .err
|
||||
mov dword [p_nvme_devices], eax
|
||||
mov dword [esi + PCIDEV.owner], eax
|
||||
|
||||
@@:
|
||||
mov ecx, dword [pcidevs_len]
|
||||
@ -557,7 +568,7 @@ proc detect_nvme
|
||||
|
||||
jmp .next_dev
|
||||
|
||||
.err_no_mem:
|
||||
.err:
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
@ -1337,7 +1348,7 @@ endp
|
||||
align 4
|
||||
p_nvme_devices dd 0
|
||||
pcidevs_len dd 0
|
||||
my_service db "NVMe",0 ;max 16 chars include zero
|
||||
my_service db "nvme",0 ;max 16 chars include zero
|
||||
disk_functions:
|
||||
dd disk_functions.end - disk_functions
|
||||
dd 0 ; no close function
|
||||
|
Loading…
Reference in New Issue
Block a user