about summary refs log tree commit diff stats
path: root/js/games/nluqo.github.io/~bh/pdf/v1ch10.pdf
diff options
context:
space:
mode:
authorelioat <hi@eli.li>2023-12-09 13:52:05 -0500
committerelioat <hi@eli.li>2023-12-09 13:52:05 -0500
commit7006ed3abed04ddf241f06bfc66f090f368ef337 (patch)
tree635e1945e16e8e46c3ab7b2b9f221d9bf9b999c2 /js/games/nluqo.github.io/~bh/pdf/v1ch10.pdf
parentf270049491626b47badeef792beb8963c9661f49 (diff)
downloadtour-7006ed3abed04ddf241f06bfc66f090f368ef337.tar.gz
*
Diffstat (limited to 'js/games/nluqo.github.io/~bh/pdf/v1ch10.pdf')
0 files changed, 0 insertions, 0 deletions
ef='#n13'>13 14 15 16 17 18 19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 : 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