From 719c615c9248869bb9fc994829a269faee0e886a Mon Sep 17 00:00:00 2001 From: Starnakin Date: Fri, 8 Nov 2024 13:15:15 +0100 Subject: [PATCH] fix: set_mem_size: use right index --- src/set_mem_size.s | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/set_mem_size.s b/src/set_mem_size.s index dcd4c42..06a5d18 100644 --- a/src/set_mem_size.s +++ b/src/set_mem_size.s @@ -4,24 +4,25 @@ .global set_mem_size set_mem_size: - xor ebx, ebx + jmp end_mem + xor ebx, ebx // i = 0 .L1: // loop condition - cmp ebx, [eax + 64] + cmp ebx, [eax + 44] // mbd->mmap_length jge end_mem // declare mmmt - mov ecx, [eax + 68] - add ecx, ebx + mov ecx, [eax + 48] // mbd->mmap_addr + add ecx, ebx // + i // check if the mmmt->type is available (1) - cmp DWORD PTR [ecx + 20], 1 + mov edx, [ecx + 20] + cmp edx, 1 jne .L2 + // add the size of the block - mov edx, [ecx + 12] - add DWORD PTR mem_size, edx - mov edx, [ecx + 16] - add DWORD PTR mem_size + 4, edx + mov edx, [ecx + 0] // mmmt->size + add mem_size, edx .L2: - add ebx, 24 + add ebx, 24 // i += sizeof(multiboot_memory_map_t) jmp .L1