nvme_disk: Correct get_memory_map invocation.

Passing "1" as the bytes argument instead of "0" means that
get_memory_map would never return an error in the case that
one physical_entry was not enough for the vaddr's map.

This reveals the true cause of the disk corruptions:
libnvme is assuming some of the passed buffers are
physically contiguous, and they are not.
This commit is contained in:
Augustin Cavalier 2020-04-21 00:41:57 -04:00
parent 21b312b61e
commit d4304f4384

View File

@ -81,10 +81,10 @@ phys_addr_t
nvme_mem_vtophys(void* vaddr)
{
physical_entry entry;
status_t status = get_memory_map((void*)vaddr, 1, &entry, 1);
status_t status = get_memory_map((void*)vaddr, 0, &entry, 1);
if (status != B_OK) {
panic("nvme: get_memory_map failed for %p, error %08" B_PRIx32 "\n",
(void*)vaddr, status);
panic("nvme: get_memory_map failed for %p: %s\n",
(void*)vaddr, strerror(status));
return NVME_VTOPHYS_ERROR;
}