about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--example/samples/human.S41
-rwxr-xr-xtest/test_all.py4
2 files changed, 45 insertions, 0 deletions
diff --git a/example/samples/human.S b/example/samples/human.S
new file mode 100644
index 00000000..750aa5b7
--- /dev/null
+++ b/example/samples/human.S
@@ -0,0 +1,41 @@
+	;;  Walk a human link list and print its information
+main:
+	TEST       RDI, RDI
+	JZ         end
+
+	PUSH       RBX
+	MOV        RBX, RDI
+loop:
+	LEA        RSI, QWORD PTR [RBX+0x10]
+	LEA        RDI, QWORD PTR [name-_+RIP]
+	XOR        EAX, EAX
+	CALL       printf
+
+	MOVZX      ESI, WORD PTR [RBX+0x8]
+	LEA        RDI, QWORD PTR [age-_+RIP]
+	XOR        EAX, EAX
+	CALL       printf
+
+	MOV        ESI, DWORD PTR [RBX+0xC]
+	XOR        EAX, EAX
+	LEA        RDI, QWORD PTR [height-_+RIP]
+	CALL       printf
+
+	MOV        RBX, QWORD PTR [RBX]
+	TEST       RBX, RBX
+	JNZ        loop
+
+	POP        RBX
+end:
+	RET
+
+printf:
+	;; Dummy printf
+	RET
+
+age:
+.string "Age: %d\n"
+height:
+.string "Height: %d\n"
+name:
+.string "Name: %s\n"
diff --git a/test/test_all.py b/test/test_all.py
index e405bcec..65a30c69 100755
--- a/test/test_all.py
+++ b/test/test_all.py
@@ -412,6 +412,8 @@ test_x86_32_if_reg = ExampleShellcode(['x86_32', 'x86_32_if_reg.S', "x86_32_if_r
 test_x86_32_seh = ExampleShellcode(["x86_32", "x86_32_seh.S", "x86_32_seh.bin",
                                     "--PE"])
 
+test_human = ExampleShellcode(["x86_64", "human.S", "human.bin"])
+
 testset += test_armb
 testset += test_arml
 testset += test_aarch64b
@@ -427,6 +429,8 @@ testset += test_x86_64
 testset += test_x86_32_if_reg
 testset += test_x86_32_seh
 
+testset += test_human
+
 class ExampleDisassembler(Example):
     """Disassembler examples specificities:
     - script path begins with "disasm/"