summaryrefslogtreecommitdiffstats
path: root/src/emu/syscall.c
blob: c573a949cd1914561d94156461153f001ecb27b9 (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
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>

#include "cpu.h"
#include "mem.h"
#include "syscall.h"

#define arg(n) load(GPR[StP] + 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);
	}
}