summaryrefslogtreecommitdiff
path: root/documentation
diff options
context:
space:
mode:
Diffstat (limited to 'documentation')
-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