Description
(rephrased to better match sleigh terminology)
I'm working on a processor description for VAX and would need to get the address of an instruction operand.
VAX has one-byte opcodes followed by operands with variable (1 to 5 bytes) length.
Examples (not exact mnemonics)
- one-byte opcode, two one-byte operands
00000000: 90 01 50 - MOVE.B S^1, R0
- one-byte opcode, one two-byte operand, one four-byte operand
00000000: 90 CF 34 12 E0 78 56 34 12 - MOVE.B (PC+0x1234), (R0 + 0x12345678)
Example 2 is the problem. The first operand ("CF 34 12") is PC-relative, it computes PC+0x1234, where PC is right after the final "12" value. In the example above, that would result in 0x1238.
Problem
To compute PC-relative offsets correctly, I need to know the operands memory address. However, neither inst_start
, nor inst_next
are usable here:
-
I can't use
inst_start
because the operand might be second and I don't know the size of the first operand. -
I can't use
inst_next
because the operand might be first and I don't know the size of the second operand.
Are there any other options ?