not working
This commit is contained in:
56
kernel/memory/pagetable.h
Normal file
56
kernel/memory/pagetable.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#ifndef _PAGETABLE_H_
|
||||
#define _PAGETABLE_H_
|
||||
|
||||
#include "../types.h"
|
||||
|
||||
typedef struct {
|
||||
uint8_t present:1 = 0;
|
||||
uint8_t write:1 = 0;
|
||||
uint8_t user:1 = 0;
|
||||
uint8_t pwt:1 = 0;
|
||||
uint8_t cache_disable:1 = 0;
|
||||
uint8_t accessed:1 = 0;
|
||||
uint8_t dirty:1 = 0;
|
||||
uint8_t pat:1 = 0;
|
||||
uint8_t rsvd_0:4 = 0;
|
||||
uint64_t address:39 = 0;
|
||||
uint16_t rsvd_1:10 = 0;
|
||||
uint8_t execute_disable:1 = 0;
|
||||
} pagetable_entry_t;
|
||||
|
||||
typedef struct {
|
||||
pagetable_entry_t entries[512];
|
||||
} pagetable_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t present:1 = 0;
|
||||
uint8_t write:1 = 0;
|
||||
uint8_t user:1 = 0;
|
||||
uint8_t pwt:1 = 0;
|
||||
uint8_t cache_disable:1 = 0;
|
||||
uint8_t accessed:1 = 0;
|
||||
uint8_t rsvd_0:6 = 0;
|
||||
uint64_t address:39 = 0;
|
||||
uint16_t rsvd_1:10 = 0;
|
||||
uint8_t execute_disable:1 = 0;
|
||||
} pagedirectory_entry_t;
|
||||
|
||||
typedef struct {
|
||||
alignas(4096) pagedirectory_entry_t l4;
|
||||
alignas(4096) pagedirectory_entry_t l3;
|
||||
alignas(4096) pagedirectory_entry_t l2[1];
|
||||
alignas(4096) pagetable_t l1[1];
|
||||
} four_lvl_paging_t;
|
||||
|
||||
void create_basic_page_table(uintptr_t base);
|
||||
void load_cr3( void* cr3_value );
|
||||
|
||||
//typedef struct {
|
||||
// same
|
||||
//} pagedirectory_pointertable_entry_t;
|
||||
|
||||
//typedef struct {
|
||||
// same
|
||||
//} PML4_entry_t;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user