CPU Operand Types

The decompiler is, at heart, flexible. It can do the same stuff on most CPUs, by relegating the odd stuff to a OP_CPUFUNCTION. Now, about Cpu Functions. Say we have the x86 opcode REPZ. This opcode takes in as arguments the registers esi and edi. When we get to the point with the REPZ opcode, all we have to do is get-value on esi and edi, and the contents of those registers will be exactly perfect for REPZ.

For these examples, we'll use x86 opcodes for illustration. Now, an operand definition in the opcode-data list has this spec:

    ;name, (cpu-flags forced-operands num_opds opd1_changes opd2_changes arithop flags-read-from flags-affected source-type)

To illustrate, here is one:

("not" . ((logior OP_ARITHMETIC OP_AFFECTS_ZF) 1 T NIL "!" (list "Z")))

This is the following:

name = "not"

CPU flags = OP_ARITHMETIC OP_AFFECTS_ZF

forced-operands = None

num_opds = 1

opd1_changes = T

opd2_changes = NIL

arithop - "!"

flags-read-from = None

flags-affected = Z (the zero flag, which is affected by a 'not' operation)

source-type = N/A