From 2ab26948f4cc4bd1cede935ad6a9e9fc78ba1a36 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Fri, 26 Apr 2019 18:48:12 -0500 Subject: [PATCH] 640K ought to be enough for anybody --- README.md | 5 +++++ main.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 README.md create mode 100644 main.c diff --git a/README.md b/README.md new file mode 100644 index 0000000..2fcfb74 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# fucky wucky + +## Build +for now build with this +gcc -m32 -nostdlib -nostdinc -static -Wall -O2 main.c -o out diff --git a/main.c b/main.c new file mode 100644 index 0000000..1df0f30 --- /dev/null +++ b/main.c @@ -0,0 +1,29 @@ +#define owo main +#define whatsdis return +#define touches asm +#define yoursyscall volatile + + +//TODO make this safe +int size_of(void * in) { + void * tmp = in; + + while(*(char *)in != 0) { + in = in+1; + } + + whatsdis in - tmp; +} + +int owo() { + char tmp1[] = "Hello world\n"; + int temp1; + + touches yoursyscall ("int $0x80": + "=a" (temp1): + "a" (4), "b" (1), "c" (tmp1), "d" (size_of(tmp1)) + : "memory"); + asm volatile ("int $0x80" : : "a" (1), "b" (0)); + + whatsdis temp1; +}