I'm working in my bitmap physical memory manager. I could detect the available memory region to write in. But when I want to set all the bits to 1 in the initialization, the kernel freezes and nothing happens. I think I'm writing to kernel regions but I'm not sure cuz I don't know how to get the kernel offset and length.
Any help would be appreciated
Edit:
I use qemu and it says:
!new_block->iTrying to execute code outside RAM or ROM at 0x303078cc
This a part of the code I use for initializing the pmm:
Code: Select all
static uint32_t
_mem_size = 0,
_mem_used_blocks = 0,
_mem_max_blocks = 0,
*_mem_map = 0;
static uint32_t
_mem_usable_off = 0,
_mem_usable_len = 0;
static void _pmm_find_available_memory(memory_map *mmap)
{
uint32_t a = 0, b = 0;
for (uint16_t i = 0; ; i++)
{
if (mmap[i].base_addr_low == 0 && i > 0)
break;
if (mmap[i].type == 1)
if (mmap[i].length_low > a)
{
a = mmap[i].length_low;
b = i;
}
}
_mem_usable_len = a;
_mem_usable_off = mmap[b].base_addr_low;
}
void pmm_initialize(memory_map *mmap)
{
_pmm_find_available_memory(mmap);
_mem_size = _mem_usable_len;
_mem_map = (uint32_t*)_mem_usable_off;
_mem_max_blocks = _mem_size / PMM_BLOCK_SIZE;
_mem_used_blocks = _mem_max_blocks;
printf("\n\t* Memory size %i Bytes", _mem_size);
for (uint32_t i = 0; i < 1000; i++) // I used 1000 only for testing
_mem_map[i] = 0xffffffff;
}