Browse Source

flags 32bit -> 64bit: support XD

master
Mathieu Serandour 1 year ago
parent
commit
1be7784fbb
  1. 4
      kernel/memory/paging.c
  2. 12
      kernel/memory/paging.h

4
kernel/memory/paging.c

@ -100,7 +100,7 @@ static uint32_t pml4_offset(uint64_t virt) {
// PWT: page level write-through
// PCD: page level cache disable
static void* create_table_entry(void* entry, unsigned flags) {
static void* create_table_entry(void* entry, uint64_t flags) {
assert_aligned(entry, 0x1000);
return (void*)(flags |
@ -434,7 +434,7 @@ static void* get_entry_or_allocate(void** restrict table, unsigned index) {
void map_pages(uint64_t physical_addr,
uint64_t virtual_addr,
size_t count,
unsigned flags) {
uint64_t flags) {
while(count > 0) {
// fetch table indexes

12
kernel/memory/paging.h

@ -21,13 +21,13 @@ void append_paging_initialization(void);
// the entry is present
#define PRESENT_ENTRY 1llu
// read only
#define PL_RW 2
#define PL_RW 2llu
// supervisor only
#define PL_US 4
#define PL_US 4llu
// page level write through
#define PWT 8
#define PWT 8llu
// page level cache disable
#define PCD 16
#define PCD 16llu
#define PL_XD (1llu << 63)
/**
@ -44,8 +44,8 @@ void append_paging_initialization(void);
void map_pages(uint64_t physical_addr,
uint64_t virtual_addr,
size_t count,
unsigned flags);
uint64_t flags);
void alloc_pages(void* virtual_addr,
size_t count,
unsigned flags);
uint64_t flags);

Loading…
Cancel
Save