From ae0ef5c85d8a9cc9230abee0133031a9c97d1327 Mon Sep 17 00:00:00 2001 From: antifallobst Date: Tue, 6 Jun 2023 22:27:43 +0200 Subject: [PATCH] fix (hashmaps): fixed bug that caused PFs and GPFs while handling collisions --- ramdisk/noxos.json | 5 ++--- src/utils/hashmap.c | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ramdisk/noxos.json b/ramdisk/noxos.json index 7a53b37..bda6cf1 100644 --- a/ramdisk/noxos.json +++ b/ramdisk/noxos.json @@ -1,10 +1,9 @@ { "PS2_ACPI_VALIDATION": true, - "LOG_GRAPHICAL": false, + "LOG_GRAPHICAL": true, "drivers": [ "/initrd/drv/test.nxkm", "/initrd/drv/nx_std_fat32.nxkm" - ], - "test": 1 + ] } \ No newline at end of file diff --git a/src/utils/hashmap.c b/src/utils/hashmap.c index 3ff85e4..f5ba412 100644 --- a/src/utils/hashmap.c +++ b/src/utils/hashmap.c @@ -37,10 +37,13 @@ void hashmap_insert(hashmap_T* hashmap, uint64_t key, void* value) { } hashmap_entry_T* entry = &hashmap->entries[index]; - while (entry->next != NULL) entry = entry->next; + while (entry->next != NULL) { + entry = entry->next; + } entry->next = memory_allocate(sizeof(hashmap_entry_T)); entry->next->prev = entry; + entry->next->next = NULL; entry->next->key = key; entry->next->value = value; entry->next->in_use = true;