Hi. I have some problem with vmmngr. See, it has vmmngr_alloc_page(). This function returns address of allocated memory. But actually it doesn't work properly. First of all: if you try to allocate page it returns addresses below first 4MB (because pmmngr_alloc_block() returns such). And doing this: (*(uint32_t*)0x1000) = 0x123456; givess no page fault if my page is allocated and pt_entry = 0x18FF (address 0x1000 + attributes.); But even if I do not alloc page I can write to that address. The reason of it is that we allocated first 4MB in our bootloader. But if I try to allocate page at address 0x400000 I do the next:
Code: Select all
pt_entry e;
void * p = (void *)0x400000;
pt_entry_set_frame (&e, (physical_addr)p);
pt_entry_add_attrib (&e, I86_PTE_PRESENT);
and then I try to do the next:
Code: Select all
(*(uint32_t*)0x400000) = 0x123456;
What I'ge got? General Protection Fault. I see that GPF is like a page fault, because if I try to write to non-allocated address I get no PF - I get GPF.
So, next I tried to do the next:
Code: Select all
extern pdirectory * _cur_directory;
(*(uint32_t*)(_cur_directory + 4*0x400000/0x1000)) = e; // this I do if I know exactly the number of page.
vmmngr_switch_directory(_cur_directory);
What I've got? GPF again.
But If I do not modify _cur_directory and do just
Code: Select all
vmmngr_switch_directory(_cur_directory);
I got no GPF.
So, what is wrong in my tryings or maybe in vmmngr?
Daniel.
Thinking of great - thinking of little, thinking of little - thinking of great.