From e093c21ed880ac3eb72119be15093ee04f8ce299 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Tue, 5 Mar 2024 19:50:13 -0500 Subject: Move architecture modules into the API repo --- .../armv7/thumb2_disasm/arm_pcode_parser/README.md | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 arch/armv7/thumb2_disasm/arm_pcode_parser/README.md (limited to 'arch/armv7/thumb2_disasm/arm_pcode_parser/README.md') diff --git a/arch/armv7/thumb2_disasm/arm_pcode_parser/README.md b/arch/armv7/thumb2_disasm/arm_pcode_parser/README.md new file mode 100644 index 00000000..c3adae56 --- /dev/null +++ b/arch/armv7/thumb2_disasm/arm_pcode_parser/README.md @@ -0,0 +1,75 @@ +# goal +translate the pseudocode for arm instructions (given in the docs) to target languages + +once the pcode is extracted, automatic generation of ultra-accurate disassemblers should become possible + +# how +use Grako parser generator, describe the language (pcode.ebnf) and write code generator (codegen.py) + +# example +input statement: +``` +if n == 15 || BitCount(registers) < 2 || (P == '1' && M == '1') then UNPREDICTABLE +``` + +output parse tree: +``` +[ + "if", + [ + "n", + [], + [ + "==", + [ + "15", + [] + ], + "||", + [ + "BitCount(", + [ + "registers", + [] + ], + ")" + ], + "<", + [ + "2", + [] + ], + "||", + [ + "(", + "P", + [], + [ + "==", + [ + "'1'", + [] + ], + "&&", + [ + "M", + [] + ], + "==", + [ + "'1'", + [] + ] + ], + [], + ")" + ] + ] + ], + "then", + "UNPREDICTABLE" +] +``` + + + -- cgit v1.3.1