summaryrefslogtreecommitdiff
path: root/kernel/syscall.asm
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-05-18 21:53:38 -0400
committerBenji Dial <benji@benjidial.net>2024-05-18 21:53:38 -0400
commitb1a912a8a6ff472a49b2e0a09cfd433adfc2cb24 (patch)
tree5009d4415ba13e4baa37f3d0271852528130fd3b /kernel/syscall.asm
parenta8a80d326de9550b2a25b1255a2093ab43219ede (diff)
downloadhilbert-os-b1a912a8a6ff472a49b2e0a09cfd433adfc2cb24.tar.gz
reorganization, cross compiler
Diffstat (limited to 'kernel/syscall.asm')
-rw-r--r--kernel/syscall.asm88
1 files changed, 0 insertions, 88 deletions
diff --git a/kernel/syscall.asm b/kernel/syscall.asm
deleted file mode 100644
index c293402..0000000
--- a/kernel/syscall.asm
+++ /dev/null
@@ -1,88 +0,0 @@
-bits 64
-
-global start_user_mode
-
-section .text
-
-extern do_syscall
-
-syscall_entry:
- mov r11, rsp
- mov rsp, 0xfffffffffffff000
- push r11
- push rcx
-
- push rdx
- push rsi
- push rdi
- push rax
-
- mov rdi, rsp
- lea rsi, [rsp + 8]
- lea rdx, [rsp + 16]
- lea rcx, [rsp + 24]
-
- call do_syscall
-
- pop rax
- pop rdi
- pop rsi
- pop rdx
-
- xor r8, r8
- xor r9, r9
- xor r10, r10
- xor r11, r11
- or r11, 0x200
- pop rcx
- pop rsp
-
- o64 sysret
-
-start_user_mode:
-;intended rip in rdi
-;intended rsp in rsi
-;intended p4_paddr in rdx
-
- mov rax, rdx
- mov cr3, rax
-
- ;efer <- efer | 0x1
- mov rcx, 0xc0000080
- rdmsr
- or al, 1
- wrmsr
-
- ;lstar <- syscall_entry
- mov rdx, syscall_entry
- mov eax, edx
- shr rdx, 32
- mov ecx, 0xc0000082
- wrmsr
-
- ;star <- 0x0030.0028.0000.0000
- mov edx, 0x00300028
- xor eax, eax
- mov ecx, 0xc0000081
- wrmsr
-
- mov rcx, rdi
- mov rsp, rsi
- xor r11, r11
- or r11, 0x200
-
- xor rax, rax
- xor rbx, rbx
- xor rdx, rdx
- xor rdi, rdi
- xor rsi, rsi
- xor rbp, rbp
- xor r8, r8
- xor r9, r9
- xor r10, r10
- xor r12, r12
- xor r13, r13
- xor r14, r14
- xor r15, r15
-
- o64 sysret