summaryrefslogtreecommitdiff
path: root/tools/d2c/hooks/manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/d2c/hooks/manager.c')
-rw-r--r--tools/d2c/hooks/manager.c10
1 files changed, 7 insertions, 3 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);
}