Lines Matching +full:non +full:- +full:pc

9  * SPDX-License-Identifier: GPL-2.0-or-later
18 #include <qemu-plugin.h>
60 /* mid-block insn, can only be an exception */
81 /* next pc after end of block */
83 /* address of last executed PC */
103 return na->dest_count > nb->dest_count ? -1 : in hottest()
104 na->dest_count == nb->dest_count ? 0 : 1; in hottest()
112 return na->early_exit > nb->early_exit ? -1 : in exception()
113 na->early_exit == nb->early_exit ? 0 : 1; in exception()
121 return na->dests->len > nb->dests->len ? -1 : in popular()
122 na->dests->len == nb->dests->len ? 0 : 1; in popular()
125 /* Filter out non-branches - returns true to remove entry */
131 return node->dest_count == 0; in filter_non_branches()
166 l = l->next, i++) { in plugin_exit()
167 NodeData *n = l->data; in plugin_exit()
168 const char *type = n->mid_count ? "sync fault" : "branch"; in plugin_exit()
170 n->addr, n->symbol, n->insn_disas, type); in plugin_exit()
171 if (n->early_exit) { in plugin_exit()
173 n->early_exit); in plugin_exit()
176 n->dest_count); in plugin_exit()
177 for (int j = 0; j < n->dests->len; j++) { in plugin_exit()
178 DestData *dd = &g_array_index(n->dests, DestData, j); in plugin_exit()
180 dd->daddr, dd->dcount); in plugin_exit()
184 qemu_plugin_outs(result->str); in plugin_exit()
207 g_mutex_init(&node->lock); in create_node()
208 node->addr = addr; in create_node()
209 node->dests = g_array_new(true, true, sizeof(DestData)); in create_node()
228 * Called when we detect a non-linear execution (pc !=
237 uint64_t pc = GPOINTER_TO_UINT(udata); in vcpu_tb_branched_exec() local
250 g_assert(pc != npc); in vcpu_tb_branched_exec()
252 g_mutex_lock(&node->lock); in vcpu_tb_branched_exec()
255 fprintf(stderr, "%s: pc=%"PRIx64", epbc=%"PRIx64 in vcpu_tb_branched_exec()
257 __func__, pc, ebpc, npc, lpc); in vcpu_tb_branched_exec()
258 node->early_exit++; in vcpu_tb_branched_exec()
259 if (!node->mid_count) { in vcpu_tb_branched_exec()
261 node->mid_count++; in vcpu_tb_branched_exec()
265 dests = node->dests; in vcpu_tb_branched_exec()
266 for (int i = 0; i < dests->len; i++) { in vcpu_tb_branched_exec()
267 if (g_array_index(dests, DestData, i).daddr == pc) { in vcpu_tb_branched_exec()
274 DestData new_entry = { .daddr = pc }; in vcpu_tb_branched_exec()
276 data = &g_array_index(dests, DestData, dests->len - 1); in vcpu_tb_branched_exec()
277 g_assert(data->daddr == pc); in vcpu_tb_branched_exec()
280 data->dcount++; in vcpu_tb_branched_exec()
281 node->dest_count++; in vcpu_tb_branched_exec()
283 g_mutex_unlock(&node->lock); in vcpu_tb_branched_exec()
289 * - is last_pc == block_end, if not we had an early exit
290 * - is start of block last_pc + insn width, if not we jumped
298 uint64_t pc = qemu_plugin_tb_vaddr(tb); in vcpu_tb_trans() local
301 struct qemu_plugin_insn *last_insn = qemu_plugin_tb_get_insn(tb, insns - 1); in vcpu_tb_trans()
308 gpointer udata = GUINT_TO_POINTER(pc); in vcpu_tb_trans()
311 QEMU_PLUGIN_COND_NE, pc_after_block, pc, udata); in vcpu_tb_trans()
337 g_mutex_lock(&node->lock); in vcpu_tb_trans()
338 if (!node->insn_disas) { in vcpu_tb_trans()
339 node->insn_disas = qemu_plugin_insn_disas(insn); in vcpu_tb_trans()
341 if (!node->symbol) { in vcpu_tb_trans()
342 node->symbol = qemu_plugin_insn_symbol(insn); in vcpu_tb_trans()
345 node->last_count++; in vcpu_tb_trans()
347 node->mid_count++; in vcpu_tb_trans()
349 g_mutex_unlock(&node->lock); in vcpu_tb_trans()
352 /* Store the PC of what we are about to execute */ in vcpu_tb_trans()
375 return -1; in qemu_plugin_install()
379 return -1; in qemu_plugin_install()