12 __attribute__((always_inline))
13 inline static void ebreak (void)
15 __asm __volatile__ ("ebreak");
18 __attribute__((always_inline))
19 inline static void *sys_brk (void *ptr)
21 register void *a0 asm ("a0") = ptr;
22 register int a7 asm ("a7") = 214;
23 __asm __volatile__ ("ecall" : "=r"(a0) : "r"(a0), "r"(a7));
27 unsigned mul(unsigned a, unsigned b)
32 int main (int argc, char *argv[]) {
40 in = fopen ("/test.txt", "r");
42 err (1, "open('test.txt')");
44 out = fopen ("/output.txt", "w");
46 err (1, "open('output.txt')");
48 while ((ch = fgetc (in)) != EOF)
54 in = fopen ("/output.txt", "r");
56 err (1, "reopen('output.txt')");
58 while ((ch = fgetc (in)) != EOF)
63 printf ("Result: %u\n", mul (3, 2));
65 execlp ("ksh", "ksh", NULL);