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)) {
19 static struct syscall_result syscall1(unsigned long nr, unsigned long arg1)
25 : "a" (nr), "b" (arg1));
26 return syscall_return(res);
31 static struct syscall_result syscall3(unsigned long nr, unsigned long arg1, unsigned long arg2,
38 : "a" (nr), "b" (arg1), "c" (arg2), "d" (arg3));
39 return syscall_return(res);
46 /* Standard file descriptors */
47 #define STDIN_FILENO 0 /* Standard input */
48 #define STDOUT_FILENO 1 /* Standard output */
49 #define STDERR_FILENO 2 /* Standard error output */
52 typedef unsigned long size_t;
54 static ssize_t write(int fd, const void *buf, size_t count)
56 struct syscall_result res;
57 res = syscall3(NR_write, fd, (unsigned long)buf, count);
61 static void _exit(int status)
63 struct syscall_result res;
64 res = syscall1(NR_exit, status);
67 static void console_tx_string(const char *str)
83 static void main(void)
85 static const char msg[] = "hello world\r\n";
86 write(STDOUT_FILENO, msg, sizeof(msg));