1
2
3
4
5
6
7
8
9
10
11
12
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
quit task is int 0x38
yield task is int 0x39
eax is cleared on yield
syscall is int 0x30
system call number in eax
args in ebx, ecx, edx, esi, edi
result in eax
modifies ecx, edx
modifies eax even if no value is returned
see table 1
file system calls have units of bytes unless otherwise specified.
functions returning handles or pointers use 0 to indicate error.
the edx register of "start task" is a pointer to a null-terminated string.
a pointer to a readonly copy of this string is put into the new task's edx.
the esi register is passed through directly, and is meant to be a task handle.
this is a task handle who stdio ipc communication should be done with.
the new task receives the calling task's handle in edi
the new task receives its own handle in ecx.
ipc operations return 0xffffffff if the specified task doesn't exist.
"find unread ipc" system call returns 0 if there is no unread ipc.
pixbufs are arrays of four-byte pixels, from left to right, then top to bottom.
pixels are a red byte, a green byte, a blue byte, and a padding byte.
invalid system call numbers change eax to -1, and have no other effect.
table 1:
function | eax | eax out | ebx | ecx | edx | esi | edi
-------------------|------|-----------------|----------------|----------------|--------------|--------------|--------------
open file | 0x00 | handle | drive number | path | | |
close file | 0x01 | | handle | | | |
file read | 0x02 | read | handle | file offset | count | buffer |
get file size | 0x03 | size | handle | | | |
start task | 0x04 | handle | drive number | path | passed sz | passed dword |
ipc send | 0x05 | written | task handle | max count | buffer | |
ipc read | 0x06 | read | task handle | max count | buffer | |
allocate ram | 0x07 | start pointer | pages | | | |
memory info | 0x08 | see table 2 | see table 2 | | | |
wait for task | 0x09 | | handle | | | |
enumerate dir | 0x0a | count | drive number | path | see table 3 | max |
system log | 0x0b | | message sz | | | |
count of dir | 0x0c | number of files | drive number | path | | |
new window | 0x0d | window handle | width | height | pixel buffer | |
delete window | 0x0e | | window handle | | | |
resize window | 0x0f | | window handle | width | height | pixel buffer |
reassign pixbuf | 0x10 | | window handle | pixel buffer | | |
paint window | 0x11 | | window handle | | | |
get win action | 0x12 | | window handle | action pointer | | |
wait for action | 0x13 | | | | | |
wait ipc sent | 0x14 | | sending task | | | |
wait any ipc sent | 0x15 | | | | | |
find unread ipc | 0x16 | sending task | | | | |
wait ipc read | 0x17 | | reading task | | | |
is task running | 0x18 | boolean | task handle | | | |
get timestamp | 0x19 | secs since 2000 | | | | |
file write | 0x1a | written | handle | file offset | count | buffer |
set file size | 0x1b | | handle | new file size | | |
want mouse moves | 0x1c | | window handle | | | |
table 2:
all values are in units of pages
eax -1 indicates unrecognized ebx
ebx | eax out
-----|--------------------------
0x0 | kernel dynamic area size
0x1 | kernel dynamic area left
0x2 | total userspace size
0x3 | total userspace left
0x4 | this process memory left
table 3:
edx of "enumerate dir" is a pointer to a buffer where an array of "directory info"s can be put.
esi is the maximum number of "directory info"s to be placed in the buffer.
the "directory info" structure is 128 bytes long. The first 100 bytes are a null-terminated string
indicating the name of the file represented by this entry. The next four bytes are a 32-bit integer
indicating the size of the file represented in bytes. The next byte's lowest bit is a one if this
entry is a directory, and a zero if this entry is not. The remainder of the structure is reserved.
|