blob: fe0d83e343afd68e481addd27a70c1d6a27fb92e (
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 "cpu.h"
#include "mem.h"
#include "syscall.h"
void do_syscall(void)
{
switch (GPR[1]) {
case SYS_exit:
exit(GPR[2]);
break;
case SYS_read:
GPR[2] = read(GPR[2], &MEM[GPR[3]], GPR[4]);
break;
case SYS_write:
GPR[2] = write(GPR[2], &MEM[GPR[3]], GPR[4]);
break;
default:
GPR[2] = -1;
}
}
|