From ce0cfb2e116369ef1e486fd13ab1a863aa6b419b Mon Sep 17 00:00:00 2001 From: pjht Date: Wed, 22 Jul 2020 21:20:50 -0500 Subject: [PATCH] Remove protector pages --- kernel/cpu/i386/paging.c | 22 ---------------------- kernel/cpu/i386/tasking_helpers_c.c | 4 +--- kernel/cpu/paging.h | 2 -- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/kernel/cpu/i386/paging.c b/kernel/cpu/i386/paging.c index fc1d289..72ad3ac 100644 --- a/kernel/cpu/i386/paging.c +++ b/kernel/cpu/i386/paging.c @@ -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;ikernel_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; } diff --git a/kernel/cpu/paging.h b/kernel/cpu/paging.h index 33948a9..0bc35d2 100644 --- a/kernel/cpu/paging.h +++ b/kernel/cpu/paging.h @@ -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