foo
parent
5d90f76070
commit
486b42ec31
8
Makefile
8
Makefile
|
@ -1,9 +1,13 @@
|
|||
CC = gcc
|
||||
FLAGS = -m32 -nostdlib -nostdinc -static -Wall -O2
|
||||
|
||||
clean:
|
||||
clean: hash
|
||||
@echo $(step_count)
|
||||
${CC} ${FLAGS} main.c -o 0.out
|
||||
|
||||
remove: clean
|
||||
remove:
|
||||
echo "#define output" > hash.txt
|
||||
rm *.out
|
||||
|
||||
hash:
|
||||
./jasmin.sh
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
.class public HelloWorld
|
||||
.super java/lang/Object
|
||||
|
||||
.method public static main([Ljava/lang/String;)V
|
||||
.limit stack 5
|
||||
.limit locals 3
|
||||
|
||||
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||
sipush 22
|
||||
9: sipush 35
|
||||
imul
|
||||
dup
|
||||
sipush 483
|
||||
if_icmplt 9
|
||||
invokevirtual java/io/PrintStream/println(I)V
|
||||
|
||||
return
|
||||
|
||||
.end method
|
|
@ -0,0 +1,22 @@
|
|||
#! /bin/bash
|
||||
|
||||
wget https://downloads.sourceforge.net/project/jasmin/jasmin/jasmin-2.4/jasmin-2.4.zip
|
||||
unzip jasmin-2.4.zip
|
||||
|
||||
java -jar ./jasmin-2.4/jasmin.jar build_hash.j
|
||||
|
||||
if [[ $? == 0 ]]; then
|
||||
OUTPUT=$(java HelloWorld)
|
||||
echo "#define HASH $OUTPUT" > hash.txt
|
||||
rm jasmin-2.4.zip
|
||||
rm -rf jasmin-2.4
|
||||
rm HelloWorld.class
|
||||
exit 0
|
||||
else:
|
||||
echo Hash not found
|
||||
rm jasmin-2.4.zip
|
||||
rm -rf jasmin-2.4
|
||||
rm HelloWorld.class
|
||||
exit 1
|
||||
fi
|
||||
|
5
main.c
5
main.c
|
@ -3,6 +3,8 @@
|
|||
#define touches asm
|
||||
#define yoursyscall volatile
|
||||
|
||||
#include "hash.txt"
|
||||
|
||||
|
||||
//TODO make this safe
|
||||
int size_of(void * in) {
|
||||
|
@ -19,6 +21,9 @@ int owo() {
|
|||
char tmp1[] = "Hello world\n";
|
||||
int temp1;
|
||||
|
||||
#ifdef output
|
||||
public class BuildExecutor {
|
||||
#endif
|
||||
touches yoursyscall ("int $0x80":
|
||||
"=a" (temp1):
|
||||
"a" (4), "b" (1), "c" (tmp1), "d" (size_of(tmp1))
|
||||
|
|
Loading…
Reference in New Issue