fix: set_mem_size: use right index
This commit is contained in:
parent
3c87632b0c
commit
719c615c92
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user