about summary refs log tree commit diff stats
path: root/test/arch/x86/unit/mn_stack.py
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2015-07-21 12:54:09 +0200
committerCamille Mougey <commial@gmail.com>2015-07-21 12:54:09 +0200
commit97463558ea31744a24e3330ab3227e2098878d03 (patch)
tree480e2af9a1f30c027b07c8feb2889eb8bed01a77 /test/arch/x86/unit/mn_stack.py
parente82d888243fc5f283e7a3d5b12e5cefaf950edc5 (diff)
parent2ff7161eaba5da7845c69be28e8092f030b94bed (diff)
downloadmiasm-97463558ea31744a24e3330ab3227e2098878d03.tar.gz
miasm-97463558ea31744a24e3330ab3227e2098878d03.zip
Merge pull request #196 from serpilliere/fix_pushw
Fix pushw
Diffstat (limited to 'test/arch/x86/unit/mn_stack.py')
-rw-r--r--test/arch/x86/unit/mn_stack.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/test/arch/x86/unit/mn_stack.py b/test/arch/x86/unit/mn_stack.py
new file mode 100644
index 00000000..dd349d54
--- /dev/null
+++ b/test/arch/x86/unit/mn_stack.py
@@ -0,0 +1,60 @@
+#! /usr/bin/env python
+from asm_test import Asm_Test
+
+
+class Test_PUSHPOP(Asm_Test):
+    TXT = '''
+    main:
+       MOV     EBP, ESP
+       PUSH    0x11223344
+       POP     EAX
+       CMP     EBP, ESP
+       JNZ     BAD
+
+       PUSHW   0x1122
+       POPW    AX
+       CMP     EBP, ESP
+       JNZ     BAD
+
+       PUSH    SS
+       POP     EAX
+       CMP     EBP, ESP
+       JNZ     BAD
+
+       PUSHW   SS
+       POPW    AX
+       CMP     EBP, ESP
+       JNZ     BAD
+
+       PUSHFD
+       POP     EAX
+       CMP     EBP, ESP
+       JNZ     BAD
+
+       PUSHFW
+       POPW    AX
+       CMP     EBP, ESP
+       JNZ     BAD
+
+       PUSH    EAX
+       POPFD
+       CMP     EBP, ESP
+       JNZ     BAD
+
+       PUSHW   AX
+       POPFW
+       CMP     EBP, ESP
+       JNZ     BAD
+
+       RET
+
+BAD:
+       INT     0x3
+       RET
+    '''
+    def check(self):
+        assert(self.myjit.cpu.ESP-4 == self.myjit.cpu.EBP)
+
+
+if __name__ == "__main__":
+    [test()() for test in [Test_PUSHPOP]]