about summary refs log tree commit diff stats
path: root/example/asm_x86.py
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2014-09-05 11:30:05 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2014-09-05 11:30:05 +0200
commit6e09df71a333bf87cd68c2d08ad068a3e501462d (patch)
tree7d76e0626e61ef5a9f15c62358337674fb0095aa /example/asm_x86.py
parente8d0fcf8d28d82a8f33138d044f335634ac3a30c (diff)
downloadmiasm-6e09df71a333bf87cd68c2d08ad068a3e501462d.tar.gz
miasm-6e09df71a333bf87cd68c2d08ad068a3e501462d.zip
Modify irbloc destination mecanism. Rework API in consequence.
Fat patch here: some API have changed.

Each irbloc now affects a special "IRDst" register which is used to
describe the destination irbloc. It allows simple description of
architectures using delay slots. Architectures semantic and tcc/python
jitter are modified in consequence. LLVM jitter is disabled for now,
but should be patch soon.
Diffstat (limited to 'example/asm_x86.py')
-rw-r--r--example/asm_x86.py60
1 files changed, 41 insertions, 19 deletions
diff --git a/example/asm_x86.py b/example/asm_x86.py
index 3e0ab1bb..92d5029a 100644
--- a/example/asm_x86.py
+++ b/example/asm_x86.py
@@ -22,27 +22,49 @@ base_expr.setParseAction(my_var_parser)
 
 blocs, symbol_pool = parse_asm.parse_txt(mn_x86, 32, '''
 main:
-  PUSH EBP
-  MOV  EBP, ESP
-  SUB  ESP, 0x100
-  MOV  EAX, 0x1337
-  LEA  ESI, DWORD PTR [mystr]
-  CALL toto
-toto:
-  POP  EDI
-
-  PUSH 0
-  FLD1
-  FLD1
-  FADD ST, ST(1)
-  FIST  DWORD PTR [ESP]
-  POP  EAX
-
-  MOV  ESP, EBP
-  POP  EBP
-  RET
+   PUSH EBP
+   MOV  EBP, ESP
+   SUB  ESP, 0x100
+   MOV  EAX, 0x1337
+   ; test ptr manip
+   LEA  ESI, DWORD PTR [mystr^toto]
+   CALL toto
 mystr:
 .string "test string"
+ toto:
+   POP  EDI
+
+   PUSH EDI
+   ; test scasb
+   XOR  EAX, EAX
+   XOR  ECX, ECX
+   DEC  ECX
+   REPNE SCASB
+   NOT  ECX
+   DEC  ECX
+
+   ; test movsb
+   POP  ESI
+   LEA  EDI, DWORD PTR [EBP-0x100]
+   REPE  MOVSB
+
+   ; test float
+   PUSH 0
+   FLD1
+   FLD1
+   FADD ST, ST(1)
+   FIST  DWORD PTR [ESP]
+   POP  EAX
+
+   ; test cond mnemo
+   NOP
+   NOP
+   CMOVZ EAX, EBX
+   MOV  ESP, EBP
+   POP  EBP
+   RET
+
+
 ''')
 
 # fix shellcode addr