Mercurial > paraspace
changeset 80:835b8f9de23e
Add doc for doxygen
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Tue, 19 Jul 2011 18:46:30 +0800 |
parents | 9c7bfb13b262 |
children | 7adb8c3b3c44 |
files | paraspace/dalvik_opcodes.py |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/paraspace/dalvik_opcodes.py Tue Jul 19 18:03:30 2011 +0800 +++ b/paraspace/dalvik_opcodes.py Tue Jul 19 18:46:30 2011 +0800 @@ -262,13 +262,16 @@ OP_UNUSED_FF = 0xff pass +## \brief List of names of opcodes opcode_names = sorted([name for name in all_opcodes.__dict__.keys() if name.startswith('OP_')], key=lambda name: all_opcodes.__dict__[name]) +## \brief Map opcode names to opcodes name_2_opcodes = dict([(name, code) for name, code in all_opcodes.__dict__.items()]) +## \brief Length of instructions of opcodes in bytes opcode_widths = [0] * 256 _w1_ops = '''OP_NOP @@ -635,6 +638,7 @@ kFmt51l '''.split() +## \brief Map opcodes to their formats opcode_fmts = [0] * 256 opcode_fmts[all_opcodes.OP_GOTO] = all_opcode_fmts.kFmt10t @@ -1036,6 +1040,7 @@ pass +## \brief String for string format from name of format. fmt_fmtstr = { 'kFmtUnknown': '', 'kFmt10x': '', @@ -1070,6 +1075,7 @@ 'kFmt51l': 'v{0}, #+{1:016x}' } +## \brief Map from names of opcode formats to tuples of fields size fmt_parse_cfgs = { 'kFmtUnknown': (), # '' 'kFmt10x': (), # '' @@ -1105,6 +1111,7 @@ 'kFmt51l': (2, 16) # 'vAA, #+BBBBBBBBBBBBBBBB' } +## \brief Decode an instruction def decode_inst(insn): def build_arg(sz): if sz == 1: @@ -1160,6 +1167,7 @@ return op_vector +## \brief Encode a opcode and arguments vector to an instruction def encode_inst(op_vector): def encode_arg(arg, sz): if sz == 1: @@ -1216,6 +1224,7 @@ return inst +## \brief Generate formated string for given opcode and arguments vector def format_inst(op_vector): opcode, args = op_vector