-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
joelpx
committed
May 13, 2016
1 parent
ddebdaa
commit e33c57e
Showing
6 changed files
with
204 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/sh | ||
|
||
color() { | ||
local color="$1" | ||
if [ "$3" == "" ]; then | ||
local prefix="" | ||
local txt="$2" | ||
else | ||
local prefix="$2 " | ||
local txt="$3" | ||
fi | ||
echo -en "${prefix}\x1b[;${color}m${txt}\x1b[0m" | ||
} | ||
|
||
red() { | ||
color 31 "$1" "$2" | ||
} | ||
|
||
green() { | ||
color 32 "$1" "$2" | ||
} | ||
|
||
echo "analyzer tests..." | ||
|
||
ls *.bin | while read file; do | ||
name=`basename $file .bin` | ||
echo -e "py ${name}.py\ndump .text 999\n exit" | \ | ||
../../run_plasma.py -i -na -nc ${name}.bin >tmp | ||
|
||
diff -q ${name}.rev tmp >/dev/null | ||
if [ $? -eq 0 ]; then | ||
green "$name" "[OK]\n" | ||
else | ||
red "$name" "[FAIL]\n" | ||
fi | ||
done | ||
|
||
rm tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// gcc -nostdlib test.S -e _start | ||
|
||
.intel_syntax noprefix | ||
.global main | ||
.global _start | ||
|
||
.section .text | ||
|
||
.macro ACCESS_VARS | ||
mov rax, [rbp - 4] | ||
mov rax, [rsp - 4 + 16] | ||
.endm | ||
|
||
// -------------------------------------------------------- | ||
// CALL TESTS | ||
// -------------------------------------------------------- | ||
|
||
__stdcall: | ||
push rbp | ||
mov rbp, rsp | ||
mov rax, [rbp + 4] | ||
pop rbp | ||
pop rax | ||
pop rax | ||
pop rax | ||
ret | ||
|
||
__cdecl: | ||
push rbp | ||
mov rbp, rsp | ||
pop rbp | ||
ret | ||
|
||
__jmp_func: | ||
jmp __stdcall | ||
|
||
__noreturn: | ||
jmp __noreturn | ||
|
||
// -------------------------------------------------------- | ||
|
||
_start: | ||
call main | ||
call __noreturn | ||
ret | ||
|
||
main: | ||
push rbp | ||
mov rbp, rsp | ||
sub rsp, 16 | ||
|
||
ACCESS_VARS | ||
|
||
push rax | ||
push rbx | ||
push rcx | ||
call __stdcall | ||
|
||
ACCESS_VARS | ||
|
||
push rax | ||
push rbx | ||
push rcx | ||
call __cdecl | ||
add rsp, 8*3 | ||
|
||
ACCESS_VARS | ||
|
||
push rax | ||
push rbx | ||
push rcx | ||
call __jmp_func | ||
|
||
ACCESS_VARS | ||
|
||
pop rbp | ||
ret |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env python3 | ||
ep = api.entry_point() | ||
api.set_code(ep) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
; --------------------------------------------------------------------- | ||
.text 0x4000d4 -> 0x40013f | ||
|
||
; --------------------------------------------------------------------- | ||
; SUBROUTINE | ||
; --------------------------------------------------------------------- | ||
__stdcall: | ||
|
||
long int var_4 = -0x4 | ||
|
||
.text 0x4000d4: push rbp | ||
.text 0x4000d5: rbp = rsp | ||
.text 0x4000d8: rax = var_4 | ||
.text 0x4000dc: pop rbp | ||
.text 0x4000dd: pop rax | ||
.text 0x4000de: pop rax | ||
.text 0x4000df: pop rax | ||
.text 0x4000e0: ret | ||
; end function __stdcall | ||
|
||
; --------------------------------------------------------------------- | ||
; SUBROUTINE | ||
; --------------------------------------------------------------------- | ||
__cdecl: | ||
.text 0x4000e1: push rbp | ||
.text 0x4000e2: rbp = rsp | ||
.text 0x4000e5: pop rbp | ||
.text 0x4000e6: ret | ||
; end function __cdecl | ||
|
||
; --------------------------------------------------------------------- | ||
; SUBROUTINE | ||
; --------------------------------------------------------------------- | ||
__jmp_func: | ||
.text 0x4000e7: jmp __stdcall | ||
; end function __jmp_func | ||
|
||
; --------------------------------------------------------------------- | ||
; SUBROUTINE | ||
; --------------------------------------------------------------------- | ||
__noreturn__ __noreturn: | ||
.text 0x4000e9: jmp __noreturn | ||
; end function __noreturn | ||
|
||
_start: | ||
.text 0x4000eb: call (.text) main | ||
.text 0x4000f0: call (.text) __noreturn | ||
|
||
.text 0x4000f5: .db c3 | ||
|
||
; --------------------------------------------------------------------- | ||
; SUBROUTINE | ||
; --------------------------------------------------------------------- | ||
main: | ||
|
||
long int var_c = -0xc | ||
|
||
.text 0x4000f6: push rbp | ||
.text 0x4000f7: rbp = rsp | ||
.text 0x4000fa: rsp -= 16 | ||
.text 0x4000fe: rax = var_c | ||
.text 0x400102: rax = var_c | ||
.text 0x400107: push rax | ||
.text 0x400108: push rbx | ||
.text 0x400109: push rcx | ||
.text 0x40010a: call (.text) __stdcall | ||
.text 0x40010f: rax = var_c | ||
.text 0x400113: rax = var_c | ||
.text 0x400118: push rax | ||
.text 0x400119: push rbx | ||
.text 0x40011a: push rcx | ||
.text 0x40011b: call (.text) __cdecl | ||
.text 0x400120: rsp += 24 | ||
.text 0x400124: rax = var_c | ||
.text 0x400128: rax = var_c | ||
.text 0x40012d: push rax | ||
.text 0x40012e: push rbx | ||
.text 0x40012f: push rcx | ||
.text 0x400130: call (.text) __jmp_func | ||
.text 0x400135: rax = var_c | ||
.text 0x400139: rax = var_c | ||
.text 0x40013e: pop rbp | ||
.text 0x40013f: ret | ||
; end function main | ||
|