1 struct syscall_result {
6 static struct syscall_result syscall_return(long result)
8 struct syscall_result res;
9 if (((unsigned long)result) >= ((unsigned long)-125)) {
18 static struct syscall_result syscall1(unsigned long nr, unsigned long arg1)
24 : "a" (nr), "b" (arg1));
25 return syscall_return(res);
29 static struct syscall_result syscall3(unsigned long nr, unsigned long arg1, unsigned long arg2,
36 : "a" (nr), "b" (arg1), "c" (arg2), "d" (arg3));
37 return syscall_return(res);
43 /* Standard file descriptors */
44 #define STDIN_FILENO 0 /* Standard input */
45 #define STDOUT_FILENO 1 /* Standard output */
46 #define STDERR_FILENO 2 /* Standard error output */
49 typedef unsigned long size_t;
51 static ssize_t write(int fd, const void *buf, size_t count)
53 struct syscall_result res;
54 res = syscall3(NR_write, fd, (unsigned long)buf, count);
58 static void _exit(int status)
60 struct syscall_result res;
61 res = syscall1(NR_exit, status);
64 static void main(void)
66 static const char msg[] = "hello world\r\n";
67 write(STDOUT_FILENO, msg, sizeof(msg));