Added macro for converting KB to blocks

This commit is contained in:
lucic71 2022-06-28 19:40:51 +03:00
parent 585fe5b9cb
commit 5103ee5ede
2 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,10 @@
#define IS_ALIGNED(addr, align) !((addr) & ~((align) - 1))
#define ALIGN(addr, align) (((addr) & ~((align) - 1)) + (align))
/* Macros for converting between units of measure. */
#define KB_TO_BLOCKS(x) (((x) * 1024) / BLOCK_SIZE)
/*
* Internal variables:
*

View File

@ -20,7 +20,7 @@
void pmm_init(uint32_t pmmap_addr, size_t size) {
mem_size = size;
max_blocks = (mem_size * 1024) / BLOCK_SIZE;
max_blocks = KB_TO_BLOCKS(mem_size);
used_blocks = max_blocks;
pmmap = (uint32_t *) pmmap_addr;