about summary refs log tree commit diff stats
path: root/test/arch/x86/unit/mn_int.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/arch/x86/unit/mn_int.py')
-rw-r--r--test/arch/x86/unit/mn_int.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/arch/x86/unit/mn_int.py b/test/arch/x86/unit/mn_int.py
new file mode 100644
index 00000000..119e5b08
--- /dev/null
+++ b/test/arch/x86/unit/mn_int.py
@@ -0,0 +1,31 @@
+#! /usr/bin/env python
+from miasm2.jitter.csts import EXCEPT_INT_XX
+from asm_test import Asm_Test
+
+
+class Test_INT(Asm_Test):
+    TXT = '''
+    main:
+       INT 0x42
+       RET
+    '''
+
+    def set_int_num(self, jitter):
+        self.int_num = jitter.cpu.get_interrupt_num()
+        jitter.cpu.set_exception(0)
+        return True
+
+    def __init__(self):
+        super(Test_INT, self).__init__()
+        self.int_num = 0
+        self.myjit.add_exception_handler(EXCEPT_INT_XX,
+                                         self.set_int_num)
+
+    def check(self):
+        assert self.int_num == 0x42
+        self.myjit.cpu.set_interrupt_num(14)
+        assert self.myjit.cpu.get_interrupt_num() == 14
+
+
+if __name__ == "__main__":
+    [test()() for test in [Test_INT]]