]> pd.if.org Git - zos/commitdiff
low level assembly for amd64 memory
authorNathan Wagner <nw@hydaspes.if.org>
Tue, 25 Oct 2016 01:31:35 +0000 (20:31 -0500)
committerNathan Wagner <nw@hydaspes.if.org>
Tue, 25 Oct 2016 01:40:31 +0000 (20:40 -0500)
memx64.s [new file with mode: 0644]

diff --git a/memx64.s b/memx64.s
new file mode 100644 (file)
index 0000000..f0b63cb
--- /dev/null
+++ b/memx64.s
@@ -0,0 +1,23 @@
+global flush_tlb:function
+global switch_address_space:function
+
+flush_tlb:
+       invlpg [rdi]
+       ret
+
+switch_address_space:
+       ; clear the reserved bits
+       mov rax, 0x000FFFFFFFFFF018
+       and rax, rdi
+
+       mov cr3, rax
+       ret
+
+global getcr3:function
+getcr3:
+       mov rax, cr3
+       ret
+
+section .data
+switchp:
+       db 'switching to space %llx', 0xA, 0