mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-03 02:41:08 +00:00
Implement wao for dalvik ##write
This commit is contained in:
parent
b50e7e9602
commit
b4e696f96d
@ -20,12 +20,28 @@ void r_core_hack_help(const RCore *core) {
|
||||
"wao", " nocj", "remove conditional operation from branch (make it unconditional)",
|
||||
"wao", " trap", "make the current opcode a trap",
|
||||
"wao", " recj", "reverse (swap) conditional branch instruction",
|
||||
"NOTE:", "", "those operations are only implemented for x86 and arm atm.", //TODO
|
||||
"WIP:", "", "not all archs are supported and not all commands work on all archs",
|
||||
NULL
|
||||
};
|
||||
r_core_cmd_help (core, help_msg);
|
||||
}
|
||||
|
||||
R_API bool r_core_hack_dalvik(RCore *core, const char *op, const RAnalOp *analop) {
|
||||
if (!strcmp (op, "nop")) {
|
||||
r_core_cmdf (core, "wx 0000");
|
||||
} else if (!strcmp (op, "ret2")) {
|
||||
r_core_cmdf (core, "wx 12200f00"); // mov v0, 2;ret v0
|
||||
} else if (!strcmp (op, "ret1")) {
|
||||
r_core_cmdf (core, "wx 12100f00"); // mov v0, 1;ret v0
|
||||
} else if (!strcmp (op, "ret0")) {
|
||||
r_core_cmdf (core, "wx 12000f00"); // mov v0, 0;ret v0
|
||||
} else {
|
||||
eprintf ("Unsupported operation '%s'\n", op);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
R_API bool r_core_hack_arm64(RCore *core, const char *op, const RAnalOp *analop) {
|
||||
if (!strcmp (op, "nop")) {
|
||||
r_core_cmdf (core, "wx 1f2003d5");
|
||||
@ -255,6 +271,8 @@ R_API int r_core_hack(RCore *core, const char *op) {
|
||||
}
|
||||
if (strstr (asmarch, "x86")) {
|
||||
hack = r_core_hack_x86;
|
||||
} else if (strstr (asmarch, "dalvik")) {
|
||||
hack = r_core_hack_dalvik;
|
||||
} else if (strstr (asmarch, "arm")) {
|
||||
if (asmbits == 64) {
|
||||
hack = r_core_hack_arm64;
|
||||
|
Loading…
Reference in New Issue
Block a user