Fixed pmmap_size

This commit is contained in:
lucic71 2022-06-28 19:40:51 +03:00
parent b282cc9872
commit d49e750c18
2 changed files with 5 additions and 5 deletions

View File

@ -1,9 +1,9 @@
#ifndef PMM_INTERNALS_H_
#define PMM_INTERNALS_H_
#define BLOCKS_PER_BYTE 8
#define BLOCK_SIZE 4096
#define BLOCK_ALIGN BLOCK_SIZE
#define BLOCKS_PER_DWORD 32
#define BLOCK_SIZE 4096
#define BLOCK_ALIGN BLOCK_SIZE
/* Macros for testing and aligning memory. */

View File

@ -24,8 +24,8 @@ void pmm_init(uint32_t pmmap_addr, size_t size) {
used_blocks = max_blocks;
pmmap = (uint32_t *) pmmap_addr;
pmmap_size = mem_size / BLOCKS_PER_BYTE;
if (mem_size % BLOCKS_PER_BYTE)
pmmap_size = max_blocks / BLOCKS_PER_DWORD;
if (max_blocks % BLOCKS_PER_DWORD)
pmmap_size++;
memset(pmmap, 0xFF, pmmap_size);