diff options
| author | Camille Mougey <commial@gmail.com> | 2017-01-12 16:20:33 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-12 16:20:33 +0100 |
| commit | 97d25c6e584e48b4ff85e529da290db34847868e (patch) | |
| tree | f12ae3b7e6f4870a9deb32f358a79261844a7c97 /test/jitter/jit_options.py | |
| parent | 9b8756e6f95e45caa6171d9fe1f6a836291c3577 (diff) | |
| parent | 0e0e1d338af0e7dd3b60be930bbce441295b2cb4 (diff) | |
| download | miasm-97d25c6e584e48b4ff85e529da290db34847868e.tar.gz miasm-97d25c6e584e48b4ff85e529da290db34847868e.zip | |
Merge pull request #473 from serpilliere/Fix_max_exec_self_loop
Fix max exec self loop
Diffstat (limited to 'test/jitter/jit_options.py')
| -rw-r--r-- | test/jitter/jit_options.py | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/test/jitter/jit_options.py b/test/jitter/jit_options.py index cc955c64..4fe936d5 100644 --- a/test/jitter/jit_options.py +++ b/test/jitter/jit_options.py @@ -5,18 +5,18 @@ from miasm2.analysis.machine import Machine from pdb import pm # Shellcode - # main: -# MOV EAX, 0x1 +# MOV EAX, 0x10 +# MOV EBX, 0x1 # loop_main: -# CMP EAX, 0x10 -# JZ loop_end -# loop_inc: -# INC EAX -# JMP loop_main +# SUB EAX, 0x1 +# CMOVZ ECX, EBX +# JNZ loop_main # loop_end: # RET -data = "b80100000083f810740340ebf8c3".decode("hex") + + +data = "b810000000bb0100000083e8010f44cb75f8c3".decode("hex") run_addr = 0x40000000 def code_sentinelle(jitter): @@ -47,10 +47,10 @@ myjit.init_run(run_addr) myjit.continue_run() assert myjit.run is False -assert myjit.cpu.EAX == 0x10 +assert myjit.cpu.EAX == 0x0 ## Let's specify a max_exec_per_call -## 5: main, loop_main, loop_inc, loop_main, loop_inc +## 5: main/loop_main, loop_main myjit.jit.options["max_exec_per_call"] = 5 first_call = True @@ -71,8 +71,8 @@ myjit.exec_cb = cb myjit.continue_run() assert myjit.run is True -# Use a '<=' because it's a 'max_...' -assert myjit.cpu.EAX <= 3 +# Use a '>=' because it's a 'max_...' +assert myjit.cpu.EAX >= 0xA # Test 'jit_maxline' print "[+] Run instr one by one" @@ -91,7 +91,6 @@ myjit.exec_cb = cb myjit.continue_run() assert myjit.run is False -assert myjit.cpu.EAX == 0x10 -## dry(1) + main(1) + (loop_main(2) + loop_inc(2))*(0x10 - 1) + loop_main(2) + -## loop_end(1) = 65 -assert counter == 65 +assert myjit.cpu.EAX == 0x00 +## main(2) + (loop_main(3))*(0x10) + loop_end(1) + 0x1337beef (1) +assert counter == 52 |