summaryrefslogblamecommitdiffstats
path: root/src/emu/syscall.c
blob: c573a949cd1914561d94156461153f001ecb27b9 (plain) (tree)
1
2
3
4
5
6
7
8
9

                   
                  
                     




                    
                                   
 

                     
                         
                      
                             
                      

                                              

                      
                         

         
#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);
	}
}