Many instructions, especially on x86, seem to be either unimplemented or broken in a subtle way. We need a proper test framework that makes it simple to implement test suites that checks instruction functionality.
I'd preferably want something that allows me to write the entire test case as a Python script that generates the necessary assembly (and requests a recompile if necessary) and drives the test cases (i.e., no need to write a separate assembly and Python file).
setup("tc.regs.r10 = 0")
asm("inc %r10")
test("tc.regs.r10 == 1")
The generated code would use m5ops (preferably using the KVM-compatible memory mapped interface) to make callbacks to the simulator. The generated assembly would look something like this:
/ / Setup reserved registers used by the m5ops interface
mov $0xFFFF0000, %r15
// Make a callback to the python script to tell it to setup the state for the sub-test
mov %rax, 0xXXAA(%r15)
inc %rax
// Inform the script that the test block has executed and it needs to check state
mov %rax, 0xXXBB(%r15)
xor %rdi, %rdi
mov 0x2100(%r14), %rax
The Python script would intercept the different annotation instruction to setup state and test state. The script could simply be imported by the actual test script which would use a list of instructions from the test to drive the simulator.