#include "paging.h" #include "libc/stdio.h" /// Use a bitmap to keep track of allocated pages char pages_status[PAGING_MAX_PAGES/8]; /// Kernel page directory (ATTENTION need to be 4096) u32 k_pd[PAGING_MAX_DIR_ENTRY] __attribute__((aligned(4096))); /// Kernel page table u32 k_pt[PAGING_MAX_DIR_ENTRY][1024] __attribute__((aligned(4096))); void paging_enable(){ // Init pages status for(int i=0;i>j)&0x1; if((i*8+j)>=min){ if((i*8+j)>j)&1; if(state!=1){ int page_id=i*8+j; int page_addr=PAGING_PAGE_SIZE*page_id; paging_set_usage(page_addr,1); return((char*)page_addr); } } } print("Could not allocate anymore pages! Stopping..."); asm("hlt"); } char *paging_allocate(int p){ int *page_dir=(int*)paging_allocate_next_page(); int *page_table; int current_page_entry=0; int current_dir_entry=0; while(current_page_entry