Use get_blocks_from_size instead of +1
This commit is contained in:
parent
0d10c98477
commit
766804b3a0
@ -69,7 +69,7 @@ namespace MemoryManager
|
|||||||
// We store our frame bitmap at the beginning of the largest free memory block.
|
// We store our frame bitmap at the beginning of the largest free memory block.
|
||||||
char* frame_bitmap_addr = (char*)largest_free.ptr;
|
char* frame_bitmap_addr = (char*)largest_free.ptr;
|
||||||
|
|
||||||
usize frame_bitmap_size = physical_address_space_size / ARCH_PAGE_SIZE / 8 + 1;
|
usize frame_bitmap_size = get_blocks_from_size(physical_address_space_size / ARCH_PAGE_SIZE, 8UL);
|
||||||
|
|
||||||
// This should never happen, unless memory is very fragmented. Usually there is always a very big block of
|
// This should never happen, unless memory is very fragmented. Usually there is always a very big block of
|
||||||
// usable memory and then some tiny blocks around it.
|
// usable memory and then some tiny blocks around it.
|
||||||
@ -96,7 +96,8 @@ namespace MemoryManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock_frames((u64)frame_bitmap_addr, frame_bitmap_size / ARCH_PAGE_SIZE + 1);
|
// Make sure that the physical frames used by the bitmap aren't handed out to anyone else.
|
||||||
|
lock_frames(largest_free.ptr, get_blocks_from_size(frame_bitmap_size, ARCH_PAGE_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
|
Loading…
Reference in New Issue
Block a user