From ff88dc41da25a061c799559bcfae738336a00b14 Mon Sep 17 00:00:00 2001 From: whh8b <whh8b@git.zephyr-software.com> Date: Tue, 16 May 2017 16:46:46 +0000 Subject: [PATCH] Change default size to 60 and do not swap two dollops if they are the same. --- mixr/mixr.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mixr/mixr.c b/mixr/mixr.c index e77d843..475b107 100644 --- a/mixr/mixr.c +++ b/mixr/mixr.c @@ -41,7 +41,7 @@ static int q_fd; #ifdef TEST #define MIXR_FIXED_SIZE (sizeof(int)) #else -#define MIXR_FIXED_SIZE (40) +#define MIXR_FIXED_SIZE (60) #endif #ifdef DEBUG @@ -125,6 +125,7 @@ unsigned int mixr_find_dollop_containing(void *table_addr, uint64_t addr, uint8_ for (table_iterator = 0; table_iterator<table_length; table_iterator++) { table_iterator_address = dt_table_read_entry_address(table_addr, table_iterator); + if (table_iterator_address<=addr && addr<=(table_iterator_address+MIXR_FIXED_SIZE)) { *found = 1; return table_iterator; @@ -657,6 +658,14 @@ void zipr_mixr(void *table_addr) continue; } + if (a == b) + { +#ifdef DEBUG + print_str_debug("Skipping swap from ourself to ourself\n"); +#endif + continue; + } + dt_table_swap_entry_contents(table_addr, a, b); /* * Rewrite a. @@ -745,6 +754,9 @@ void zipr_hook_start(unsigned long long id, print_str_debug("ra:"); print_unsigned_long_long_debug(ra); print_str_debug("\n"); + print_str_debug("global_table_addr:"); + print_unsigned_long_long_debug(id); + print_str_debug("\n"); #endif global_table_addr = (void*)id; @@ -753,6 +765,7 @@ void zipr_hook_start(unsigned long long id, void zipr_hook_dynamic_callback(unsigned int id, unsigned long long rax, unsigned long long rsp) { + print_str_debug("zipr_hook_dynamic_callback()\n"); zipr_mixr(global_table_addr); } -- GitLab