Lines Matching +full:next +full:- +full:level +full:- +full:cache

7  *   See the COPYING file in the top-level directory.
16 #include <qemu-plugin.h>
61 GString *s = c->last_exec; in vcpu_mem()
92 for (int n = 0; n < cpu->registers->len; n++) { in insn_check_regs()
93 Register *reg = cpu->registers->pdata[n]; in insn_check_regs()
96 g_byte_array_set_size(reg->new, 0); in insn_check_regs()
97 sz = qemu_plugin_read_register(reg->handle, reg->new); in insn_check_regs()
98 g_assert(sz == reg->last->len); in insn_check_regs()
100 if (memcmp(reg->last->data, reg->new->data, sz)) { in insn_check_regs()
101 GByteArray *temp = reg->last; in insn_check_regs()
102 g_string_append_printf(cpu->last_exec, ", %s -> 0x", reg->name); in insn_check_regs()
104 for (int i = sz - 1; i >= 0; i--) { in insn_check_regs()
105 g_string_append_printf(cpu->last_exec, "%02x", in insn_check_regs()
106 reg->new->data[i]); in insn_check_regs()
108 reg->last = reg->new; in insn_check_regs()
109 reg->new = temp; in insn_check_regs()
119 /* Print previous instruction in cache */ in vcpu_insn_exec_with_regs()
120 if (cpu->last_exec->len) { in vcpu_insn_exec_with_regs()
121 if (cpu->registers) { in vcpu_insn_exec_with_regs()
125 qemu_plugin_outs(cpu->last_exec->str); in vcpu_insn_exec_with_regs()
129 /* Store new instruction in cache */ in vcpu_insn_exec_with_regs()
131 g_string_printf(cpu->last_exec, "%u, ", cpu_index); in vcpu_insn_exec_with_regs()
132 g_string_append(cpu->last_exec, (char *)udata); in vcpu_insn_exec_with_regs()
135 /* Log last instruction while checking registers, ignore next */
140 /* Print previous instruction in cache */ in vcpu_insn_exec_only_regs()
141 if (cpu->last_exec->len) { in vcpu_insn_exec_only_regs()
142 if (cpu->registers) { in vcpu_insn_exec_only_regs()
146 qemu_plugin_outs(cpu->last_exec->str); in vcpu_insn_exec_only_regs()
151 cpu->last_exec->len = 0; in vcpu_insn_exec_only_regs()
154 /* Log last instruction without checking regs, setup next */
159 /* Print previous instruction in cache */ in vcpu_insn_exec()
160 if (cpu->last_exec->len) { in vcpu_insn_exec()
161 qemu_plugin_outs(cpu->last_exec->str); in vcpu_insn_exec()
165 /* Store new instruction in cache */ in vcpu_insn_exec()
167 g_string_printf(cpu->last_exec, "%u, ", cpu_index); in vcpu_insn_exec()
168 g_string_append(cpu->last_exec, (char *)udata); in vcpu_insn_exec()
204 * checking on the next instruction. in vcpu_tb_trans()
208 for (j = 0; j < imatches->len && skip; j++) { in vcpu_tb_trans()
219 for (j = 0; j < amatches->len && skip; j++) { in vcpu_tb_trans()
235 gchar *args = g_strstr_len(insn_disas, -1, " "); in vcpu_tb_trans()
236 for (int n = 0; n < all_reg_names->len; n++) { in vcpu_tb_trans()
248 * - Log insn in vcpu_tb_trans()
249 * - Log insn while checking registers in vcpu_tb_trans()
250 * - Don't log this insn but check if last insn changed registers in vcpu_tb_trans()
289 /* set regs for next */ in vcpu_tb_trans()
301 g_autofree gchar *lower = g_utf8_strdown(desc->name, -1); in init_vcpu_register()
304 reg->handle = desc->handle; in init_vcpu_register()
305 reg->name = g_intern_string(lower); in init_vcpu_register()
306 reg->last = g_byte_array_new(); in init_vcpu_register()
307 reg->new = g_byte_array_new(); in init_vcpu_register()
310 r = qemu_plugin_read_register(reg->handle, reg->last); in init_vcpu_register()
338 if (rmatches && reg_list->len) { in registers_init()
343 for (int r = 0; r < reg_list->len; r++) { in registers_init()
346 for (int p = 0; p < rmatches->len; p++) { in registers_init()
347 g_autoptr(GPatternSpec) pat = g_pattern_spec_new(rmatches->pdata[p]); in registers_init()
348 g_autofree gchar *rd_lower = g_utf8_strdown(rd->name, -1); in registers_init()
349 if (g_pattern_spec_match_string(pat, rd->name) || in registers_init()
357 if (!g_ptr_array_find(all_reg_names, reg->name, NULL)) { in registers_init()
358 g_ptr_array_add(all_reg_names, (gpointer)reg->name); in registers_init()
367 return registers->len ? g_steal_pointer(&registers) : NULL; in registers_init()
372 * - last_exec tracking data
373 * - list of tracked registers
374 * - initial value of registers
384 if (vcpu_index >= cpus->len) { in vcpu_init()
390 c->last_exec = g_string_new(NULL); in vcpu_init()
391 c->registers = registers_init(vcpu_index); in vcpu_init()
395 * On plugin exit, print last instruction in cache
401 for (i = 0; i < cpus->len; i++) { in plugin_exit()
403 if (c->last_exec && c->last_exec->str) { in plugin_exit()
404 qemu_plugin_outs(c->last_exec->str); in plugin_exit()
450 * Initialize dynamic array to cache vCPU instruction. In user mode in qemu_plugin_install()
454 info->system_emulation ? info->system.max_vcpus : 1); in qemu_plugin_install()
468 return -1; in qemu_plugin_install()
473 return -1; in qemu_plugin_install()