Load raw C binary + docs
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
// 3 because 3 arguments to the call, get it??
|
||||
static inline long syscall3(long n, long a, long b, long c) {
|
||||
long ret;
|
||||
|
||||
__asm__ volatile (
|
||||
"int $0x80"
|
||||
: "=a"(ret)
|
||||
: "a"(n), "D"(a), "S"(b), "d"(c)
|
||||
: "memory"
|
||||
);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void write(int fd, const char* buf, long len) {
|
||||
syscall3(1, fd, (long)buf, len);
|
||||
}
|
||||
|
||||
static inline void exit(int code) {
|
||||
__asm__ volatile (
|
||||
"int $0x80"
|
||||
:
|
||||
: "a"(60), "D"(code)
|
||||
: "memory"
|
||||
);
|
||||
|
||||
for (;;);
|
||||
}
|
||||
Reference in New Issue
Block a user