diff options
| -rw-r--r-- | test/arch/x86/unit/mn_int.py | 31 | ||||
| -rw-r--r-- | test/test_all.py | 1 |
2 files changed, 32 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]] diff --git a/test/test_all.py b/test/test_all.py index faae79c5..4b39eb50 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -38,6 +38,7 @@ for script in ["x86/sem.py", "x86/unit/mn_stack.py", "x86/unit/mn_daa.py", "x86/unit/mn_das.py", + "x86/unit/mn_int.py", "arm/arch.py", "arm/sem.py", "aarch64/unit/mn_ubfm.py", |