summaryrefslogtreecommitdiffstats
path: root/src/emu/syscall.c
blob: 92cab2289e78c6a0edee977999f726abc431bec3 (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[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);
	}
}