about summary refs log tree commit diff stats
path: root/init.soso
blob: 8753b4121a7b548fcd5735cf78ba09931eb3ffa9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc
# 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 : addr, 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 : addr, size/edx : int -> nbytes-or-error/eax : int
    b8/copy-to-eax 3/imm32
    cd/syscall 0x80/imm8
    c3/return

syscall_open:  # filename/ebx : (addr kernel-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