From 28d3407af5d681b6bd37f6a4c820181a7c5bf84f Mon Sep 17 00:00:00 2001 From: sbosse Date: Mon, 14 Oct 2024 23:07:25 +0200 Subject: [PATCH] Mon 14 Oct 23:06:38 CEST 2024 --- kernel/pagetable.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 kernel/pagetable.h diff --git a/kernel/pagetable.h b/kernel/pagetable.h new file mode 100644 index 0000000..e817b23 --- /dev/null +++ b/kernel/pagetable.h @@ -0,0 +1,34 @@ +/* +Copyright (C) 2015-2019 The University of Notre Dame +This software is distributed under the GNU General Public License. +See the file LICENSE for details. +*/ + +#ifndef PAGETABLE_H +#define PAGETABLE_H + +#define PAGE_SIZE 4096 + +#define PAGE_FLAG_USER 0 +#define PAGE_FLAG_KERNEL 1 +#define PAGE_FLAG_EXISTS 0 +#define PAGE_FLAG_ALLOC 2 +#define PAGE_FLAG_READONLY 0 +#define PAGE_FLAG_READWRITE 4 +#define PAGE_FLAG_NOCLEAR 0 +#define PAGE_FLAG_CLEAR 8 + +struct pagetable *pagetable_create(); +void pagetable_init(struct pagetable *p); +int pagetable_map(struct pagetable *p, unsigned vaddr, unsigned paddr, int flags); +int pagetable_getmap(struct pagetable *p, unsigned vaddr, unsigned *paddr, int *flags); +void pagetable_unmap(struct pagetable *p, unsigned vaddr); +void pagetable_alloc(struct pagetable *p, unsigned vaddr, unsigned length, int flags); +void pagetable_free(struct pagetable *p, unsigned vaddr, unsigned length); +void pagetable_delete(struct pagetable *p); +struct pagetable *pagetable_duplicate(struct pagetable *p); +struct pagetable *pagetable_load(struct pagetable *p); +void pagetable_enable(); +void pagetable_refresh(); + +#endif