diff options
| author | Ajax <commial@gmail.com> | 2015-11-09 15:50:08 +0100 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2015-11-09 15:50:08 +0100 |
| commit | 857f4f33f952b2df40bc383f64c6b29d67952088 (patch) | |
| tree | c84ce26445754b16f48bc3f0e3980285e1be626e /test/arch/x86/unit/mn_int.py | |
| parent | c3c27428f87d9dd0cba29a95ef8374e1dd6a65c7 (diff) | |
| download | miasm-857f4f33f952b2df40bc383f64c6b29d67952088.tar.gz miasm-857f4f33f952b2df40bc383f64c6b29d67952088.zip | |
Test: add a unit test for x86 interrupt_num
Diffstat (limited to 'test/arch/x86/unit/mn_int.py')
| -rw-r--r-- | test/arch/x86/unit/mn_int.py | 31 |
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]] |