diff options
| author | jstmaxlol <87650746+jstmaxlol@users.noreply.github.com> | 2025-08-28 19:31:00 +0200 |
|---|---|---|
| committer | jstmaxlol <87650746+jstmaxlol@users.noreply.github.com> | 2025-08-28 19:31:00 +0200 |
| commit | 0bcac824e5f604582e553f5e5a5802a3e9211a2f (patch) | |
| tree | 32101a4e83f3ffbba453dd483695add65894e38f /asm_print.c | |
| parent | f388cd066f25b4b5bfb81463e40ea795f58c6d21 (diff) | |
random scheisse
Diffstat (limited to 'asm_print.c')
| -rw-r--r-- | asm_print.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/asm_print.c b/asm_print.c new file mode 100644 index 0000000..f232661 --- /dev/null +++ b/asm_print.c @@ -0,0 +1,32 @@ +#include <string.h> +#include <stddef.h> + +#ifndef __stupid +#define __stupid + +void dprint(const char* str); + +int main(void) { + const char* message = "Hello, World!"; + + dprint(message); + + return 0; +} + +void dprint(const char* str) { + size_t len = strlen(str); + + asm volatile ( + "movq $1, %%rax;" + "movq $1, %%rdi;" + "movq %0, %%rsi;" + "movq %1, %%rdx;" + "syscall;" + : + : "r" (str), "r" (len) + : "%rax", "%rdi", "%rsi", "%rdx" + ); +} + +#endif |