summaryrefslogtreecommitdiff
path: root/include/kernel/mm.h
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-01-03 02:19:57 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-01-03 02:19:57 +0800
commit210025560c80b48af4875af199f183ad709e3bf0 (patch)
treeeb11aeb7b641187f207e3b572c5184cf3526b463 /include/kernel/mm.h
parentbde87490d61135dcaa94d9b1489ff6c39876d169 (diff)
parent10614e04929a6d109a5e90524e446b637aaf0c13 (diff)
downloadlume-210025560c80b48af4875af199f183ad709e3bf0.tar.gz
lume-210025560c80b48af4875af199f183ad709e3bf0.tar.xz
Merge pull request #4 from Richard-Qin-001/dev/shell
Rebuilt the system's underlying structure; it is now stable enough to merge. The system now supports a read-only file system and has a simple shell implemented.
Diffstat (limited to 'include/kernel/mm.h')
-rw-r--r--include/kernel/mm.h31
1 files changed, 18 insertions, 13 deletions
diff --git a/include/kernel/mm.h b/include/kernel/mm.h
index 07d675b..3b59edb 100644
--- a/include/kernel/mm.h
+++ b/include/kernel/mm.h
@@ -3,20 +3,25 @@
namespace VM
{
- typedef uint64_t *pagetable_t;
- typedef uint64_t pte_t;
+ extern uint64 *kernel_pagetable;
- pte_t *walk(pagetable_t pagetable, uint64 va, int alloc);
- int mappages(pagetable_t pagetable, uint64 va, uint64 size, uint64 pa, int perm);
- void kvmmap(uint64 va, uint64 pa, uint64 sz, int perm);
void kvminit();
void kvminithart();
- pagetable_t uvmcreate();
- void uvminit(pagetable_t pagetable, uchar *src, uint sz);
- void uvmunmap(pagetable_t pagetable, uint64 va, uint64 npages, int do_free);
- void uvmfree(pagetable_t pagetable, uint64 sz);
- int uvmcopy(pagetable_t oldpt, pagetable_t newpt, uint64 sz);
- uint64 uvmalloc(pagetable_t pagetable, uint64 oldsz, uint64 newsz);
- uint64 uvmdealloc(pagetable_t pagetable, uint64 oldsz, uint64 newsz);
- int copyin(pagetable_t pagetable, char *dst, uint64 srcva, uint64 len);
+
+ uint64 *uvmcreate();
+ void uvminit(uint64 *pagetable, uchar *src, uint64 sz);
+ uint64 uvmalloc(uint64 *pagetable, uint64 oldsz, uint64 newsz, int xperm);
+ uint64 uvmdealloc(uint64 *pagetable, uint64 oldsz, uint64 newsz);
+ void uvmfree(uint64 *pagetable, uint64 sz);
+ int uvmcopy(uint64 *oldpt, uint64 *newpt, uint64 sz);
+ void uvmunmap(uint64 *pagetable, uint64 va, uint64 npages, int do_free);
+
+ int copyout(uint64 *pagetable, uint64 dstva, char *src, uint64 len);
+ int copyin(uint64 *pagetable, char *dst, uint64 srcva, uint64 len);
+ int copyinstr(uint64 *pagetable, char *dst, uint64 srcva, uint64 max);
+
+ int handle_cow_fault(uint64 *pagetable, uint64 va);
+ int mappages(uint64 *pagetable, uint64 va, uint64 size, uint64 pa, int perm);
+
+ uint64 walkaddr(uint64 *pagetable, uint64 va);
} \ No newline at end of file