Remove protector pages

This commit is contained in:
pjht 2020-07-22 21:20:50 -05:00
parent 51a4007bba
commit ce0cfb2e11
3 changed files with 1 additions and 27 deletions

View File

@ -211,28 +211,6 @@ void unmap_pages(void* start_virt,uint32_t num_pages) {
}
}
char make_protector(int page) {
int table=page>>10;
if (is_page_present(page)) return 0;
page=page&0x3FF;
smap_page_tables[table+1]=(smap[table]&0xFFFFFC00)|0x3;
uint32_t page_val=smap[(1024+(1024*table))+page];
page_val=page_val&(~0x6);
page_val=page_val|0x800;
smap[(1024+(1024*table))+page]=page_val;
return 1;
}
char is_in_protector(void* addr) {
int page=((uint32_t)addr)>>12;
if (is_page_present(page)) return 0;
int table=page>>10;
page=page&0x3FF;
smap_page_tables[table+1]=(smap[table]&0xFFFFFC00)|0x3;
return smap[(1024+(1024*table))+page]&0x800;
return 1;
}
void paging_init() {
for (uint32_t i=0;i<NUM_KERN_FRAMES;i++) {
kern_page_tables[i]=(i<<12)|0x3;

View File

@ -17,13 +17,11 @@ void setup_kstack(Thread* thread,uint32_t param1,uint32_t param2,char kmode,void
uint32_t top_idx=(1024*(kstack_num+1));
thread->kernel_esp=((uint32_t)(&kstacks[top_idx-7]));
thread->kernel_esp_top=thread->kernel_esp;
kstacks[top_idx-3]=(uint32_t)task_init;
uint32_t* user_stack=(uint32_t*)(((uint32_t)alloc_pages(2))+0x2000);
int buffer_pg_num=(((uint32_t)user_stack)-0x2000)>>12;
make_protector(buffer_pg_num);
user_stack-=2;
user_stack[0]=param1;
user_stack[1]=param2;
kstacks[top_idx-3]=(uint32_t)task_init;
kstacks[top_idx-2]=(uint32_t)user_stack;
kstacks[top_idx-1]=(uint32_t)eip;
}

View File

@ -15,8 +15,6 @@ void load_address_space(void* cr3);
void* virt_to_phys(void* virt_addr);
void* find_free_pages(int num_pages);
void load_smap(void* cr3);
char make_protector(int page);
char is_in_protector(void* addr);
void* get_cr3();
#endif