@@ -208,7 +208,7 @@ static int fifo_get_first_block(Cache *cache, int set)
208
208
static void fifo_update_on_miss (Cache * cache , int set , int blk_idx )
209
209
{
210
210
GQueue * q = cache -> sets [set ].fifo_queue ;
211
- g_queue_push_head (q , GINT_TO_POINTER ( blk_idx ) );
211
+ g_queue_push_head (q , ( gpointer )( intptr_t ) blk_idx );
212
212
}
213
213
214
214
static void fifo_destroy (Cache * cache )
@@ -471,28 +471,22 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
471
471
n_insns = qemu_plugin_tb_n_insns (tb );
472
472
for (i = 0 ; i < n_insns ; i ++ ) {
473
473
struct qemu_plugin_insn * insn = qemu_plugin_tb_get_insn (tb , i );
474
- uint64_t effective_addr ;
475
-
476
- if (sys ) {
477
- effective_addr = (uint64_t ) qemu_plugin_insn_haddr (insn );
478
- } else {
479
- effective_addr = (uint64_t ) qemu_plugin_insn_vaddr (insn );
480
- }
474
+ uint64_t effective_addr = sys ? (uintptr_t ) qemu_plugin_insn_haddr (insn ) :
475
+ qemu_plugin_insn_vaddr (insn );
481
476
482
477
/*
483
478
* Instructions might get translated multiple times, we do not create
484
479
* new entries for those instructions. Instead, we fetch the same
485
480
* entry from the hash table and register it for the callback again.
486
481
*/
487
482
g_mutex_lock (& hashtable_lock );
488
- data = g_hash_table_lookup (miss_ht , GUINT_TO_POINTER ( effective_addr ) );
483
+ data = g_hash_table_lookup (miss_ht , & effective_addr );
489
484
if (data == NULL ) {
490
485
data = g_new0 (InsnData , 1 );
491
486
data -> disas_str = qemu_plugin_insn_disas (insn );
492
487
data -> symbol = qemu_plugin_insn_symbol (insn );
493
488
data -> addr = effective_addr ;
494
- g_hash_table_insert (miss_ht , GUINT_TO_POINTER (effective_addr ),
495
- (gpointer ) data );
489
+ g_hash_table_insert (miss_ht , & data -> addr , data );
496
490
}
497
491
g_mutex_unlock (& hashtable_lock );
498
492
@@ -853,7 +847,7 @@ int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info,
853
847
qemu_plugin_register_vcpu_tb_trans_cb (id , vcpu_tb_trans );
854
848
qemu_plugin_register_atexit_cb (id , plugin_exit , NULL );
855
849
856
- miss_ht = g_hash_table_new_full (NULL , g_direct_equal , NULL , insn_free );
850
+ miss_ht = g_hash_table_new_full (g_int64_hash , g_int64_equal , NULL , insn_free );
857
851
858
852
return 0 ;
859
853
}
0 commit comments