Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct vmem_context vmem_create_context() {
- //struct vmem_context context = pmem_alloc();
- struct vmem_context context;
- int i;
- kprintf("Allocating kernel context ... ");
- context.page_directory = pmem_alloc();
- kprintf("[OK]\n");
- for(i = 0; i < 1024; i++) {
- context.page_directory[i] = 0;
- }
- context.page_directory[1023] = (uint32_t) context.page_directory | PTE_VALID | PTE_WRITE | PTE_USER;
- return context;
- }
- void* vmem_alloc() {
- uint32_t* ptr = pmem_alloc();
- kprintf("Mapping user\n");
- vmem_map_page(kernel_context, ptr,ptr, PTE_VALID | PTE_WRITE | PTE_USER);
- kprintf("User alloc \n");
- return (void*) ptr;
- }
Advertisement
Add Comment
Please, Sign In to add comment