ciabatta/tests/empty.c

23 lines
602 B
C
Raw Normal View History

2023-07-22 14:30:04 +00:00
2023-07-22 16:28:16 +00:00
#include <cia_definitions.h>
#define STDOUT_FILENO 1
#define SYS_write 1
static __inline i64 __syscall3(i64 n, i64 a1, i64 a2, i64 a3) {
i64 ret;
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
"d"(a3) : "rcx", "r11", "memory");
return ret;
}
static inline i64 syscall_write(u32 fd, char const *buf, u64 count) {
return __syscall3(SYS_write, (i64)fd, (i64)buf, (u64)count);
}
char string[] = "Hello, world!\n";
int main(int argc, char **argv, char **envp) {
syscall_write(STDOUT_FILENO, string, sizeof string);
2023-07-22 14:30:04 +00:00
return 0;
}