2020-09-21 13:15:55 +03:00
|
|
|
#ifndef __MM__VMM_H__
|
|
|
|
#define __MM__VMM_H__
|
2020-09-11 11:53:21 +03:00
|
|
|
|
|
|
|
#include <stdint.h>
|
2021-04-14 22:57:23 +03:00
|
|
|
#include <stdbool.h>
|
2020-09-11 11:53:21 +03:00
|
|
|
|
2021-07-15 15:09:12 +03:00
|
|
|
#define VMM_FLAG_PRESENT ((uint64_t)1 << 0)
|
|
|
|
#define VMM_FLAG_WRITE ((uint64_t)1 << 1)
|
|
|
|
#define VMM_FLAG_NOEXEC ((uint64_t)1 << 63)
|
|
|
|
|
2020-09-11 15:09:15 +03:00
|
|
|
typedef struct {
|
|
|
|
int levels;
|
|
|
|
void *top_level;
|
|
|
|
} pagemap_t;
|
2020-09-11 11:53:21 +03:00
|
|
|
|
2022-01-27 02:54:26 +03:00
|
|
|
enum page_size {
|
|
|
|
Size4KiB,
|
2022-01-27 02:59:16 +03:00
|
|
|
Size2MiB,
|
|
|
|
Size1GiB
|
2022-01-27 02:54:26 +03:00
|
|
|
};
|
|
|
|
|
2021-07-15 15:09:12 +03:00
|
|
|
void vmm_assert_nx(void);
|
2020-09-11 15:09:15 +03:00
|
|
|
pagemap_t new_pagemap(int lv);
|
2022-01-27 02:54:26 +03:00
|
|
|
void map_page(pagemap_t pagemap, uint64_t virt_addr, uint64_t phys_addr, uint64_t flags, enum page_size page_size);
|
2020-09-11 11:53:21 +03:00
|
|
|
|
|
|
|
#endif
|