summaryrefslogtreecommitdiff
path: root/libraries/euler/syscall.asm
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-01-20 17:59:40 -0500
committerBenji Dial <benji@benjidial.net>2024-01-20 17:59:40 -0500
commit7199e74aa22e592a3b77bdd81f735edca5470596 (patch)
tree66e935372acc5d6e013f764965f2a9d81814f809 /libraries/euler/syscall.asm
parent53135e2592c21cb9b2609bf95242aaf1f19233da (diff)
downloadhilbert-os-7199e74aa22e592a3b77bdd81f735edca5470596.tar.gz
update
Diffstat (limited to 'libraries/euler/syscall.asm')
-rw-r--r--libraries/euler/syscall.asm82
1 files changed, 82 insertions, 0 deletions
diff --git a/libraries/euler/syscall.asm b/libraries/euler/syscall.asm
new file mode 100644
index 0000000..f7fe735
--- /dev/null
+++ b/libraries/euler/syscall.asm
@@ -0,0 +1,82 @@
+bits 64
+
+section .text
+
+global _syscall_encode_color
+_syscall_encode_color:
+ xor rax, rax
+ and edi, 0xff
+ and dx, 0xff
+ shl si, 8
+ shl edx, 16
+ or di, si
+ or edi, edx
+ syscall
+ ret
+
+global _syscall_get_framebuffer
+_syscall_get_framebuffer:
+ push rcx
+ push rdx
+ push rsi
+ push rdi
+ mov rax, 1
+ syscall
+ pop rcx
+ mov qword [rcx], rax
+ pop rcx
+ mov dword [rcx], edi
+ pop rcx
+ shr rdi, 32
+ mov dword [rcx], edi
+ pop rcx
+ mov dword [rcx], esi
+ ret
+
+global _syscall_open_file
+_syscall_open_file:
+ mov rax, 2
+ push rdx
+ syscall
+ pop rdx
+ mov qword [rdx], rdi
+ ret
+
+global _syscall_get_file_length
+_syscall_get_file_length:
+ mov rax, 3
+ push rsi
+ syscall
+ pop rsi
+ mov qword [rsi], rdi
+ ret
+
+global _syscall_read_from_file
+_syscall_read_from_file:
+ mov rax, 4
+ push rcx
+ push rdx
+ push rsi
+ push rdi
+ mov rdi, rsp
+ syscall
+ add rsp, 32
+ ret
+
+global _syscall_end_this_process
+_syscall_end_this_process:
+ mov rax, 5
+ syscall
+ ;does not return
+
+global _syscall_get_new_pages
+_syscall_get_new_pages:
+ mov rax, 6
+ syscall
+ ret
+
+global _syscall_close_file
+_syscall_close_file:
+ mov rax, 7
+ syscall
+ ret