about summary refs log tree commit diff stats
path: root/init.soso
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-09-14 01:42:29 -0700
committerKartik Agaram <vc@akkartik.com>2019-09-14 01:45:55 -0700
commit46bb1d3157f9ad575c83a4bfa1e32b0d21bc8546 (patch)
tree28918f653d7cf970d33d5592047ef663289aca40 /init.soso
parentded2b24ce28f4a9df75ce40117f0f06f09574369 (diff)
downloadmu-46bb1d3157f9ad575c83a4bfa1e32b0d21bc8546.tar.gz
5650 - support a second OS: soso
https://github.com/ozkl/soso

+ Much smaller than Linux; builds instantly
+ Supports graphics
- No network support
- Doesn't work on a cloud server (yet?)
Diffstat (limited to 'init.soso')
-rw-r--r--init.soso40
1 files changed, 40 insertions, 0 deletions
diff --git a/init.soso b/init.soso
new file mode 100644
index 00000000..c24709b1
--- /dev/null
+++ b/init.soso
@@ -0,0 +1,40 @@
+# Some OS-specific preliminaries for Soso.
+
+# Memory layout
+#
+# 0x40000000 - 0x40001ffff - for ELF code+data
+# 0x40002000 - 0x401ffffff - for heap
+== code 0x40000000
+== data 0x40001000
+
+# Syscalls
+#
+# We don't have libc, so we need to know Soso's precise syscall layout.
+# https://github.com/ozkl/soso/blob/master/kernel/syscalltable.h
+== code
+
+syscall_exit:  # status/ebx : int
+    b8/copy-to-eax 8/imm32
+    cd/syscall 0x80/imm8
+
+syscall_read:  # fd/ebx : int, buf/ecx : address, size/edx : int -> nbytes-or-error/eax : int
+    b8/copy-to-eax 2/imm32
+    cd/syscall 0x80/imm8
+    c3/return
+
+syscall_write:  # fd/ebx : int, buf/ecx : address, size/edx : int -> nbytes-or-error/eax : int
+    b8/copy-to-eax 3/imm32
+    cd/syscall 0x80/imm8
+    c3/return
+
+syscall_open:  # filename/ebx : (address null-terminated-string), flags/ecx : int -> fd-or-error/eax : int
+    b8/copy-to-eax 0/imm32
+    cd/syscall 0x80/imm8
+    c3/return
+
+syscall_close:  # fd/ebx : int -> status/eax
+    b8/copy-to-eax 1/imm32
+    cd/syscall 0x80/imm8
+    c3/return
+
+# anonymous mmap not implemented