about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--test/arch/x86/unit/mn_stack.py60
-rw-r--r--test/test_all.py1
2 files changed, 61 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]]
diff --git a/test/test_all.py b/test/test_all.py
index 895dbdac..f59e3781 100644
--- a/test/test_all.py
+++ b/test/test_all.py
@@ -35,6 +35,7 @@ testset += RegressionTest(["x86/arch.py"], base_dir="arch",
 for script in ["x86/sem.py",
                "x86/unit/mn_strings.py",
                "x86/unit/mn_float.py",
+               "x86/unit/mn_stack.py",
                "arm/arch.py",
                "arm/sem.py",
                "msp430/arch.py",