summaryrefslogtreecommitdiff
path: root/user/libsyscall/syscall.S
blob: 26eb59de4e1c76e828e0e876e516d94beb1eb1aa (plain)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#include <syscall_int.h>

.global deschedule

# int deschedule(int *flag);
deschedule:
    mov 0x4(%esp), %esi
    int $DESCHEDULE_INT
    ret

.global exec

# int exec(char *execname, char *argvec[]);
exec:
    mov 0x8(%esp), %esi
    push %esi
    mov 0x8(%esp), %esi
    push %esi
    mov %esp, %esi
    int $EXEC_INT
    add $0x8, %esp
    ret

.global fork

# int fork(void);
fork:
    int $FORK_INT
    ret

.global getchar

getchar:
    int $GETCHAR_INT
    ret

.global get_cursor_pos

get_cursor_pos:
    mov 0x8(%esp), %esi
    push %esi
    mov 0x8(%esp), %esi
    push %esi
    mov %esp, %esi
    int $GET_CURSOR_POS_INT
    add $0x8, %esp
    ret

.global get_ticks

get_ticks:
    int $GET_TICKS_INT
    ret

.global gettid

# int gettid(void);
gettid:
    int $GETTID_INT
    ret

.global halt

halt:
    int $HALT_INT
    ret

.global make_runnable

make_runnable:
    mov 0x4(%esp), %esi
    int $MAKE_RUNNABLE_INT
    ret

.global misbehave

misbehave:
    mov 0x4(%esp), %esi
    int $MISBEHAVE_INT
    ret

.global new_pages

new_pages:
    mov 0x8(%esp), %esi
    push %esi
    mov 0x8(%esp), %esi
    push %esi
    mov %esp, %esi
    int $NEW_PAGES_INT
    add $0x8, %esp
    ret

.global print

print:
    mov 0x8(%esp), %esi
    push %esi
    mov 0x8(%esp), %esi
    push %esi
    mov %esp, %esi
    int $PRINT_INT
    add $0x8, %esp
    ret

.global readfile

readfile:
    mov 0x10(%esp), %esi
    push %esi
    mov 0x10(%esp), %esi
    push %esi
    mov 0x10(%esp), %esi
    push %esi
    mov 0x10(%esp), %esi
    push %esi
    mov %esp, %esi
    int $READFILE_INT
    add $0x10, %esp
    ret

.global readline

readline:
    mov 0x8(%esp), %esi
    push %esi
    mov 0x8(%esp), %esi
    push %esi
    mov %esp, %esi
    int $READLINE_INT
    add $0x8, %esp
    ret

.global remove_pages

remove_pages:
    mov 0x4(%esp), %esi
    int $REMOVE_PAGES_INT
    ret

.global set_cursor_pos

set_cursor_pos:
    mov 0x8(%esp), %esi
    push %esi
    mov 0x8(%esp), %esi
    push %esi
    mov %esp, %esi
    int $SET_CURSOR_POS_INT
    add $0x8, %esp
    ret

.global set_status

# void set_status(int status);
set_status:
    mov 0x4(%esp), %esi
    int $SET_STATUS_INT
    ret

.global set_term_color

set_term_color:
    mov 0x4(%esp), %esi
    int $SET_TERM_COLOR_INT
    ret

.global sleep

sleep:
    mov 0x4(%esp), %esi
    int $SLEEP_INT
    ret

.global swexn

swexn:
    mov 0x10(%esp), %esi
    push %esi
    mov 0x10(%esp), %esi
    push %esi
    mov 0x10(%esp), %esi
    push %esi
    mov 0x10(%esp), %esi
    push %esi
    mov %esp, %esi
    int $SWEXN_INT
    add $0x10, %esp
    ret

.global task_vanish

# void task_vanish(int status) NORETURN;
task_vanish:
    mov 0x4(%esp), %esi
    int $TASK_VANISH_INT

.global vanish

# void vanish(void) NORETURN;
vanish:
    int $VANISH_INT

.global wait

# int wait(int *status_ptr);
wait:
    mov 0x4(%esp), %esi
    int $WAIT_INT
    ret

.global yield

# int yield(int pid);
yield:
    mov 0x4(%esp), %esi
    int $YIELD_INT
    ret

.global new_console

new_console:
    int $NEW_CONSOLE_INT
    ret