summaryrefslogtreecommitdiff
path: root/doc/ints.txt
blob: d8abd6dfda62e9730055efa6233bf1322bd42261 (plain) (blame)
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
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
see keys.txt for the return type of the "get key" system call
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.

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     | 0x0 | handle        | drive number  | path        |             |        |
 close file    | 0x1 |               | handle        |             |             |        |
 file read     | 0x2 | read          | handle        | file offset | count       | buffer |
 get file size | 0x3 | size          | handle        |             |             |        |
 start task    | 0x4 | handle        | drive number  | path        | passed sz   |        |
 log string    | 0x5 |               | sz string     |             |             |        |
 get key       | 0x6 | keycode       |               |             |             |        |
 allocate ram  | 0x7 | start pointer | pages         |             |             |        |
 memory info   | 0x8 | see table 2   | see table 2   |             |             |        |
 wait for task | 0x9 |               | handle        |             |             |        |
 enumerate dir | 0xa | count         | drive number  | path        | see table 3 | max    |


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 defined as follows:
  struct {
    bool is_dir;
    char name[100];
    uint32_t size;
  }
"is_dir" here indicates whether or not the entry is another directory.
"name" is a null-terminated string, up to 99 characters, indicating the name of the entry.
"size" is the size of the file this entry refers to, in bytes.