Lines Matching +full:0 +full:- +full:mon
2 * Miscellaneous target-dependent HMP commands
4 * Copyright (c) 2003-2004 Fabrice Bellard
27 #include "exec/address-spaces.h"
29 #include "monitor/hmp-target.h"
30 #include "monitor/monitor-internal.h"
36 int monitor_set_cpu(Monitor *mon, int cpu_index) in monitor_set_cpu() argument
42 return -1; in monitor_set_cpu()
44 g_free(mon->mon_cpu_path); in monitor_set_cpu()
45 mon->mon_cpu_path = object_get_canonical_path(OBJECT(cpu)); in monitor_set_cpu()
46 return 0; in monitor_set_cpu()
50 static CPUState *mon_get_cpu_sync(Monitor *mon, bool synchronize) in mon_get_cpu_sync() argument
54 if (mon->mon_cpu_path) { in mon_get_cpu_sync()
55 cpu = (CPUState *) object_resolve_path_type(mon->mon_cpu_path, in mon_get_cpu_sync()
58 g_free(mon->mon_cpu_path); in mon_get_cpu_sync()
59 mon->mon_cpu_path = NULL; in mon_get_cpu_sync()
62 if (!mon->mon_cpu_path) { in mon_get_cpu_sync()
66 monitor_set_cpu(mon, first_cpu->cpu_index); in mon_get_cpu_sync()
76 CPUState *mon_get_cpu(Monitor *mon) in mon_get_cpu() argument
78 return mon_get_cpu_sync(mon, true); in mon_get_cpu()
81 CPUArchState *mon_get_cpu_env(Monitor *mon) in mon_get_cpu_env() argument
83 CPUState *cs = mon_get_cpu(mon); in mon_get_cpu_env()
88 int monitor_get_cpu_index(Monitor *mon) in monitor_get_cpu_index() argument
90 CPUState *cs = mon_get_cpu_sync(mon, false); in monitor_get_cpu_index()
92 return cs ? cs->cpu_index : UNASSIGNED_CPU_INDEX; in monitor_get_cpu_index()
95 void hmp_info_registers(Monitor *mon, const QDict *qdict) in hmp_info_registers() argument
98 int vcpu = qdict_get_try_int(qdict, "vcpu", -1); in hmp_info_registers()
103 monitor_printf(mon, "\nCPU#%d\n", cs->cpu_index); in hmp_info_registers()
107 cs = vcpu >= 0 ? qemu_get_cpu(vcpu) : mon_get_cpu(mon); in hmp_info_registers()
110 if (vcpu >= 0) { in hmp_info_registers()
111 monitor_printf(mon, "CPU#%d not available\n", vcpu); in hmp_info_registers()
113 monitor_printf(mon, "No CPU available\n"); in hmp_info_registers()
118 monitor_printf(mon, "\nCPU#%d\n", cs->cpu_index); in hmp_info_registers()
123 static void memory_dump(Monitor *mon, int count, int format, int wsize, in memory_dump() argument
129 CPUState *cs = mon_get_cpu(mon); in memory_dump()
132 monitor_printf(mon, "Can not dump without CPU\n"); in memory_dump()
137 monitor_disas(mon, cs, addr, count, is_physical); in memory_dump()
147 max_digits = 0; in memory_dump()
166 while (len > 0) { in memory_dump()
168 monitor_printf(mon, HWADDR_FMT_plx ":", addr); in memory_dump()
170 monitor_printf(mon, TARGET_FMT_lx ":", (target_ulong)addr); in memory_dump()
176 AddressSpace *as = cs ? cs->as : &address_space_memory; in memory_dump()
180 monitor_printf(mon, " Cannot access memory\n"); in memory_dump()
184 if (cpu_memory_rw_debug(cs, addr, buf, l, 0) < 0) { in memory_dump()
185 monitor_printf(mon, " Cannot access memory\n"); in memory_dump()
189 i = 0; in memory_dump()
206 monitor_printf(mon, " "); in memory_dump()
209 monitor_printf(mon, "%#*" PRIo64, max_digits, v); in memory_dump()
212 monitor_printf(mon, "0x%0*" PRIx64, max_digits, v); in memory_dump()
215 monitor_printf(mon, "%*" PRIu64, max_digits, v); in memory_dump()
218 monitor_printf(mon, "%*" PRId64, max_digits, v); in memory_dump()
221 monitor_printc(mon, v); in memory_dump()
226 monitor_printf(mon, "\n"); in memory_dump()
228 len -= l; in memory_dump()
232 void hmp_memory_dump(Monitor *mon, const QDict *qdict) in hmp_memory_dump() argument
239 memory_dump(mon, count, format, size, addr, 0); in hmp_memory_dump()
242 void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict) in hmp_physical_memory_dump() argument
249 memory_dump(mon, count, format, size, addr, 1); in hmp_physical_memory_dump()
259 error_setg(errp, "No memory is mapped at address 0x%" HWADDR_PRIx, addr); in gpa2hva()
264 error_setg(errp, "Memory at address 0x%" HWADDR_PRIx " is not RAM", addr); in gpa2hva()
271 error_setg(errp, "Size of memory region at 0x%" HWADDR_PRIx in gpa2hva()
278 return qemu_map_ram_ptr(mrs.mr->ram_block, mrs.offset_within_region); in gpa2hva()
281 void hmp_gpa2hva(Monitor *mon, const QDict *qdict) in hmp_gpa2hva() argument
294 monitor_printf(mon, "Host virtual address for 0x%" HWADDR_PRIx in hmp_gpa2hva()
296 addr, mr->name, ptr); in hmp_gpa2hva()
301 void hmp_gva2gpa(Monitor *mon, const QDict *qdict) in hmp_gva2gpa() argument
305 CPUState *cs = mon_get_cpu(mon); in hmp_gva2gpa()
309 monitor_printf(mon, "No cpu\n"); in hmp_gva2gpa()
314 if (gpa == -1) { in hmp_gva2gpa()
315 monitor_printf(mon, "Unmapped\n"); in hmp_gva2gpa()
317 monitor_printf(mon, "gpa: %#" HWADDR_PRIx "\n", in hmp_gva2gpa()
326 uint64_t ret = -1; in vtop()
333 if (fd == -1) { in vtop()
335 return -1; in vtop()
338 /* Force copy-on-write if necessary. */ in vtop()
339 qatomic_add((uint8_t *)ptr, 0); in vtop()
345 if ((pinfo & (1ull << 63)) == 0) { in vtop()
349 ret = ((pinfo & 0x007fffffffffffffull) * pagesize) | (addr & (pagesize - 1)); in vtop()
356 void hmp_gpa2hpa(Monitor *mon, const QDict *qdict) in hmp_gpa2hpa() argument
374 monitor_printf(mon, "Host physical address for 0x%" HWADDR_PRIx in hmp_gpa2hpa()
375 " (%s) is 0x%" PRIx64 "\n", in hmp_gpa2hpa()
376 addr, mr->name, (uint64_t) physaddr); in hmp_gpa2hpa()