Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I am making a unalloc for my memory manager so i needed a unset bit
so well i did this
I'm wondering if my unset bit and also my memory unallocation code is right
because according to my tests they are not
void FreeCore(void *page_ptr,unsigned int num_pages){
unsigned int index;unsigned int page=page_ptr;
page=page/4096; //convert the address to a page number
num_pages+=page;
while(num_pages<page){
index=page/32; //get what the index for pages is
pages[index]=pages[index]&(0xFFFFFFFF^(1<<(page%32))); //CHECK HERE;unset the bit
page++;
}
}
void FreeCore(void *page_ptr,unsigned int num_pages){
unsigned int index;
unsigned int start_page;
unsigned int page=page_ptr;
start_page=page=page/4096; //convert the address to a page number
while(page < start_page + num_pages){
index=page/32; //get what the index for pages is
pages[index]=pages[index]&(0xFFFFFFFF^(1<<(page%32))); //CHECK HERE;unset the bit
page++;
}
}