summaryrefslogtreecommitdiff
path: root/tools/d2c/hooks
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-04-24 18:43:54 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-04-24 18:43:54 (GMT)
commit9d04b66153bd0b354c0fb5c097b9face61a649db (patch)
tree54a507c720287597e7a70808e64ad36b37ed41b8 /tools/d2c/hooks
parenta5758a42acdfaf0ac20c4cfb9cf162a9b4440e39 (diff)
Handled hooks and rules in Dalvik opcodes definitions.
Diffstat (limited to 'tools/d2c/hooks')
-rw-r--r--tools/d2c/hooks/manager.c10
-rw-r--r--tools/d2c/hooks/manager.h2
2 files changed, 8 insertions, 4 deletions
diff --git a/tools/d2c/hooks/manager.c b/tools/d2c/hooks/manager.c
index 8e7ae77..67c09f8 100644
--- a/tools/d2c/hooks/manager.c
+++ b/tools/d2c/hooks/manager.c
@@ -134,6 +134,7 @@ void register_hook_function(instr_hooks *hooks, char *type, char *name)
/******************************************************************************
* *
* Paramètres : hooks = gestionnaire d'un ensemble de fonctions associées. *
+* top = indique si l'écriture se réalise au plus haut niveau.*
* fd = descripteur d'un flux ouvert en écriture. *
* *
* Description : Associe dans le code des fonctions à une instruction. *
@@ -144,7 +145,7 @@ void register_hook_function(instr_hooks *hooks, char *type, char *name)
* *
******************************************************************************/
-bool write_hook_functions(const instr_hooks *hooks, int fd)
+bool write_hook_functions(const instr_hooks *hooks, bool top, int fd)
{
bool result; /* Bilan à retourner */
size_t i; /* Boucle de parcours */
@@ -156,8 +157,11 @@ bool write_hook_functions(const instr_hooks *hooks, int fd)
{
func = &hooks->funcs[i];
- dprintf(fd, "\t\tg_arch_instruction_set_hook(instr, IPH_%s, (instr_hook_fc)%s);\n",
- func->type, func->name);
+ if (!top)
+ dprintf(fd, "\t");
+
+ dprintf(fd, "\tg_arch_instruction_set_hook(%s, IPH_%s, (instr_hook_fc)%s);\n",
+ top ? "result" : "instr", func->type, func->name);
}
diff --git a/tools/d2c/hooks/manager.h b/tools/d2c/hooks/manager.h
index e3d51b6..97bd388 100644
--- a/tools/d2c/hooks/manager.h
+++ b/tools/d2c/hooks/manager.h
@@ -44,7 +44,7 @@ void delete_instr_hooks(instr_hooks *);
void register_hook_function(instr_hooks *, char *, char *);
/* Associe dans le code des fonctions à une instruction. */
-bool write_hook_functions(const instr_hooks *, int);
+bool write_hook_functions(const instr_hooks *, bool, int);