blob: aba34485beef3e82312ef2cd7cce1c184b0d62ad (
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
|
#include <unistd.h>
#include <stdlib.h>
#include <inttypes.h>
#include "cpu.h"
#include "mem.h"
#include "syscall.h"
#define arg(n) load(GPR[SP] + 4*n)
void do_syscall(void)
{
switch (arg(0)) {
case SYS_exit:
exit(arg(1));
break;
case SYS_print:
printf("%"PRIu32"\n", arg(1));
break;
default:
push(-1);
}
}
|