Skip to content

Commit

Permalink
Change parameter order in backdoor
Browse files Browse the repository at this point in the history
  • Loading branch information
rmalmain committed Apr 10, 2024
1 parent a32c328 commit ac45b13
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions accel/tcg/translator.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns,
if (backdoor == 0x44) {
struct libafl_backdoor_hook* bhk = libafl_backdoor_hooks;
while (bhk) {
TCGv_i64 tmp1 = tcg_constant_i64(bhk->data);
TCGv_i64 tmp0 = tcg_constant_i64(bhk->data);
TCGv tmp2 = tcg_constant_tl(db->pc_next);
TCGTemp *args[3] = { tcgv_ptr_temp(tcg_env), tcgv_i64_temp(tmp1), tcgv_tl_temp(tmp2) };
TCGTemp *args[3] = { tcgv_i64_temp(tmp0), tcgv_ptr_temp(tcg_env), tcgv_tl_temp(tmp2) };

tcg_gen_callN(&bhk->helper_info, NULL, args);

Expand Down
2 changes: 1 addition & 1 deletion libafl_extras/hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static TCGHelperInfo libafl_exec_backdoor_hook_info = {
struct libafl_backdoor_hook* libafl_backdoor_hooks;
size_t libafl_backdoor_hooks_num = 0;

size_t libafl_add_backdoor_hook(void (*exec)(CPUArchState* cpu, uint64_t data, target_ulong pc),
size_t libafl_add_backdoor_hook(void (*exec)(uint64_t data, CPUArchState* cpu, target_ulong pc),
uint64_t data)
{
struct libafl_backdoor_hook* hook = calloc(sizeof(struct libafl_backdoor_hook), 1);
Expand Down
4 changes: 2 additions & 2 deletions libafl_extras/hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int libafl_qemu_remove_hook(size_t num, int invalidate);
struct libafl_hook* libafl_search_hook(target_ulong addr);

struct libafl_backdoor_hook {
void (*exec)(CPUArchState* cpu, uint64_t data, target_ulong pc);
void (*exec)(uint64_t data, CPUArchState* cpu, target_ulong pc);
uint64_t data;
size_t num;
TCGHelperInfo helper_info;
Expand All @@ -50,7 +50,7 @@ struct libafl_backdoor_hook {

extern struct libafl_backdoor_hook* libafl_backdoor_hooks;

size_t libafl_add_backdoor_hook(void (*exec)(CPUArchState* cpu, uint64_t data, target_ulong pc),
size_t libafl_add_backdoor_hook(void (*exec)(uint64_t data, CPUArchState* cpu, target_ulong pc),
uint64_t data);
int libafl_qemu_remove_backdoor_hook(size_t num, int invalidate);

Expand Down

0 comments on commit ac45b13

Please sign in to comment.