summaryrefslogblamecommitdiffstats
path: root/include/arch/x86_64/page.h
blob: cbbf642f7ed241b43ba6d89113996f73db7a5c03 (plain) (tree)
1
2
3
4
5
6
7
8

                             

                   

                          
 
                                      


















                                                                
                                 
 









                                                  
      
#ifndef _JOVE_x86_64_PAGE_H
#define _JOVE_x86_64_PAGE_H 1

#include <stdint.h>
#include "klib/spinlock.h"
#include "assert.h"

typedef union page_mapping_level_entry
{
    struct {
        uint8_t p : 1; /* Present */
        uint8_t rw : 1; /* Read/write. 0 for RO.*/
        uint8_t us : 1; /* User/supervisor. 0 for DPL3 forbid */
        uint8_t pwt : 1;
        uint8_t pcd : 1;
        uint8_t a : 1; /* Accessed */
        uint8_t d : 1; /* Dirty */
        uint8_t ps_pat : 1;
        uint8_t g : 1; /* Global */
        uint8_t _r0 : 2;
        uint8_t r : 1;
        uint64_t paddr : 35;
        uint8_t _r1;
        uint8_t pk : 4;
        uint8_t xd : 1;
    }__attribute__((packed));
    uint64_t value;
} __attribute__((packed)) pmle_t;

typedef struct page_directory
{
    spinlock_t lock;
    intmax_t id;
    uintptr_t phys;
    pmle_t *pml;
} page_directory_t;

#define _kernel_virtual_base 0xFFFFFFFF80000000ULL

#endif