summaryrefslogtreecommitdiffstats
path: root/include/arch/page.h
blob: 25c5294390ad623cc9ab54b6f7a47a9f776f4909 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef _JOVE_ARCH_PAGE_H
#define _JOVE_ARCH_PAGE_H 1

#define PAGE_SHIFT (12)
#define PAGE_SIZE (1 << PAGE_SHIFT)
#define PAGE_MASK (PAGE_SIZE - 1)

#ifdef __x86_64__
#include "x86_64/page.h"
#endif

typedef struct page_mapping_flags
{
    char present : 1;
    char writeable : 1;
    char useraccess : 1;
    char executable : 1;
} page_flags_t;

typedef struct page_mapping
{
    uintptr_t phys;
    page_flags_t pf;
} page_mapping_t;

typedef intmax_t pdid_t;

page_directory_t *pd_new(void);
page_directory_t *pd_dup(page_directory_t *pd);
page_directory_t *pd_get(pdid_t id);

void pd_switch(page_directory_t *pd);

#endif