Newer
Older
tree-os / src / include / paging.h
#ifndef PAGING_H
#define PAGING_H

#include <stdint.h>
typedef struct {
    uint32_t present : 1;
    uint32_t writable : 1;
    uint32_t belongsToUserProcess : 1;
    uint32_t writeThrough : 1;
    uint32_t isVolatile : 1; // disables the cpu cache
    uint32_t accessed : 1;
    uint32_t reserved : 1;
    uint32_t is4MBPage : 1; // always set to 0 for now, more work needed for 4MB
                            // pages (different structure,...)
    uint32_t global : 1;
    uint32_t available : 3;
    uint32_t pageId : 20;
} PagePointer;

typedef struct {
    uint32_t present : 1;
    uint32_t writable : 1;
    uint32_t belongsToUserProcess : 1;
    uint32_t reserved : 2;
    uint32_t accessed : 1;
    uint32_t dirty : 1;
    uint32_t reserved2 : 2;
    uint32_t available : 3;
    uint32_t pagePointerAddress : 20;
} PageTablePointer;

extern void freePage(void *page);
extern void *getPage();
extern void initializePaging();
extern void markMMIO(void *address);

#endif