aboutsummaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-02-29 21:55:23 -0500
committerIan Moffett <ian@osmora.org>2024-02-29 21:55:23 -0500
commit31aa84528af5a92c3019e6abaa949eb20a4e73d9 (patch)
treef65288c97f2d965ddb785f47b80403454caaaaec /sys/arch
parent4e5226d3f399db93627538f224f42b3637edf223 (diff)
kernel/amd64: pmap: Add routine to switch vas
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/pmap.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c
index 5fe1e3b..e898e74 100644
--- a/sys/arch/amd64/amd64/pmap.c
+++ b/sys/arch/amd64/amd64/pmap.c
@@ -215,6 +215,17 @@ pmap_create_vas(struct vm_ctx *ctx)
return new_vas;
}
+void
+pmap_switch_vas(struct vm_ctx *ctx, struct vas vas)
+{
+ uintptr_t cr3_val = vas.cr3_flags | vas.top_level;
+
+ __ASMV("mov %0, %%cr3"
+ :
+ : "r" (cr3_val)
+ : "memory");
+}
+
struct vas
pmap_read_vas(void)
{