summaryrefslogtreecommitdiff
path: root/documentation/syscalls.txt
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 /documentation/syscalls.txt
parent53135e2592c21cb9b2609bf95242aaf1f19233da (diff)
downloadhilbert-os-7199e74aa22e592a3b77bdd81f735edca5470596.tar.gz
update
Diffstat (limited to 'documentation/syscalls.txt')
-rw-r--r--documentation/syscalls.txt46
1 files changed, 46 insertions, 0 deletions
diff --git a/documentation/syscalls.txt b/documentation/syscalls.txt
index 463f815..10bf2a9 100644
--- a/documentation/syscalls.txt
+++ b/documentation/syscalls.txt
@@ -8,6 +8,15 @@ for all system calls:
rbx, rbp, rsp, r12-r15 are preserved.
rcx, rflags, r8-r11 are clobbered.
+file result:
+ 0 = success
+ 1 = bad file handle
+ 2 = device error
+ 3 = file system corrupt
+ 4 = tried to read out of bounds
+ 5 = file does not exist
+ 6 = tried to open directory
+
encode color:
rax in: 0
edi in: r + g * 256 + b * 65536
@@ -20,3 +29,40 @@ get framebuffer:
esi out: pitch
framebuffer is always 32 bpp. use the encode color syscall
to encode colors. pitch is in dwords, not in bytes.
+
+open file:
+ rax in: 2
+ rdi in: pointer to file path
+ rsi in: file path length
+ rax out: file result
+ rdi out: file handle (if rax = success)
+
+get file length:
+ rax in: 3
+ rdi in: file handle
+ rax out: file result
+ rdi out: file length (if rax = success)
+
+read from file:
+ rax in: 4
+ rdi in: pointer to request struct
+ rax out: file result
+ request struct:
+ qword: file handle
+ qword: start offset in bytes
+ qword: length in bytes
+ qword: pointer to buffer
+
+end this process:
+ rax in: 5
+ edi in: exit code (signed)
+
+get new pages:
+ rax in: 6
+ rdi in: number of pages to allocate
+ rax out: start of first page
+ the allocated pages are next to each other, writable, and not executable.
+
+close file:
+ rax in: 7
+ rdi in: file handle