Mercurial > paraspace
comparison paraspace/dalvik_opcodes.py @ 73:6d56483b56cd
Round size of encoded Dalvik instructions to 2 times.
- Append '\x00's to the tail of instructions
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sat, 02 Jul 2011 00:09:50 +0800 |
parents | 6c2efdeffa7b |
children | 9a64fa2d78b7 |
comparison
equal
deleted
inserted
replaced
72:6c2efdeffa7b | 73:6d56483b56cd |
---|---|
1194 fmt_name = fmt_names[fmt] | 1194 fmt_name = fmt_names[fmt] |
1195 fmt_parse_cfg = fmt_parse_cfgs[fmt_name] | 1195 fmt_parse_cfg = fmt_parse_cfgs[fmt_name] |
1196 arg_part = ''.join([encode_arg(arg, sz) | 1196 arg_part = ''.join([encode_arg(arg, sz) |
1197 for arg, sz in map(None, args, fmt_parse_cfg)]) | 1197 for arg, sz in map(None, args, fmt_parse_cfg)]) |
1198 | 1198 |
1199 inst = chr(opcode) + arg_part | 1199 while encode_arg.off % 4: |
1200 | 1200 arg_part = arg_part + encode_arg(0, 1) |
1201 while len(inst) % 2: | |
1202 encode_arg(0, 1) | |
1203 pass | 1201 pass |
1204 | 1202 |
1203 inst = chr(opcode) + arg_part | |
1204 | |
1205 return inst | 1205 return inst |
1206 | 1206 |
1207 | 1207 |
1208 def format_inst(op_vector): | 1208 def format_inst(op_vector): |
1209 opcode, args = op_vector | 1209 opcode, args = op_vector |