mirror of https://github.com/xemu-project/xemu.git
Error reporting & monitor patches for 2019-04-18
-----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJcuODJAAoJEDhwtADrkYZT/lkP/3qJSysT3ZD5Aa9PvEQmor+e 1N8Q37EbCug0Jl3tSmUGw6g5R8qZdX8UJEJRaGbtPE6sbjGpedalhu/3O8jKWVDg Vv+nrB4M6UAyk2LsjiA1p9eDc8flnGKvbGBjpOEEn7FlSfkWgz2l/6oFV8bm3r8h TxpnlD50yBRxzr8aC6lXc80kKJhnXWCh4m2yq06qZgnilQS8OBnTMZoqr9L4wir4 O/4OfmZfdDPYgMZb8vnxk4JEyVk2yAbjezR6uB1gcR5Pdv05v6UtunQrJAQDwaW+ q0OVOTj9njArlIdu/jTfhFOlQRv7ti9vMlmQ9QxiicfbL4aX0v2chZHsif6PH+0f kB1yLP+MDQMMS5MiFecCxIHpR7IrwfkC9AfOLp8xw+dRvb4ePJNDKD5a2+UymxbM wEtnVAUXC1cCdV87jSTXEShTp2glPJc0rxIpPYX5ESjJyoTdVnEwQRaD1WkVTzgD GciF6UtPZJNBEvTta+GeyPAmPnsuibpHmyIPeL5HrpgEV68b4Ds6BRVwbsrq0U6g fbbVGZSej6OrMCVHXY1NmrBaNFz9/5RKvi9m+Bmhx5W2K8lU9cxmdrKNKYuGsEly Ju6+SR6oi15P4ntM2lkywbaA+m8FV04eRh4xRcbWV9ac9M6V6phFvM4ECl3RaA0h 25TGutCc9N1AXHUyTMGH =kfAU -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/armbru/tags/pull-error-monitor-2019-04-18' into staging Error reporting & monitor patches for 2019-04-18 # gpg: Signature made Thu 18 Apr 2019 21:40:41 BST # gpg: using RSA key 3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-error-monitor-2019-04-18: (36 commits) include: Move fprintf_function to disas/ disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h monitor: Clean up how monitor_disas() funnels output to monitor qom/cpu: Simplify how CPUClass:cpu_dump_state() prints qemu-print: New qemu_fprintf(), qemu_vfprintf() qom/cpu: Simplify how CPUClass::dump_statistics() prints target/i386: Simplify how x86_cpu_dump_local_apic_state() prints target: Clean up how the dump_mmu() print target: Simplify how the TARGET_cpu_list() print memory: Clean up how mtree_info() prints block/qapi: Clean up how we print to monitor or stdout qsp: Simplify how qsp_report() prints tcg: Simplify how dump_drift_info() prints tcg: Simplify how dump_exec_info() prints tcg: Simplify how dump_opcount_info() prints trace: Simplify how st_print_trace_file_status() prints include: Include fprintf-fn.h only where needed monitor: Simplify how -device/device_add print help char-pty: Print "char device redirected" message to stdout char: Make -chardev help print to stdout ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
c4e9f845f6
|
@ -1895,6 +1895,8 @@ F: hmp.[ch]
|
|||
F: hmp-commands*.hx
|
||||
F: include/monitor/hmp-target.h
|
||||
F: tests/test-hmp.c
|
||||
F: include/qemu/qemu-print.h
|
||||
F: util/qemu-print.c
|
||||
|
||||
Network device backends
|
||||
M: Jason Wang <jasowang@redhat.com>
|
||||
|
|
|
@ -1798,7 +1798,7 @@ static int kvm_handle_internal_error(CPUState *cpu, struct kvm_run *run)
|
|||
if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION) {
|
||||
fprintf(stderr, "emulation failure\n");
|
||||
if (!kvm_arch_stop_on_emulation_error(cpu)) {
|
||||
cpu_dump_state(cpu, stderr, fprintf, CPU_DUMP_CODE);
|
||||
cpu_dump_state(cpu, stderr, CPU_DUMP_CODE);
|
||||
return EXCP_INTERRUPT;
|
||||
}
|
||||
}
|
||||
|
@ -2089,7 +2089,7 @@ int kvm_cpu_exec(CPUState *cpu)
|
|||
qemu_mutex_lock_iothread();
|
||||
|
||||
if (ret < 0) {
|
||||
cpu_dump_state(cpu, stderr, fprintf, CPU_DUMP_CODE);
|
||||
cpu_dump_state(cpu, stderr, CPU_DUMP_CODE);
|
||||
vm_stop(RUN_STATE_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "translate-all.h"
|
||||
#include "qemu/bitmap.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "exec/log.h"
|
||||
|
@ -2214,8 +2215,7 @@ void tb_flush_jmp_cache(CPUState *cpu, target_ulong addr)
|
|||
tb_jmp_cache_clear_page(cpu, addr);
|
||||
}
|
||||
|
||||
static void print_qht_statistics(FILE *f, fprintf_function cpu_fprintf,
|
||||
struct qht_stats hst)
|
||||
static void print_qht_statistics(struct qht_stats hst)
|
||||
{
|
||||
uint32_t hgram_opts;
|
||||
size_t hgram_bins;
|
||||
|
@ -2224,7 +2224,7 @@ static void print_qht_statistics(FILE *f, fprintf_function cpu_fprintf,
|
|||
if (!hst.head_buckets) {
|
||||
return;
|
||||
}
|
||||
cpu_fprintf(f, "TB hash buckets %zu/%zu (%0.2f%% head buckets used)\n",
|
||||
qemu_printf("TB hash buckets %zu/%zu (%0.2f%% head buckets used)\n",
|
||||
hst.used_head_buckets, hst.head_buckets,
|
||||
(double)hst.used_head_buckets / hst.head_buckets * 100);
|
||||
|
||||
|
@ -2234,7 +2234,7 @@ static void print_qht_statistics(FILE *f, fprintf_function cpu_fprintf,
|
|||
hgram_opts |= QDIST_PR_NODECIMAL;
|
||||
}
|
||||
hgram = qdist_pr(&hst.occupancy, 10, hgram_opts);
|
||||
cpu_fprintf(f, "TB hash occupancy %0.2f%% avg chain occ. Histogram: %s\n",
|
||||
qemu_printf("TB hash occupancy %0.2f%% avg chain occ. Histogram: %s\n",
|
||||
qdist_avg(&hst.occupancy) * 100, hgram);
|
||||
g_free(hgram);
|
||||
|
||||
|
@ -2247,7 +2247,7 @@ static void print_qht_statistics(FILE *f, fprintf_function cpu_fprintf,
|
|||
hgram_opts |= QDIST_PR_NODECIMAL | QDIST_PR_NOBINRANGE;
|
||||
}
|
||||
hgram = qdist_pr(&hst.chain, hgram_bins, hgram_opts);
|
||||
cpu_fprintf(f, "TB hash avg chain %0.3f buckets. Histogram: %s\n",
|
||||
qemu_printf("TB hash avg chain %0.3f buckets. Histogram: %s\n",
|
||||
qdist_avg(&hst.chain), hgram);
|
||||
g_free(hgram);
|
||||
}
|
||||
|
@ -2285,7 +2285,7 @@ static gboolean tb_tree_stats_iter(gpointer key, gpointer value, gpointer data)
|
|||
return false;
|
||||
}
|
||||
|
||||
void dump_exec_info(FILE *f, fprintf_function cpu_fprintf)
|
||||
void dump_exec_info(void)
|
||||
{
|
||||
struct tb_tree_stats tst = {};
|
||||
struct qht_stats hst;
|
||||
|
@ -2294,48 +2294,49 @@ void dump_exec_info(FILE *f, fprintf_function cpu_fprintf)
|
|||
tcg_tb_foreach(tb_tree_stats_iter, &tst);
|
||||
nb_tbs = tst.nb_tbs;
|
||||
/* XXX: avoid using doubles ? */
|
||||
cpu_fprintf(f, "Translation buffer state:\n");
|
||||
qemu_printf("Translation buffer state:\n");
|
||||
/*
|
||||
* Report total code size including the padding and TB structs;
|
||||
* otherwise users might think "-tb-size" is not honoured.
|
||||
* For avg host size we use the precise numbers from tb_tree_stats though.
|
||||
*/
|
||||
cpu_fprintf(f, "gen code size %zu/%zu\n",
|
||||
qemu_printf("gen code size %zu/%zu\n",
|
||||
tcg_code_size(), tcg_code_capacity());
|
||||
cpu_fprintf(f, "TB count %zu\n", nb_tbs);
|
||||
cpu_fprintf(f, "TB avg target size %zu max=%zu bytes\n",
|
||||
qemu_printf("TB count %zu\n", nb_tbs);
|
||||
qemu_printf("TB avg target size %zu max=%zu bytes\n",
|
||||
nb_tbs ? tst.target_size / nb_tbs : 0,
|
||||
tst.max_target_size);
|
||||
cpu_fprintf(f, "TB avg host size %zu bytes (expansion ratio: %0.1f)\n",
|
||||
qemu_printf("TB avg host size %zu bytes (expansion ratio: %0.1f)\n",
|
||||
nb_tbs ? tst.host_size / nb_tbs : 0,
|
||||
tst.target_size ? (double)tst.host_size / tst.target_size : 0);
|
||||
cpu_fprintf(f, "cross page TB count %zu (%zu%%)\n", tst.cross_page,
|
||||
nb_tbs ? (tst.cross_page * 100) / nb_tbs : 0);
|
||||
cpu_fprintf(f, "direct jump count %zu (%zu%%) (2 jumps=%zu %zu%%)\n",
|
||||
qemu_printf("cross page TB count %zu (%zu%%)\n", tst.cross_page,
|
||||
nb_tbs ? (tst.cross_page * 100) / nb_tbs : 0);
|
||||
qemu_printf("direct jump count %zu (%zu%%) (2 jumps=%zu %zu%%)\n",
|
||||
tst.direct_jmp_count,
|
||||
nb_tbs ? (tst.direct_jmp_count * 100) / nb_tbs : 0,
|
||||
tst.direct_jmp2_count,
|
||||
nb_tbs ? (tst.direct_jmp2_count * 100) / nb_tbs : 0);
|
||||
|
||||
qht_statistics_init(&tb_ctx.htable, &hst);
|
||||
print_qht_statistics(f, cpu_fprintf, hst);
|
||||
print_qht_statistics(hst);
|
||||
qht_statistics_destroy(&hst);
|
||||
|
||||
cpu_fprintf(f, "\nStatistics:\n");
|
||||
cpu_fprintf(f, "TB flush count %u\n",
|
||||
qemu_printf("\nStatistics:\n");
|
||||
qemu_printf("TB flush count %u\n",
|
||||
atomic_read(&tb_ctx.tb_flush_count));
|
||||
cpu_fprintf(f, "TB invalidate count %zu\n", tcg_tb_phys_invalidate_count());
|
||||
qemu_printf("TB invalidate count %zu\n",
|
||||
tcg_tb_phys_invalidate_count());
|
||||
|
||||
tlb_flush_counts(&flush_full, &flush_part, &flush_elide);
|
||||
cpu_fprintf(f, "TLB full flushes %zu\n", flush_full);
|
||||
cpu_fprintf(f, "TLB partial flushes %zu\n", flush_part);
|
||||
cpu_fprintf(f, "TLB elided flushes %zu\n", flush_elide);
|
||||
tcg_dump_info(f, cpu_fprintf);
|
||||
qemu_printf("TLB full flushes %zu\n", flush_full);
|
||||
qemu_printf("TLB partial flushes %zu\n", flush_part);
|
||||
qemu_printf("TLB elided flushes %zu\n", flush_elide);
|
||||
tcg_dump_info();
|
||||
}
|
||||
|
||||
void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf)
|
||||
void dump_opcount_info(void)
|
||||
{
|
||||
tcg_dump_op_count(f, cpu_fprintf);
|
||||
tcg_dump_op_count();
|
||||
}
|
||||
|
||||
#else /* CONFIG_USER_ONLY */
|
||||
|
|
120
block/qapi.c
120
block/qapi.c
|
@ -36,6 +36,7 @@
|
|||
#include "qapi/qmp/qlist.h"
|
||||
#include "qapi/qmp/qnum.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "qemu/cutils.h"
|
||||
|
||||
|
@ -660,8 +661,7 @@ static char *get_human_readable_size(char *buf, int buf_size, int64_t size)
|
|||
return buf;
|
||||
}
|
||||
|
||||
void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f,
|
||||
QEMUSnapshotInfo *sn)
|
||||
void bdrv_snapshot_dump(QEMUSnapshotInfo *sn)
|
||||
{
|
||||
char buf1[128], date_buf[128], clock_buf[128];
|
||||
struct tm tm;
|
||||
|
@ -669,9 +669,8 @@ void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f,
|
|||
int64_t secs;
|
||||
|
||||
if (!sn) {
|
||||
func_fprintf(f,
|
||||
"%-10s%-20s%7s%20s%15s",
|
||||
"ID", "TAG", "VM SIZE", "DATE", "VM CLOCK");
|
||||
qemu_printf("%-10s%-20s%7s%20s%15s",
|
||||
"ID", "TAG", "VM SIZE", "DATE", "VM CLOCK");
|
||||
} else {
|
||||
ti = sn->date_sec;
|
||||
localtime_r(&ti, &tm);
|
||||
|
@ -684,50 +683,46 @@ void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f,
|
|||
(int)((secs / 60) % 60),
|
||||
(int)(secs % 60),
|
||||
(int)((sn->vm_clock_nsec / 1000000) % 1000));
|
||||
func_fprintf(f,
|
||||
"%-10s%-20s%7s%20s%15s",
|
||||
sn->id_str, sn->name,
|
||||
get_human_readable_size(buf1, sizeof(buf1),
|
||||
sn->vm_state_size),
|
||||
date_buf,
|
||||
clock_buf);
|
||||
qemu_printf("%-10s%-20s%7s%20s%15s",
|
||||
sn->id_str, sn->name,
|
||||
get_human_readable_size(buf1, sizeof(buf1),
|
||||
sn->vm_state_size),
|
||||
date_buf,
|
||||
clock_buf);
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_qdict(fprintf_function func_fprintf, void *f, int indentation,
|
||||
QDict *dict);
|
||||
static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation,
|
||||
QList *list);
|
||||
static void dump_qdict(int indentation, QDict *dict);
|
||||
static void dump_qlist(int indentation, QList *list);
|
||||
|
||||
static void dump_qobject(fprintf_function func_fprintf, void *f,
|
||||
int comp_indent, QObject *obj)
|
||||
static void dump_qobject(int comp_indent, QObject *obj)
|
||||
{
|
||||
switch (qobject_type(obj)) {
|
||||
case QTYPE_QNUM: {
|
||||
QNum *value = qobject_to(QNum, obj);
|
||||
char *tmp = qnum_to_string(value);
|
||||
func_fprintf(f, "%s", tmp);
|
||||
qemu_printf("%s", tmp);
|
||||
g_free(tmp);
|
||||
break;
|
||||
}
|
||||
case QTYPE_QSTRING: {
|
||||
QString *value = qobject_to(QString, obj);
|
||||
func_fprintf(f, "%s", qstring_get_str(value));
|
||||
qemu_printf("%s", qstring_get_str(value));
|
||||
break;
|
||||
}
|
||||
case QTYPE_QDICT: {
|
||||
QDict *value = qobject_to(QDict, obj);
|
||||
dump_qdict(func_fprintf, f, comp_indent, value);
|
||||
dump_qdict(comp_indent, value);
|
||||
break;
|
||||
}
|
||||
case QTYPE_QLIST: {
|
||||
QList *value = qobject_to(QList, obj);
|
||||
dump_qlist(func_fprintf, f, comp_indent, value);
|
||||
dump_qlist(comp_indent, value);
|
||||
break;
|
||||
}
|
||||
case QTYPE_QBOOL: {
|
||||
QBool *value = qobject_to(QBool, obj);
|
||||
func_fprintf(f, "%s", qbool_get_bool(value) ? "true" : "false");
|
||||
qemu_printf("%s", qbool_get_bool(value) ? "true" : "false");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -735,8 +730,7 @@ static void dump_qobject(fprintf_function func_fprintf, void *f,
|
|||
}
|
||||
}
|
||||
|
||||
static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation,
|
||||
QList *list)
|
||||
static void dump_qlist(int indentation, QList *list)
|
||||
{
|
||||
const QListEntry *entry;
|
||||
int i = 0;
|
||||
|
@ -744,17 +738,16 @@ static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation,
|
|||
for (entry = qlist_first(list); entry; entry = qlist_next(entry), i++) {
|
||||
QType type = qobject_type(entry->value);
|
||||
bool composite = (type == QTYPE_QDICT || type == QTYPE_QLIST);
|
||||
func_fprintf(f, "%*s[%i]:%c", indentation * 4, "", i,
|
||||
composite ? '\n' : ' ');
|
||||
dump_qobject(func_fprintf, f, indentation + 1, entry->value);
|
||||
qemu_printf("%*s[%i]:%c", indentation * 4, "", i,
|
||||
composite ? '\n' : ' ');
|
||||
dump_qobject(indentation + 1, entry->value);
|
||||
if (!composite) {
|
||||
func_fprintf(f, "\n");
|
||||
qemu_printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_qdict(fprintf_function func_fprintf, void *f, int indentation,
|
||||
QDict *dict)
|
||||
static void dump_qdict(int indentation, QDict *dict)
|
||||
{
|
||||
const QDictEntry *entry;
|
||||
|
||||
|
@ -769,18 +762,17 @@ static void dump_qdict(fprintf_function func_fprintf, void *f, int indentation,
|
|||
key[i] = entry->key[i] == '-' ? ' ' : entry->key[i];
|
||||
}
|
||||
key[i] = 0;
|
||||
func_fprintf(f, "%*s%s:%c", indentation * 4, "", key,
|
||||
composite ? '\n' : ' ');
|
||||
dump_qobject(func_fprintf, f, indentation + 1, entry->value);
|
||||
qemu_printf("%*s%s:%c", indentation * 4, "", key,
|
||||
composite ? '\n' : ' ');
|
||||
dump_qobject(indentation + 1, entry->value);
|
||||
if (!composite) {
|
||||
func_fprintf(f, "\n");
|
||||
qemu_printf("\n");
|
||||
}
|
||||
g_free(key);
|
||||
}
|
||||
}
|
||||
|
||||
void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,
|
||||
ImageInfoSpecific *info_spec)
|
||||
void bdrv_image_info_specific_dump(ImageInfoSpecific *info_spec)
|
||||
{
|
||||
QObject *obj, *data;
|
||||
Visitor *v = qobject_output_visitor_new(&obj);
|
||||
|
@ -788,13 +780,12 @@ void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,
|
|||
visit_type_ImageInfoSpecific(v, NULL, &info_spec, &error_abort);
|
||||
visit_complete(v, &obj);
|
||||
data = qdict_get(qobject_to(QDict, obj), "data");
|
||||
dump_qobject(func_fprintf, f, 1, data);
|
||||
dump_qobject(1, data);
|
||||
qobject_unref(obj);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void bdrv_image_info_dump(fprintf_function func_fprintf, void *f,
|
||||
ImageInfo *info)
|
||||
void bdrv_image_info_dump(ImageInfo *info)
|
||||
{
|
||||
char size_buf[128], dsize_buf[128];
|
||||
if (!info->has_actual_size) {
|
||||
|
@ -804,49 +795,48 @@ void bdrv_image_info_dump(fprintf_function func_fprintf, void *f,
|
|||
info->actual_size);
|
||||
}
|
||||
get_human_readable_size(size_buf, sizeof(size_buf), info->virtual_size);
|
||||
func_fprintf(f,
|
||||
"image: %s\n"
|
||||
"file format: %s\n"
|
||||
"virtual size: %s (%" PRId64 " bytes)\n"
|
||||
"disk size: %s\n",
|
||||
info->filename, info->format, size_buf,
|
||||
info->virtual_size,
|
||||
dsize_buf);
|
||||
qemu_printf("image: %s\n"
|
||||
"file format: %s\n"
|
||||
"virtual size: %s (%" PRId64 " bytes)\n"
|
||||
"disk size: %s\n",
|
||||
info->filename, info->format, size_buf,
|
||||
info->virtual_size,
|
||||
dsize_buf);
|
||||
|
||||
if (info->has_encrypted && info->encrypted) {
|
||||
func_fprintf(f, "encrypted: yes\n");
|
||||
qemu_printf("encrypted: yes\n");
|
||||
}
|
||||
|
||||
if (info->has_cluster_size) {
|
||||
func_fprintf(f, "cluster_size: %" PRId64 "\n",
|
||||
info->cluster_size);
|
||||
qemu_printf("cluster_size: %" PRId64 "\n",
|
||||
info->cluster_size);
|
||||
}
|
||||
|
||||
if (info->has_dirty_flag && info->dirty_flag) {
|
||||
func_fprintf(f, "cleanly shut down: no\n");
|
||||
qemu_printf("cleanly shut down: no\n");
|
||||
}
|
||||
|
||||
if (info->has_backing_filename) {
|
||||
func_fprintf(f, "backing file: %s", info->backing_filename);
|
||||
qemu_printf("backing file: %s", info->backing_filename);
|
||||
if (!info->has_full_backing_filename) {
|
||||
func_fprintf(f, " (cannot determine actual path)");
|
||||
qemu_printf(" (cannot determine actual path)");
|
||||
} else if (strcmp(info->backing_filename,
|
||||
info->full_backing_filename) != 0) {
|
||||
func_fprintf(f, " (actual path: %s)", info->full_backing_filename);
|
||||
qemu_printf(" (actual path: %s)", info->full_backing_filename);
|
||||
}
|
||||
func_fprintf(f, "\n");
|
||||
qemu_printf("\n");
|
||||
if (info->has_backing_filename_format) {
|
||||
func_fprintf(f, "backing file format: %s\n",
|
||||
info->backing_filename_format);
|
||||
qemu_printf("backing file format: %s\n",
|
||||
info->backing_filename_format);
|
||||
}
|
||||
}
|
||||
|
||||
if (info->has_snapshots) {
|
||||
SnapshotInfoList *elem;
|
||||
|
||||
func_fprintf(f, "Snapshot list:\n");
|
||||
bdrv_snapshot_dump(func_fprintf, f, NULL);
|
||||
func_fprintf(f, "\n");
|
||||
qemu_printf("Snapshot list:\n");
|
||||
bdrv_snapshot_dump(NULL);
|
||||
qemu_printf("\n");
|
||||
|
||||
/* Ideally bdrv_snapshot_dump() would operate on SnapshotInfoList but
|
||||
* we convert to the block layer's native QEMUSnapshotInfo for now.
|
||||
|
@ -862,13 +852,13 @@ void bdrv_image_info_dump(fprintf_function func_fprintf, void *f,
|
|||
|
||||
pstrcpy(sn.id_str, sizeof(sn.id_str), elem->value->id);
|
||||
pstrcpy(sn.name, sizeof(sn.name), elem->value->name);
|
||||
bdrv_snapshot_dump(func_fprintf, f, &sn);
|
||||
func_fprintf(f, "\n");
|
||||
bdrv_snapshot_dump(&sn);
|
||||
qemu_printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (info->has_format_specific) {
|
||||
func_fprintf(f, "Format specific information:\n");
|
||||
bdrv_image_info_specific_dump(func_fprintf, f, info->format_specific);
|
||||
qemu_printf("Format specific information:\n");
|
||||
bdrv_image_info_specific_dump(info->format_specific);
|
||||
}
|
||||
}
|
||||
|
|
38
block/ssh.c
38
block/ssh.c
|
@ -159,31 +159,19 @@ sftp_error_setg(Error **errp, BDRVSSHState *s, const char *fs, ...)
|
|||
g_free(msg);
|
||||
}
|
||||
|
||||
static void GCC_FMT_ATTR(2, 3)
|
||||
sftp_error_report(BDRVSSHState *s, const char *fs, ...)
|
||||
static void sftp_error_trace(BDRVSSHState *s, const char *op)
|
||||
{
|
||||
va_list args;
|
||||
char *ssh_err;
|
||||
int ssh_err_code;
|
||||
unsigned long sftp_err_code;
|
||||
|
||||
va_start(args, fs);
|
||||
error_vprintf(fs, args);
|
||||
/* This is not an errno. See <libssh2.h>. */
|
||||
ssh_err_code = libssh2_session_last_error(s->session,
|
||||
&ssh_err, NULL, 0);
|
||||
/* See <libssh2_sftp.h>. */
|
||||
sftp_err_code = libssh2_sftp_last_error((s)->sftp);
|
||||
|
||||
if ((s)->sftp) {
|
||||
char *ssh_err;
|
||||
int ssh_err_code;
|
||||
unsigned long sftp_err_code;
|
||||
|
||||
/* This is not an errno. See <libssh2.h>. */
|
||||
ssh_err_code = libssh2_session_last_error(s->session,
|
||||
&ssh_err, NULL, 0);
|
||||
/* See <libssh2_sftp.h>. */
|
||||
sftp_err_code = libssh2_sftp_last_error((s)->sftp);
|
||||
|
||||
error_printf(": %s (libssh2 error code: %d, sftp error code: %lu)",
|
||||
ssh_err, ssh_err_code, sftp_err_code);
|
||||
}
|
||||
|
||||
va_end(args);
|
||||
error_printf("\n");
|
||||
trace_sftp_error(op, ssh_err, ssh_err_code, sftp_err_code);
|
||||
}
|
||||
|
||||
static int parse_uri(const char *filename, QDict *options, Error **errp)
|
||||
|
@ -1035,7 +1023,7 @@ static coroutine_fn int ssh_read(BDRVSSHState *s, BlockDriverState *bs,
|
|||
goto again;
|
||||
}
|
||||
if (r < 0) {
|
||||
sftp_error_report(s, "read failed");
|
||||
sftp_error_trace(s, "read");
|
||||
s->offset = -1;
|
||||
return -EIO;
|
||||
}
|
||||
|
@ -1105,7 +1093,7 @@ static int ssh_write(BDRVSSHState *s, BlockDriverState *bs,
|
|||
goto again;
|
||||
}
|
||||
if (r < 0) {
|
||||
sftp_error_report(s, "write failed");
|
||||
sftp_error_trace(s, "write");
|
||||
s->offset = -1;
|
||||
return -EIO;
|
||||
}
|
||||
|
@ -1188,7 +1176,7 @@ static coroutine_fn int ssh_flush(BDRVSSHState *s, BlockDriverState *bs)
|
|||
return 0;
|
||||
}
|
||||
if (r < 0) {
|
||||
sftp_error_report(s, "fsync failed");
|
||||
sftp_error_trace(s, "fsync");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
|
|
@ -208,3 +208,6 @@ sheepdog_co_rw_vector_new(uint64_t oid) "new oid 0x%" PRIx64
|
|||
sheepdog_snapshot_create_info(const char *sn_name, const char *id, const char *name, int64_t size, int is_snapshot) "sn_info: name %s id_str %s s: name %s vm_state_size %" PRId64 " " "is_snapshot %d"
|
||||
sheepdog_snapshot_create(const char *sn_name, const char *id) "%s %s"
|
||||
sheepdog_snapshot_create_inode(const char *name, uint32_t snap, uint32_t vdi) "s->inode: name %s snap_id 0x%" PRIx32 " vdi 0x%" PRIx32
|
||||
|
||||
# ssh.c
|
||||
sftp_error(const char *op, const char *ssh_err, int ssh_err_code, unsigned long sftp_err_code) "%s failed: %s (libssh2 error code: %d, sftp error code: %lu)"
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "monitor/monitor.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "qapi/qapi-commands-block.h"
|
||||
#include "qapi/qapi-commands-transaction.h"
|
||||
|
@ -301,7 +302,7 @@ DriveInfo *drive_get_next(BlockInterfaceType type)
|
|||
|
||||
static void bdrv_format_print(void *opaque, const char *name)
|
||||
{
|
||||
error_printf(" %s", name);
|
||||
qemu_printf(" %s", name);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
@ -530,11 +531,11 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
|
|||
|
||||
if ((buf = qemu_opt_get(opts, "format")) != NULL) {
|
||||
if (is_help_option(buf)) {
|
||||
error_printf("Supported formats:");
|
||||
qemu_printf("Supported formats:");
|
||||
bdrv_iterate_format(bdrv_format_print, NULL, false);
|
||||
error_printf("\nSupported formats (read-only):");
|
||||
qemu_printf("\nSupported formats (read-only):");
|
||||
bdrv_iterate_format(bdrv_format_print, NULL, true);
|
||||
error_printf("\n");
|
||||
qemu_printf("\n");
|
||||
goto early_err;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "qapi/error.h"
|
||||
#include "qemu.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/path.h"
|
||||
#include "qemu/help_option.h"
|
||||
#include "cpu.h"
|
||||
|
@ -639,7 +640,7 @@ void cpu_loop(CPUSPARCState *env)
|
|||
badtrap:
|
||||
#endif
|
||||
printf ("Unhandled trap: 0x%x\n", trapnr);
|
||||
cpu_dump_state(cs, stderr, fprintf, 0);
|
||||
cpu_dump_state(cs, stderr, 0);
|
||||
exit (1);
|
||||
}
|
||||
process_pending_signals (env);
|
||||
|
@ -743,6 +744,7 @@ int main(int argc, char **argv)
|
|||
if (argc <= 1)
|
||||
usage();
|
||||
|
||||
error_init(argv[0]);
|
||||
module_call_init(MODULE_INIT_TRACE);
|
||||
qemu_init_cpu_list();
|
||||
module_call_init(MODULE_INIT_QOM);
|
||||
|
@ -817,7 +819,7 @@ int main(int argc, char **argv)
|
|||
if (is_help_option(cpu_model)) {
|
||||
/* XXX: implement xxx_cpu_list for targets that still miss it */
|
||||
#if defined(cpu_list)
|
||||
cpu_list(stdout, &fprintf);
|
||||
cpu_list();
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "io/channel-file.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
|
||||
#include "chardev/char-io.h"
|
||||
|
||||
|
@ -211,8 +212,8 @@ static void char_pty_open(Chardev *chr,
|
|||
qemu_set_nonblock(master_fd);
|
||||
|
||||
chr->filename = g_strdup_printf("pty:%s", pty_name);
|
||||
error_printf("char device redirected to %s (label %s)\n",
|
||||
pty_name, chr->label);
|
||||
qemu_printf("char device redirected to %s (label %s)\n",
|
||||
pty_name, chr->label);
|
||||
|
||||
s = PTY_CHARDEV(chr);
|
||||
s->ioc = QIO_CHANNEL(qio_channel_file_new_fd(master_fd));
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "sysemu/sysemu.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "chardev/char.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-commands-char.h"
|
||||
|
@ -651,7 +652,7 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts, GMainContext *context,
|
|||
|
||||
chardev_name_foreach(help_string_append, str);
|
||||
|
||||
error_printf("Available chardev backend types: %s\n", str->str);
|
||||
qemu_printf("Available chardev backend types: %s\n", str->str);
|
||||
g_string_free(str, true);
|
||||
return NULL;
|
||||
}
|
||||
|
|
21
cpus.c
21
cpus.c
|
@ -31,6 +31,7 @@
|
|||
#include "qapi/qapi-events-run-state.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "exec/gdbstub.h"
|
||||
|
@ -1009,7 +1010,7 @@ void hw_error(const char *fmt, ...)
|
|||
fprintf(stderr, "\n");
|
||||
CPU_FOREACH(cpu) {
|
||||
fprintf(stderr, "CPU #%d:\n", cpu->cpu_index);
|
||||
cpu_dump_state(cpu, stderr, fprintf, CPU_DUMP_FPU);
|
||||
cpu_dump_state(cpu, stderr, CPU_DUMP_FPU);
|
||||
}
|
||||
va_end(ap);
|
||||
abort();
|
||||
|
@ -2180,11 +2181,11 @@ int vm_stop_force_state(RunState state)
|
|||
}
|
||||
}
|
||||
|
||||
void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg)
|
||||
void list_cpus(const char *optarg)
|
||||
{
|
||||
/* XXX: implement xxx_cpu_list for targets that still miss it */
|
||||
#if defined(cpu_list)
|
||||
cpu_list(f, cpu_fprintf);
|
||||
cpu_list();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2454,19 +2455,21 @@ void qmp_inject_nmi(Error **errp)
|
|||
nmi_monitor_handle(monitor_get_cpu_index(), errp);
|
||||
}
|
||||
|
||||
void dump_drift_info(FILE *f, fprintf_function cpu_fprintf)
|
||||
void dump_drift_info(void)
|
||||
{
|
||||
if (!use_icount) {
|
||||
return;
|
||||
}
|
||||
|
||||
cpu_fprintf(f, "Host - Guest clock %"PRIi64" ms\n",
|
||||
qemu_printf("Host - Guest clock %"PRIi64" ms\n",
|
||||
(cpu_get_clock() - cpu_get_icount())/SCALE_MS);
|
||||
if (icount_align_option) {
|
||||
cpu_fprintf(f, "Max guest delay %"PRIi64" ms\n", -max_delay/SCALE_MS);
|
||||
cpu_fprintf(f, "Max guest advance %"PRIi64" ms\n", max_advance/SCALE_MS);
|
||||
qemu_printf("Max guest delay %"PRIi64" ms\n",
|
||||
-max_delay / SCALE_MS);
|
||||
qemu_printf("Max guest advance %"PRIi64" ms\n",
|
||||
max_advance / SCALE_MS);
|
||||
} else {
|
||||
cpu_fprintf(f, "Max guest delay NA\n");
|
||||
cpu_fprintf(f, "Max guest advance NA\n");
|
||||
qemu_printf("Max guest delay NA\n");
|
||||
qemu_printf("Max guest advance NA\n");
|
||||
}
|
||||
}
|
||||
|
|
5
disas.c
5
disas.c
|
@ -1,8 +1,9 @@
|
|||
/* General "disassemble this chunk" code. Used for debugging. */
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
#include "elf.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
|
||||
#include "cpu.h"
|
||||
#include "disas/disas.h"
|
||||
|
@ -609,7 +610,7 @@ void monitor_disas(Monitor *mon, CPUState *cpu,
|
|||
int count, i;
|
||||
CPUDebug s;
|
||||
|
||||
INIT_DISASSEMBLE_INFO(s.info, (FILE *)mon, monitor_fprintf);
|
||||
INIT_DISASSEMBLE_INFO(s.info, NULL, qemu_fprintf);
|
||||
|
||||
s.cpu = cpu;
|
||||
s.info.read_memory_func
|
||||
|
|
|
@ -20,7 +20,7 @@ along with this file; see the file COPYING. If not, see
|
|||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
|
||||
/* MAX is redefined below, so remove any previous definition. */
|
||||
#undef MAX
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
extern "C" {
|
||||
#include "qemu/osdep.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
}
|
||||
|
||||
#include "vixl/a64/disasm-a64.h"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
for things we don't care about. */
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
|
||||
#define ARM_EXT_V1 0
|
||||
#define ARM_EXT_V2 0
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
#include "target/cris/opcode-cris.h"
|
||||
|
||||
#define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
|
||||
/* HP PA-RISC SOM object file format: definitions internal to BFD.
|
||||
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
the Intel manual for details. */
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
#include "qemu/cutils.h"
|
||||
|
||||
/* include/opcode/i386.h r1.78 */
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
|
||||
typedef enum {
|
||||
LM32_OP_SRUI = 0, LM32_OP_NORI, LM32_OP_MULI, LM32_OP_SH, LM32_OP_LB,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "qemu/osdep.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
|
||||
/* **** floatformat.h from sourceware.org CVS 2005-08-14. */
|
||||
/* IEEE floating point support declarations, for GDB, the GNU Debugger.
|
||||
|
|
|
@ -577,7 +577,7 @@ static const char pvr_register_prefix[] = "rpvr";
|
|||
|
||||
#endif /* MICROBLAZE_OPC */
|
||||
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
|
||||
#define get_field_rd(instr) get_field(instr, RD_MASK, RD_LOW)
|
||||
#define get_field_r1(instr) get_field(instr, RA_MASK, RA_LOW)
|
||||
|
|
|
@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
|
||||
/* mips.h. Mips opcode list for GDB, the GNU debugger.
|
||||
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#define STATIC_TABLE
|
||||
#define DEFINE_TABLE
|
||||
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
|
||||
static void *stream;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
extern "C" {
|
||||
#include "qemu/osdep.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
}
|
||||
|
||||
#include <cstring>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
/*#include "bfd.h"*/
|
||||
#include "qemu/osdep.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this file; see the file COPYING. If not,
|
||||
see <http://www.gnu.org/licenses/>. */
|
||||
#include "qemu/osdep.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
#define BFD_DEFAULT_TARGET_SIZE 64
|
||||
|
||||
/* ppc.h -- Header file for PowerPC opcode table
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
|
||||
|
||||
/* types */
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
|
||||
/* include/opcode/s390.h revision 1.9 */
|
||||
/* s390.h -- Header file for S390 opcode table
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
|
||||
#define DEFINE_TABLE
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
|
||||
/* The SPARC opcode table (and other related data) is defined in
|
||||
the opcodes library in sparc-opc.c. If you change anything here, make
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
#include "tcg/tcg.h"
|
||||
|
||||
/* Disassemble TCI bytecode. */
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
#include "hw/xtensa/xtensa-isa.h"
|
||||
|
||||
int print_insn_xtensa(bfd_vma memaddr, struct disassemble_info *info)
|
||||
|
|
42
exec.c
42
exec.c
|
@ -35,6 +35,7 @@
|
|||
#include "qemu/timer.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#if defined(CONFIG_USER_ONLY)
|
||||
#include "qemu.h"
|
||||
#else /* !CONFIG_USER_ONLY */
|
||||
|
@ -1255,7 +1256,7 @@ void cpu_abort(CPUState *cpu, const char *fmt, ...)
|
|||
fprintf(stderr, "qemu: fatal: ");
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fprintf(stderr, "\n");
|
||||
cpu_dump_state(cpu, stderr, fprintf, CPU_DUMP_FPU | CPU_DUMP_CCOP);
|
||||
cpu_dump_state(cpu, stderr, CPU_DUMP_FPU | CPU_DUMP_CCOP);
|
||||
if (qemu_log_separate()) {
|
||||
qemu_log_lock();
|
||||
qemu_log("qemu: fatal: ");
|
||||
|
@ -4117,42 +4118,41 @@ void page_size_init(void)
|
|||
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
|
||||
static void mtree_print_phys_entries(fprintf_function mon, void *f,
|
||||
int start, int end, int skip, int ptr)
|
||||
static void mtree_print_phys_entries(int start, int end, int skip, int ptr)
|
||||
{
|
||||
if (start == end - 1) {
|
||||
mon(f, "\t%3d ", start);
|
||||
qemu_printf("\t%3d ", start);
|
||||
} else {
|
||||
mon(f, "\t%3d..%-3d ", start, end - 1);
|
||||
qemu_printf("\t%3d..%-3d ", start, end - 1);
|
||||
}
|
||||
mon(f, " skip=%d ", skip);
|
||||
qemu_printf(" skip=%d ", skip);
|
||||
if (ptr == PHYS_MAP_NODE_NIL) {
|
||||
mon(f, " ptr=NIL");
|
||||
qemu_printf(" ptr=NIL");
|
||||
} else if (!skip) {
|
||||
mon(f, " ptr=#%d", ptr);
|
||||
qemu_printf(" ptr=#%d", ptr);
|
||||
} else {
|
||||
mon(f, " ptr=[%d]", ptr);
|
||||
qemu_printf(" ptr=[%d]", ptr);
|
||||
}
|
||||
mon(f, "\n");
|
||||
qemu_printf("\n");
|
||||
}
|
||||
|
||||
#define MR_SIZE(size) (int128_nz(size) ? (hwaddr)int128_get64( \
|
||||
int128_sub((size), int128_one())) : 0)
|
||||
|
||||
void mtree_print_dispatch(fprintf_function mon, void *f,
|
||||
AddressSpaceDispatch *d, MemoryRegion *root)
|
||||
void mtree_print_dispatch(AddressSpaceDispatch *d, MemoryRegion *root)
|
||||
{
|
||||
int i;
|
||||
|
||||
mon(f, " Dispatch\n");
|
||||
mon(f, " Physical sections\n");
|
||||
qemu_printf(" Dispatch\n");
|
||||
qemu_printf(" Physical sections\n");
|
||||
|
||||
for (i = 0; i < d->map.sections_nb; ++i) {
|
||||
MemoryRegionSection *s = d->map.sections + i;
|
||||
const char *names[] = { " [unassigned]", " [not dirty]",
|
||||
" [ROM]", " [watch]" };
|
||||
|
||||
mon(f, " #%d @" TARGET_FMT_plx ".." TARGET_FMT_plx " %s%s%s%s%s",
|
||||
qemu_printf(" #%d @" TARGET_FMT_plx ".." TARGET_FMT_plx
|
||||
" %s%s%s%s%s",
|
||||
i,
|
||||
s->offset_within_address_space,
|
||||
s->offset_within_address_space + MR_SIZE(s->mr->size),
|
||||
|
@ -4163,20 +4163,20 @@ void mtree_print_dispatch(fprintf_function mon, void *f,
|
|||
s->mr->is_iommu ? " [iommu]" : "");
|
||||
|
||||
if (s->mr->alias) {
|
||||
mon(f, " alias=%s", s->mr->alias->name ?
|
||||
qemu_printf(" alias=%s", s->mr->alias->name ?
|
||||
s->mr->alias->name : "noname");
|
||||
}
|
||||
mon(f, "\n");
|
||||
qemu_printf("\n");
|
||||
}
|
||||
|
||||
mon(f, " Nodes (%d bits per level, %d levels) ptr=[%d] skip=%d\n",
|
||||
qemu_printf(" Nodes (%d bits per level, %d levels) ptr=[%d] skip=%d\n",
|
||||
P_L2_BITS, P_L2_LEVELS, d->phys_map.ptr, d->phys_map.skip);
|
||||
for (i = 0; i < d->map.nodes_nb; ++i) {
|
||||
int j, jprev;
|
||||
PhysPageEntry prev;
|
||||
Node *n = d->map.nodes + i;
|
||||
|
||||
mon(f, " [%d]\n", i);
|
||||
qemu_printf(" [%d]\n", i);
|
||||
|
||||
for (j = 0, jprev = 0, prev = *n[0]; j < ARRAY_SIZE(*n); ++j) {
|
||||
PhysPageEntry *pe = *n + j;
|
||||
|
@ -4185,14 +4185,14 @@ void mtree_print_dispatch(fprintf_function mon, void *f,
|
|||
continue;
|
||||
}
|
||||
|
||||
mtree_print_phys_entries(mon, f, jprev, j, prev.skip, prev.ptr);
|
||||
mtree_print_phys_entries(jprev, j, prev.skip, prev.ptr);
|
||||
|
||||
jprev = j;
|
||||
prev = *pe;
|
||||
}
|
||||
|
||||
if (jprev != ARRAY_SIZE(*n)) {
|
||||
mtree_print_phys_entries(mon, f, jprev, j, prev.skip, prev.ptr);
|
||||
mtree_print_phys_entries(jprev, j, prev.skip, prev.ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
12
hmp.c
12
hmp.c
|
@ -580,8 +580,7 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
|
|||
monitor_printf(mon, "\nImages:\n");
|
||||
image_info = inserted->image;
|
||||
while (1) {
|
||||
bdrv_image_info_dump((fprintf_function)monitor_printf,
|
||||
mon, image_info);
|
||||
bdrv_image_info_dump(image_info);
|
||||
if (image_info->has_backing_image) {
|
||||
image_info = image_info->backing_image;
|
||||
} else {
|
||||
|
@ -1586,7 +1585,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
|
|||
monitor_printf(mon, "List of snapshots present on all disks:\n");
|
||||
|
||||
if (total > 0) {
|
||||
bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, NULL);
|
||||
bdrv_snapshot_dump(NULL);
|
||||
monitor_printf(mon, "\n");
|
||||
for (i = 0; i < total; i++) {
|
||||
sn = &sn_tab[global_snapshots[i]];
|
||||
|
@ -1594,7 +1593,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
|
|||
* overwrite it.
|
||||
*/
|
||||
pstrcpy(sn->id_str, sizeof(sn->id_str), "--");
|
||||
bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, sn);
|
||||
bdrv_snapshot_dump(sn);
|
||||
monitor_printf(mon, "\n");
|
||||
}
|
||||
} else {
|
||||
|
@ -1608,11 +1607,10 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
|
|||
monitor_printf(mon,
|
||||
"\nList of partial (non-loadable) snapshots on '%s':\n",
|
||||
image_entry->imagename);
|
||||
bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, NULL);
|
||||
bdrv_snapshot_dump(NULL);
|
||||
monitor_printf(mon, "\n");
|
||||
QTAILQ_FOREACH(snapshot_entry, &image_entry->snapshots, next) {
|
||||
bdrv_snapshot_dump((fprintf_function)monitor_printf, mon,
|
||||
&snapshot_entry->sn);
|
||||
bdrv_snapshot_dump(&snapshot_entry->sn);
|
||||
monitor_printf(mon, "\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/units.h"
|
||||
#include "exec/memory.h"
|
||||
#include "hw/loader.h"
|
||||
|
@ -33,7 +34,7 @@
|
|||
#define FIT_LOADER_MAX_PATH (128)
|
||||
|
||||
static const void *fit_load_image_alloc(const void *itb, const char *name,
|
||||
int *poff, size_t *psz)
|
||||
int *poff, size_t *psz, Error **errp)
|
||||
{
|
||||
const void *data;
|
||||
const char *comp;
|
||||
|
@ -46,6 +47,7 @@ static const void *fit_load_image_alloc(const void *itb, const char *name,
|
|||
|
||||
off = fdt_path_offset(itb, path);
|
||||
if (off < 0) {
|
||||
error_setg(errp, "can't find node %s", path);
|
||||
return NULL;
|
||||
}
|
||||
if (poff) {
|
||||
|
@ -54,6 +56,7 @@ static const void *fit_load_image_alloc(const void *itb, const char *name,
|
|||
|
||||
data = fdt_getprop(itb, off, "data", &sz);
|
||||
if (!data) {
|
||||
error_setg(errp, "can't get %s/data", path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -73,7 +76,7 @@ static const void *fit_load_image_alloc(const void *itb, const char *name,
|
|||
|
||||
uncomp_len = gunzip(uncomp_data, uncomp_len, (void *) data, sz);
|
||||
if (uncomp_len < 0) {
|
||||
error_printf("unable to decompress %s image\n", name);
|
||||
error_setg(errp, "unable to decompress %s image", name);
|
||||
g_free(uncomp_data);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -85,18 +88,19 @@ static const void *fit_load_image_alloc(const void *itb, const char *name,
|
|||
return data;
|
||||
}
|
||||
|
||||
error_printf("unknown compression '%s'\n", comp);
|
||||
error_setg(errp, "unknown compression '%s'", comp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int fit_image_addr(const void *itb, int img, const char *name,
|
||||
hwaddr *addr)
|
||||
hwaddr *addr, Error **errp)
|
||||
{
|
||||
const void *prop;
|
||||
int len;
|
||||
|
||||
prop = fdt_getprop(itb, img, name, &len);
|
||||
if (!prop) {
|
||||
error_setg(errp, "can't find %s address", name);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
|
@ -108,13 +112,14 @@ static int fit_image_addr(const void *itb, int img, const char *name,
|
|||
*addr = fdt64_to_cpu(*(fdt64_t *)prop);
|
||||
return 0;
|
||||
default:
|
||||
error_printf("invalid %s address length %d\n", name, len);
|
||||
error_setg(errp, "invalid %s address length %d", name, len);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
static int fit_load_kernel(const struct fit_loader *ldr, const void *itb,
|
||||
int cfg, void *opaque, hwaddr *pend)
|
||||
int cfg, void *opaque, hwaddr *pend,
|
||||
Error **errp)
|
||||
{
|
||||
const char *name;
|
||||
const void *data;
|
||||
|
@ -126,26 +131,26 @@ static int fit_load_kernel(const struct fit_loader *ldr, const void *itb,
|
|||
|
||||
name = fdt_getprop(itb, cfg, "kernel", NULL);
|
||||
if (!name) {
|
||||
error_printf("no kernel specified by FIT configuration\n");
|
||||
error_setg(errp, "no kernel specified by FIT configuration");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
load_data = data = fit_load_image_alloc(itb, name, &img_off, &sz);
|
||||
load_data = data = fit_load_image_alloc(itb, name, &img_off, &sz, errp);
|
||||
if (!data) {
|
||||
error_printf("unable to load kernel image from FIT\n");
|
||||
error_prepend(errp, "unable to load kernel image from FIT: ");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = fit_image_addr(itb, img_off, "load", &load_addr);
|
||||
err = fit_image_addr(itb, img_off, "load", &load_addr, errp);
|
||||
if (err) {
|
||||
error_printf("unable to read kernel load address from FIT\n");
|
||||
error_prepend(errp, "unable to read kernel load address from FIT: ");
|
||||
ret = err;
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = fit_image_addr(itb, img_off, "entry", &entry_addr);
|
||||
err = fit_image_addr(itb, img_off, "entry", &entry_addr, errp);
|
||||
if (err) {
|
||||
error_printf("unable to read kernel entry address from FIT\n");
|
||||
error_prepend(errp, "unable to read kernel entry address from FIT: ");
|
||||
ret = err;
|
||||
goto out;
|
||||
}
|
||||
|
@ -172,7 +177,7 @@ out:
|
|||
|
||||
static int fit_load_fdt(const struct fit_loader *ldr, const void *itb,
|
||||
int cfg, void *opaque, const void *match_data,
|
||||
hwaddr kernel_end)
|
||||
hwaddr kernel_end, Error **errp)
|
||||
{
|
||||
const char *name;
|
||||
const void *data;
|
||||
|
@ -187,16 +192,18 @@ static int fit_load_fdt(const struct fit_loader *ldr, const void *itb,
|
|||
return 0;
|
||||
}
|
||||
|
||||
load_data = data = fit_load_image_alloc(itb, name, &img_off, &sz);
|
||||
load_data = data = fit_load_image_alloc(itb, name, &img_off, &sz, errp);
|
||||
if (!data) {
|
||||
error_printf("unable to load FDT image from FIT\n");
|
||||
error_prepend(errp, "unable to load FDT image from FIT: ");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = fit_image_addr(itb, img_off, "load", &load_addr);
|
||||
err = fit_image_addr(itb, img_off, "load", &load_addr, errp);
|
||||
if (err == -ENOENT) {
|
||||
load_addr = ROUND_UP(kernel_end, 64 * KiB) + (10 * MiB);
|
||||
error_free(*errp);
|
||||
} else if (err) {
|
||||
error_prepend(errp, "unable to read FDT load address from FIT: ");
|
||||
ret = err;
|
||||
goto out;
|
||||
}
|
||||
|
@ -229,7 +236,7 @@ static bool fit_cfg_compatible(const void *itb, int cfg, const char *compat)
|
|||
return false;
|
||||
}
|
||||
|
||||
fdt = fit_load_image_alloc(itb, fdt_name, NULL, NULL);
|
||||
fdt = fit_load_image_alloc(itb, fdt_name, NULL, NULL, NULL);
|
||||
if (!fdt) {
|
||||
return false;
|
||||
}
|
||||
|
@ -252,11 +259,12 @@ out:
|
|||
|
||||
int load_fit(const struct fit_loader *ldr, const char *filename, void *opaque)
|
||||
{
|
||||
Error *err = NULL;
|
||||
const struct fit_loader_match *match;
|
||||
const void *itb, *match_data = NULL;
|
||||
const char *def_cfg_name;
|
||||
char path[FIT_LOADER_MAX_PATH];
|
||||
int itb_size, configs, cfg_off, off, err;
|
||||
int itb_size, configs, cfg_off, off;
|
||||
hwaddr kernel_end;
|
||||
int ret;
|
||||
|
||||
|
@ -267,6 +275,7 @@ int load_fit(const struct fit_loader *ldr, const char *filename, void *opaque)
|
|||
|
||||
configs = fdt_path_offset(itb, "/configurations");
|
||||
if (configs < 0) {
|
||||
error_report("can't find node /configurations");
|
||||
ret = configs;
|
||||
goto out;
|
||||
}
|
||||
|
@ -301,20 +310,21 @@ int load_fit(const struct fit_loader *ldr, const char *filename, void *opaque)
|
|||
}
|
||||
|
||||
if (cfg_off < 0) {
|
||||
/* couldn't find a configuration to use */
|
||||
error_report("can't find configuration");
|
||||
ret = cfg_off;
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = fit_load_kernel(ldr, itb, cfg_off, opaque, &kernel_end);
|
||||
if (err) {
|
||||
ret = err;
|
||||
ret = fit_load_kernel(ldr, itb, cfg_off, opaque, &kernel_end, &err);
|
||||
if (ret) {
|
||||
error_report_err(err);
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = fit_load_fdt(ldr, itb, cfg_off, opaque, match_data, kernel_end);
|
||||
if (err) {
|
||||
ret = err;
|
||||
ret = fit_load_fdt(ldr, itb, cfg_off, opaque, match_data, kernel_end,
|
||||
&err);
|
||||
if (ret) {
|
||||
error_report_err(err);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
|
@ -528,21 +528,21 @@ static void boston_mach_init(MachineState *machine)
|
|||
fw_size = load_image_targphys(machine->firmware,
|
||||
0x1fc00000, 4 * MiB);
|
||||
if (fw_size == -1) {
|
||||
error_printf("unable to load firmware image '%s'\n",
|
||||
error_report("unable to load firmware image '%s'",
|
||||
machine->firmware);
|
||||
exit(1);
|
||||
}
|
||||
} else if (machine->kernel_filename) {
|
||||
fit_err = load_fit(&boston_fit_loader, machine->kernel_filename, s);
|
||||
if (fit_err) {
|
||||
error_printf("unable to load FIT image\n");
|
||||
error_report("unable to load FIT image");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
gen_firmware(memory_region_get_ram_ptr(flash) + 0x7c00000,
|
||||
s->kernel_entry, s->fdt_base, is_64b);
|
||||
} else if (!qtest_enabled()) {
|
||||
error_printf("Please provide either a -kernel or -bios argument\n");
|
||||
error_report("Please provide either a -kernel or -bios argument");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -951,7 +951,7 @@ static uint16_t pci_req_id_cache_extract(PCIReqIDCache *cache)
|
|||
result = PCI_BUILD_BDF(bus_n, 0);
|
||||
break;
|
||||
default:
|
||||
error_printf("Invalid PCI requester ID cache type: %d\n",
|
||||
error_report("Invalid PCI requester ID cache type: %d",
|
||||
cache->type);
|
||||
exit(1);
|
||||
break;
|
||||
|
|
|
@ -744,7 +744,7 @@ static void hpet_realize(DeviceState *dev, Error **errp)
|
|||
HPETTimer *timer;
|
||||
|
||||
if (!s->intcap) {
|
||||
error_printf("Hpet's intcap not initialized.\n");
|
||||
warn_report("Hpet's intcap not initialized");
|
||||
}
|
||||
if (hpet_cfg.count == UINT8_MAX) {
|
||||
/* first instance */
|
||||
|
|
|
@ -947,8 +947,10 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev)
|
|||
if (vdev->pdev.romfile || !vdev->pdev.rom_bar) {
|
||||
/* Since pci handles romfile, just print a message and return */
|
||||
if (vfio_blacklist_opt_rom(vdev) && vdev->pdev.romfile) {
|
||||
error_printf("Warning : Device at %s is known to cause system instability issues during option rom execution. Proceeding anyway since user specified romfile\n",
|
||||
vdev->vbasedev.name);
|
||||
warn_report("Device at %s is known to cause system instability"
|
||||
" issues during option rom execution",
|
||||
vdev->vbasedev.name);
|
||||
error_printf("Proceeding anyway since user specified romfile\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -973,11 +975,16 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev)
|
|||
|
||||
if (vfio_blacklist_opt_rom(vdev)) {
|
||||
if (dev->opts && qemu_opt_get(dev->opts, "rombar")) {
|
||||
error_printf("Warning : Device at %s is known to cause system instability issues during option rom execution. Proceeding anyway since user specified non zero value for rombar\n",
|
||||
vdev->vbasedev.name);
|
||||
warn_report("Device at %s is known to cause system instability"
|
||||
" issues during option rom execution",
|
||||
vdev->vbasedev.name);
|
||||
error_printf("Proceeding anyway since user specified"
|
||||
" non zero value for rombar\n");
|
||||
} else {
|
||||
error_printf("Warning : Rom loading for device at %s has been disabled due to system instability issues. Specify rombar=1 or romfile to force\n",
|
||||
vdev->vbasedev.name);
|
||||
warn_report("Rom loading for device at %s has been disabled"
|
||||
" due to system instability issues",
|
||||
vdev->vbasedev.name);
|
||||
error_printf("Specify rombar=1 or romfile to force\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,10 +37,7 @@ void bdrv_query_image_info(BlockDriverState *bs,
|
|||
ImageInfo **p_info,
|
||||
Error **errp);
|
||||
|
||||
void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f,
|
||||
QEMUSnapshotInfo *sn);
|
||||
void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,
|
||||
ImageInfoSpecific *info_spec);
|
||||
void bdrv_image_info_dump(fprintf_function func_fprintf, void *f,
|
||||
ImageInfo *info);
|
||||
void bdrv_snapshot_dump(QEMUSnapshotInfo *sn);
|
||||
void bdrv_image_info_specific_dump(ImageInfoSpecific *info_spec);
|
||||
void bdrv_image_info_dump(ImageInfo *info);
|
||||
#endif
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
#ifndef DISAS_BFD_H
|
||||
#define DISAS_BFD_H
|
||||
|
||||
#include "qemu/fprintf-fn.h"
|
||||
|
||||
typedef void *PTR;
|
||||
typedef uint64_t bfd_vma;
|
||||
typedef int64_t bfd_signed_vma;
|
||||
|
@ -243,6 +241,9 @@ typedef struct symbol_cache_entry
|
|||
} udata;
|
||||
} asymbol;
|
||||
|
||||
typedef int (*fprintf_function)(FILE *f, const char *fmt, ...)
|
||||
GCC_FMT_ATTR(2, 3);
|
||||
|
||||
enum dis_insn_type {
|
||||
dis_noninsn, /* Not a valid instruction */
|
||||
dis_nonbranch, /* Not a branch instruction */
|
|
@ -362,8 +362,8 @@ static inline bool tlb_hit(target_ulong tlb_addr, target_ulong addr)
|
|||
return tlb_hit_page(tlb_addr, addr & TARGET_PAGE_MASK);
|
||||
}
|
||||
|
||||
void dump_exec_info(FILE *f, fprintf_function cpu_fprintf);
|
||||
void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf);
|
||||
void dump_exec_info(void);
|
||||
void dump_opcount_info(void);
|
||||
#endif /* !CONFIG_USER_ONLY */
|
||||
|
||||
int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
|
||||
|
|
|
@ -9,19 +9,6 @@
|
|||
|
||||
#include "qemu/bswap.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "qemu/fprintf-fn.h"
|
||||
|
||||
/**
|
||||
* CPUListState:
|
||||
* @cpu_fprintf: Print function.
|
||||
* @file: File to print to using @cpu_fprint.
|
||||
*
|
||||
* State commonly used for iterating over CPU models.
|
||||
*/
|
||||
typedef struct CPUListState {
|
||||
fprintf_function cpu_fprintf;
|
||||
FILE *file;
|
||||
} CPUListState;
|
||||
|
||||
/* The CPU list lock nests outside page_(un)lock or mmap_(un)lock */
|
||||
void qemu_init_cpu_list(void);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
static inline void log_cpu_state(CPUState *cpu, int flags)
|
||||
{
|
||||
if (qemu_log_enabled()) {
|
||||
cpu_dump_state(cpu, qemu_logfile, fprintf, flags);
|
||||
cpu_dump_state(cpu, qemu_logfile, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,8 +45,7 @@ AddressSpaceDispatch *address_space_dispatch_new(FlatView *fv);
|
|||
void address_space_dispatch_compact(AddressSpaceDispatch *d);
|
||||
void address_space_dispatch_free(AddressSpaceDispatch *d);
|
||||
|
||||
void mtree_print_dispatch(fprintf_function mon, void *f,
|
||||
struct AddressSpaceDispatch *d,
|
||||
void mtree_print_dispatch(struct AddressSpaceDispatch *d,
|
||||
MemoryRegion *root);
|
||||
|
||||
struct page_collection;
|
||||
|
|
|
@ -1720,8 +1720,7 @@ void memory_global_dirty_log_start(void);
|
|||
*/
|
||||
void memory_global_dirty_log_stop(void);
|
||||
|
||||
void mtree_info(fprintf_function mon_printf, void *f, bool flatview,
|
||||
bool dispatch_tree, bool owner);
|
||||
void mtree_info(bool flatview, bool dispatch_tree, bool owner);
|
||||
|
||||
/**
|
||||
* memory_region_dispatch_read: perform a read directly to the specified
|
||||
|
|
|
@ -28,10 +28,9 @@ void monitor_resume(Monitor *mon);
|
|||
int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp);
|
||||
int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp);
|
||||
|
||||
void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
|
||||
int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
|
||||
GCC_FMT_ATTR(2, 0);
|
||||
void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
|
||||
int monitor_fprintf(FILE *stream, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
|
||||
int monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
|
||||
void monitor_flush(Monitor *mon);
|
||||
int monitor_set_cpu(int cpu_index);
|
||||
int monitor_get_cpu_index(void);
|
||||
|
@ -48,7 +47,4 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd);
|
|||
void monitor_fdset_dup_fd_remove(int dup_fd);
|
||||
int monitor_fdset_dup_fd_find(int dup_fd);
|
||||
|
||||
void monitor_vfprintf(FILE *stream,
|
||||
const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
|
||||
|
||||
#endif /* MONITOR_H */
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
#ifndef QEMU_COMMON_H
|
||||
#define QEMU_COMMON_H
|
||||
|
||||
#include "qemu/fprintf-fn.h"
|
||||
|
||||
#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
|
||||
|
||||
/* Copyright string for -version arguments, About dialogs, etc */
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef QEMU_CUTILS_H
|
||||
#define QEMU_CUTILS_H
|
||||
|
||||
#include "qemu/fprintf-fn.h"
|
||||
|
||||
/**
|
||||
* pstrcpy:
|
||||
* @buf: buffer to copy string into
|
||||
|
|
|
@ -30,11 +30,10 @@ void loc_set_none(void);
|
|||
void loc_set_cmdline(char **argv, int idx, int cnt);
|
||||
void loc_set_file(const char *fname, int lno);
|
||||
|
||||
void error_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
|
||||
void error_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
|
||||
void error_vprintf_unless_qmp(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
|
||||
void error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
|
||||
void error_set_progname(const char *argv0);
|
||||
int error_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
|
||||
int error_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
|
||||
int error_vprintf_unless_qmp(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
|
||||
int error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
|
||||
|
||||
void error_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
|
||||
void warn_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
|
||||
|
@ -49,6 +48,8 @@ bool error_report_once_cond(bool *printed, const char *fmt, ...)
|
|||
bool warn_report_once_cond(bool *printed, const char *fmt, ...)
|
||||
GCC_FMT_ATTR(2, 3);
|
||||
|
||||
void error_init(const char *argv0);
|
||||
|
||||
/*
|
||||
* Similar to error_report(), except it prints the message just once.
|
||||
* Return true when it prints, false otherwise.
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* Typedef for fprintf-alike function pointers.
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_FPRINTF_FN_H
|
||||
#define QEMU_FPRINTF_FN_H
|
||||
|
||||
typedef int (*fprintf_function)(FILE *f, const char *fmt, ...)
|
||||
GCC_FMT_ATTR(2, 3);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Print to stream or current monitor
|
||||
*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* Authors:
|
||||
* Markus Armbruster <armbru@redhat.com>,
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_PRINT_H
|
||||
#define QEMU_PRINT_H
|
||||
|
||||
int qemu_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
|
||||
int qemu_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
|
||||
|
||||
int qemu_vfprintf(FILE *stream, const char *fmt, va_list ap)
|
||||
GCC_FMT_ATTR(2, 0);
|
||||
int qemu_fprintf(FILE *stream, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
|
||||
|
||||
#endif
|
|
@ -11,15 +11,13 @@
|
|||
#ifndef QEMU_QSP_H
|
||||
#define QEMU_QSP_H
|
||||
|
||||
#include "qemu/fprintf-fn.h"
|
||||
|
||||
enum QSPSortBy {
|
||||
QSP_SORT_BY_TOTAL_WAIT_TIME,
|
||||
QSP_SORT_BY_AVG_WAIT_TIME,
|
||||
};
|
||||
|
||||
void qsp_report(FILE *f, fprintf_function cpu_fprintf, size_t max,
|
||||
enum QSPSortBy sort_by, bool callsite_coalesce);
|
||||
void qsp_report(size_t max, enum QSPSortBy sort_by,
|
||||
bool callsite_coalesce);
|
||||
|
||||
bool qsp_is_enabled(void);
|
||||
void qsp_enable(void);
|
||||
|
|
|
@ -21,12 +21,11 @@
|
|||
#define QEMU_CPU_H
|
||||
|
||||
#include "hw/qdev-core.h"
|
||||
#include "disas/bfd.h"
|
||||
#include "disas/dis-asm.h"
|
||||
#include "exec/hwaddr.h"
|
||||
#include "exec/memattrs.h"
|
||||
#include "qapi/qapi-types-run-state.h"
|
||||
#include "qemu/bitmap.h"
|
||||
#include "qemu/fprintf-fn.h"
|
||||
#include "qemu/rcu_queue.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "qemu/thread.h"
|
||||
|
@ -181,11 +180,9 @@ typedef struct CPUClass {
|
|||
bool (*virtio_is_big_endian)(CPUState *cpu);
|
||||
int (*memory_rw_debug)(CPUState *cpu, vaddr addr,
|
||||
uint8_t *buf, int len, bool is_write);
|
||||
void (*dump_state)(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags);
|
||||
void (*dump_state)(CPUState *cpu, FILE *, int flags);
|
||||
GuestPanicInformation* (*get_crash_info)(CPUState *cpu);
|
||||
void (*dump_statistics)(CPUState *cpu, FILE *f,
|
||||
fprintf_function cpu_fprintf, int flags);
|
||||
void (*dump_statistics)(CPUState *cpu, int flags);
|
||||
int64_t (*get_arch_id)(CPUState *cpu);
|
||||
bool (*get_paging_enabled)(const CPUState *cpu);
|
||||
void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
|
||||
|
@ -564,26 +561,21 @@ enum CPUDumpFlags {
|
|||
/**
|
||||
* cpu_dump_state:
|
||||
* @cpu: The CPU whose state is to be dumped.
|
||||
* @f: File to dump to.
|
||||
* @cpu_fprintf: Function to dump with.
|
||||
* @flags: Flags what to dump.
|
||||
* @f: If non-null, dump to this stream, else to current print sink.
|
||||
*
|
||||
* Dumps CPU state.
|
||||
*/
|
||||
void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags);
|
||||
void cpu_dump_state(CPUState *cpu, FILE *f, int flags);
|
||||
|
||||
/**
|
||||
* cpu_dump_statistics:
|
||||
* @cpu: The CPU whose state is to be dumped.
|
||||
* @f: File to dump to.
|
||||
* @cpu_fprintf: Function to dump with.
|
||||
* @flags: Flags what to dump.
|
||||
*
|
||||
* Dumps CPU statistics.
|
||||
* Dump CPU statistics to the current monitor if we have one, else to
|
||||
* stdout.
|
||||
*/
|
||||
void cpu_dump_statistics(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags);
|
||||
void cpu_dump_statistics(CPUState *cpu, int flags);
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@ extern int icount_align_option;
|
|||
/* drift information for info jit command */
|
||||
extern int64_t max_delay;
|
||||
extern int64_t max_advance;
|
||||
void dump_drift_info(FILE *f, fprintf_function cpu_fprintf);
|
||||
void dump_drift_info(void);
|
||||
|
||||
/* Unblock cpu */
|
||||
void qemu_cpu_kick_self(void);
|
||||
|
@ -38,7 +38,7 @@ extern int smp_cores;
|
|||
extern int smp_threads;
|
||||
#endif
|
||||
|
||||
void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg);
|
||||
void list_cpus(const char *optarg);
|
||||
|
||||
void qemu_tcg_configure(QemuOpts *opts, Error **errp);
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ void cpu_loop(CPUAlphaState *env)
|
|||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr);
|
||||
cpu_dump_state(cs, stderr, fprintf, 0);
|
||||
cpu_dump_state(cs, stderr, 0);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
process_pending_signals (env);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
do { \
|
||||
CPUState *cs = ENV_GET_CPU(env); \
|
||||
fprintf(stderr, fmt , ## __VA_ARGS__); \
|
||||
cpu_dump_state(cs, stderr, fprintf, 0); \
|
||||
cpu_dump_state(cs, stderr, 0); \
|
||||
if (qemu_log_separate()) { \
|
||||
qemu_log(fmt, ## __VA_ARGS__); \
|
||||
log_cpu_state(cs, 0); \
|
||||
|
|
|
@ -74,7 +74,7 @@ void cpu_loop(CPUCRISState *env)
|
|||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr);
|
||||
cpu_dump_state(cs, stderr, fprintf, 0);
|
||||
cpu_dump_state(cs, stderr, 0);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
process_pending_signals (env);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "qemu/path.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/help_option.h"
|
||||
#include "cpu.h"
|
||||
#include "exec/exec-all.h"
|
||||
|
@ -316,7 +317,7 @@ static void handle_arg_cpu(const char *arg)
|
|||
if (cpu_model == NULL || is_help_option(cpu_model)) {
|
||||
/* XXX: implement xxx_cpu_list for targets that still miss it */
|
||||
#if defined(cpu_list)
|
||||
cpu_list(stdout, &fprintf);
|
||||
cpu_list();
|
||||
#endif
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
@ -600,6 +601,7 @@ int main(int argc, char **argv, char **envp)
|
|||
int ret;
|
||||
int execfd;
|
||||
|
||||
error_init(argv[0]);
|
||||
module_call_init(MODULE_INIT_TRACE);
|
||||
qemu_init_cpu_list();
|
||||
module_call_init(MODULE_INIT_QOM);
|
||||
|
|
|
@ -107,7 +107,7 @@ void cpu_loop(CPUMBState *env)
|
|||
default:
|
||||
fprintf(stderr, "Unhandled hw-exception: 0x%" PRIx64 "\n",
|
||||
env->sregs[SR_ESR] & ESR_EC_MASK);
|
||||
cpu_dump_state(cs, stderr, fprintf, 0);
|
||||
cpu_dump_state(cs, stderr, 0);
|
||||
exit(EXIT_FAILURE);
|
||||
break;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ void cpu_loop(CPUMBState *env)
|
|||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr);
|
||||
cpu_dump_state(cs, stderr, fprintf, 0);
|
||||
cpu_dump_state(cs, stderr, 0);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
process_pending_signals (env);
|
||||
|
|
|
@ -124,7 +124,7 @@ void cpu_loop(CPUS390XState *env)
|
|||
|
||||
default:
|
||||
fprintf(stderr, "Unhandled program exception: %#x\n", n);
|
||||
cpu_dump_state(cs, stderr, fprintf, 0);
|
||||
cpu_dump_state(cs, stderr, 0);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
|
@ -144,7 +144,7 @@ void cpu_loop(CPUS390XState *env)
|
|||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr);
|
||||
cpu_dump_state(cs, stderr, fprintf, 0);
|
||||
cpu_dump_state(cs, stderr, 0);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
process_pending_signals (env);
|
||||
|
|
|
@ -76,7 +76,7 @@ void cpu_loop(CPUSH4State *env)
|
|||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr);
|
||||
cpu_dump_state(cs, stderr, fprintf, 0);
|
||||
cpu_dump_state(cs, stderr, 0);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
process_pending_signals (env);
|
||||
|
|
|
@ -278,7 +278,7 @@ void cpu_loop (CPUSPARCState *env)
|
|||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr);
|
||||
cpu_dump_state(cs, stderr, fprintf, 0);
|
||||
cpu_dump_state(cs, stderr, 0);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
process_pending_signals (env);
|
||||
|
|
156
memory.c
156
memory.c
|
@ -22,6 +22,7 @@
|
|||
#include "qapi/visitor.h"
|
||||
#include "qemu/bitops.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "qom/object.h"
|
||||
#include "trace-root.h"
|
||||
|
||||
|
@ -2800,46 +2801,43 @@ typedef QTAILQ_HEAD(, MemoryRegionList) MemoryRegionListHead;
|
|||
int128_sub((size), int128_one())) : 0)
|
||||
#define MTREE_INDENT " "
|
||||
|
||||
static void mtree_expand_owner(fprintf_function mon_printf, void *f,
|
||||
const char *label, Object *obj)
|
||||
static void mtree_expand_owner(const char *label, Object *obj)
|
||||
{
|
||||
DeviceState *dev = (DeviceState *) object_dynamic_cast(obj, TYPE_DEVICE);
|
||||
|
||||
mon_printf(f, " %s:{%s", label, dev ? "dev" : "obj");
|
||||
qemu_printf(" %s:{%s", label, dev ? "dev" : "obj");
|
||||
if (dev && dev->id) {
|
||||
mon_printf(f, " id=%s", dev->id);
|
||||
qemu_printf(" id=%s", dev->id);
|
||||
} else {
|
||||
gchar *canonical_path = object_get_canonical_path(obj);
|
||||
if (canonical_path) {
|
||||
mon_printf(f, " path=%s", canonical_path);
|
||||
qemu_printf(" path=%s", canonical_path);
|
||||
g_free(canonical_path);
|
||||
} else {
|
||||
mon_printf(f, " type=%s", object_get_typename(obj));
|
||||
qemu_printf(" type=%s", object_get_typename(obj));
|
||||
}
|
||||
}
|
||||
mon_printf(f, "}");
|
||||
qemu_printf("}");
|
||||
}
|
||||
|
||||
static void mtree_print_mr_owner(fprintf_function mon_printf, void *f,
|
||||
const MemoryRegion *mr)
|
||||
static void mtree_print_mr_owner(const MemoryRegion *mr)
|
||||
{
|
||||
Object *owner = mr->owner;
|
||||
Object *parent = memory_region_owner((MemoryRegion *)mr);
|
||||
|
||||
if (!owner && !parent) {
|
||||
mon_printf(f, " orphan");
|
||||
qemu_printf(" orphan");
|
||||
return;
|
||||
}
|
||||
if (owner) {
|
||||
mtree_expand_owner(mon_printf, f, "owner", owner);
|
||||
mtree_expand_owner("owner", owner);
|
||||
}
|
||||
if (parent && parent != owner) {
|
||||
mtree_expand_owner(mon_printf, f, "parent", parent);
|
||||
mtree_expand_owner("parent", parent);
|
||||
}
|
||||
}
|
||||
|
||||
static void mtree_print_mr(fprintf_function mon_printf, void *f,
|
||||
const MemoryRegion *mr, unsigned int level,
|
||||
static void mtree_print_mr(const MemoryRegion *mr, unsigned int level,
|
||||
hwaddr base,
|
||||
MemoryRegionListHead *alias_print_queue,
|
||||
bool owner)
|
||||
|
@ -2855,7 +2853,7 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
|
|||
}
|
||||
|
||||
for (i = 0; i < level; i++) {
|
||||
mon_printf(f, MTREE_INDENT);
|
||||
qemu_printf(MTREE_INDENT);
|
||||
}
|
||||
|
||||
cur_start = base + mr->addr;
|
||||
|
@ -2867,7 +2865,7 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
|
|||
* user who is observing this.
|
||||
*/
|
||||
if (cur_start < base || cur_end < cur_start) {
|
||||
mon_printf(f, "[DETECTED OVERFLOW!] ");
|
||||
qemu_printf("[DETECTED OVERFLOW!] ");
|
||||
}
|
||||
|
||||
if (mr->alias) {
|
||||
|
@ -2886,35 +2884,35 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
|
|||
ml->mr = mr->alias;
|
||||
QTAILQ_INSERT_TAIL(alias_print_queue, ml, mrqueue);
|
||||
}
|
||||
mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx
|
||||
" (prio %d, %s%s): alias %s @%s " TARGET_FMT_plx
|
||||
"-" TARGET_FMT_plx "%s",
|
||||
cur_start, cur_end,
|
||||
mr->priority,
|
||||
mr->nonvolatile ? "nv-" : "",
|
||||
memory_region_type((MemoryRegion *)mr),
|
||||
memory_region_name(mr),
|
||||
memory_region_name(mr->alias),
|
||||
mr->alias_offset,
|
||||
mr->alias_offset + MR_SIZE(mr->size),
|
||||
mr->enabled ? "" : " [disabled]");
|
||||
qemu_printf(TARGET_FMT_plx "-" TARGET_FMT_plx
|
||||
" (prio %d, %s%s): alias %s @%s " TARGET_FMT_plx
|
||||
"-" TARGET_FMT_plx "%s",
|
||||
cur_start, cur_end,
|
||||
mr->priority,
|
||||
mr->nonvolatile ? "nv-" : "",
|
||||
memory_region_type((MemoryRegion *)mr),
|
||||
memory_region_name(mr),
|
||||
memory_region_name(mr->alias),
|
||||
mr->alias_offset,
|
||||
mr->alias_offset + MR_SIZE(mr->size),
|
||||
mr->enabled ? "" : " [disabled]");
|
||||
if (owner) {
|
||||
mtree_print_mr_owner(mon_printf, f, mr);
|
||||
mtree_print_mr_owner(mr);
|
||||
}
|
||||
} else {
|
||||
mon_printf(f,
|
||||
TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %s%s): %s%s",
|
||||
cur_start, cur_end,
|
||||
mr->priority,
|
||||
mr->nonvolatile ? "nv-" : "",
|
||||
memory_region_type((MemoryRegion *)mr),
|
||||
memory_region_name(mr),
|
||||
mr->enabled ? "" : " [disabled]");
|
||||
qemu_printf(TARGET_FMT_plx "-" TARGET_FMT_plx
|
||||
" (prio %d, %s%s): %s%s",
|
||||
cur_start, cur_end,
|
||||
mr->priority,
|
||||
mr->nonvolatile ? "nv-" : "",
|
||||
memory_region_type((MemoryRegion *)mr),
|
||||
memory_region_name(mr),
|
||||
mr->enabled ? "" : " [disabled]");
|
||||
if (owner) {
|
||||
mtree_print_mr_owner(mon_printf, f, mr);
|
||||
mtree_print_mr_owner(mr);
|
||||
}
|
||||
}
|
||||
mon_printf(f, "\n");
|
||||
qemu_printf("\n");
|
||||
|
||||
QTAILQ_INIT(&submr_print_queue);
|
||||
|
||||
|
@ -2936,7 +2934,7 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
|
|||
}
|
||||
|
||||
QTAILQ_FOREACH(ml, &submr_print_queue, mrqueue) {
|
||||
mtree_print_mr(mon_printf, f, ml->mr, level + 1, cur_start,
|
||||
mtree_print_mr(ml->mr, level + 1, cur_start,
|
||||
alias_print_queue, owner);
|
||||
}
|
||||
|
||||
|
@ -2946,8 +2944,6 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
|
|||
}
|
||||
|
||||
struct FlatViewInfo {
|
||||
fprintf_function mon_printf;
|
||||
void *f;
|
||||
int counter;
|
||||
bool dispatch_tree;
|
||||
bool owner;
|
||||
|
@ -2959,70 +2955,71 @@ static void mtree_print_flatview(gpointer key, gpointer value,
|
|||
FlatView *view = key;
|
||||
GArray *fv_address_spaces = value;
|
||||
struct FlatViewInfo *fvi = user_data;
|
||||
fprintf_function p = fvi->mon_printf;
|
||||
void *f = fvi->f;
|
||||
FlatRange *range = &view->ranges[0];
|
||||
MemoryRegion *mr;
|
||||
int n = view->nr;
|
||||
int i;
|
||||
AddressSpace *as;
|
||||
|
||||
p(f, "FlatView #%d\n", fvi->counter);
|
||||
qemu_printf("FlatView #%d\n", fvi->counter);
|
||||
++fvi->counter;
|
||||
|
||||
for (i = 0; i < fv_address_spaces->len; ++i) {
|
||||
as = g_array_index(fv_address_spaces, AddressSpace*, i);
|
||||
p(f, " AS \"%s\", root: %s", as->name, memory_region_name(as->root));
|
||||
qemu_printf(" AS \"%s\", root: %s",
|
||||
as->name, memory_region_name(as->root));
|
||||
if (as->root->alias) {
|
||||
p(f, ", alias %s", memory_region_name(as->root->alias));
|
||||
qemu_printf(", alias %s", memory_region_name(as->root->alias));
|
||||
}
|
||||
p(f, "\n");
|
||||
qemu_printf("\n");
|
||||
}
|
||||
|
||||
p(f, " Root memory region: %s\n",
|
||||
qemu_printf(" Root memory region: %s\n",
|
||||
view->root ? memory_region_name(view->root) : "(none)");
|
||||
|
||||
if (n <= 0) {
|
||||
p(f, MTREE_INDENT "No rendered FlatView\n\n");
|
||||
qemu_printf(MTREE_INDENT "No rendered FlatView\n\n");
|
||||
return;
|
||||
}
|
||||
|
||||
while (n--) {
|
||||
mr = range->mr;
|
||||
if (range->offset_in_region) {
|
||||
p(f, MTREE_INDENT TARGET_FMT_plx "-"
|
||||
TARGET_FMT_plx " (prio %d, %s%s): %s @" TARGET_FMT_plx,
|
||||
int128_get64(range->addr.start),
|
||||
int128_get64(range->addr.start) + MR_SIZE(range->addr.size),
|
||||
mr->priority,
|
||||
range->nonvolatile ? "nv-" : "",
|
||||
range->readonly ? "rom" : memory_region_type(mr),
|
||||
memory_region_name(mr),
|
||||
range->offset_in_region);
|
||||
qemu_printf(MTREE_INDENT TARGET_FMT_plx "-" TARGET_FMT_plx
|
||||
" (prio %d, %s%s): %s @" TARGET_FMT_plx,
|
||||
int128_get64(range->addr.start),
|
||||
int128_get64(range->addr.start)
|
||||
+ MR_SIZE(range->addr.size),
|
||||
mr->priority,
|
||||
range->nonvolatile ? "nv-" : "",
|
||||
range->readonly ? "rom" : memory_region_type(mr),
|
||||
memory_region_name(mr),
|
||||
range->offset_in_region);
|
||||
} else {
|
||||
p(f, MTREE_INDENT TARGET_FMT_plx "-"
|
||||
TARGET_FMT_plx " (prio %d, %s%s): %s",
|
||||
int128_get64(range->addr.start),
|
||||
int128_get64(range->addr.start) + MR_SIZE(range->addr.size),
|
||||
mr->priority,
|
||||
range->nonvolatile ? "nv-" : "",
|
||||
range->readonly ? "rom" : memory_region_type(mr),
|
||||
memory_region_name(mr));
|
||||
qemu_printf(MTREE_INDENT TARGET_FMT_plx "-" TARGET_FMT_plx
|
||||
" (prio %d, %s%s): %s",
|
||||
int128_get64(range->addr.start),
|
||||
int128_get64(range->addr.start)
|
||||
+ MR_SIZE(range->addr.size),
|
||||
mr->priority,
|
||||
range->nonvolatile ? "nv-" : "",
|
||||
range->readonly ? "rom" : memory_region_type(mr),
|
||||
memory_region_name(mr));
|
||||
}
|
||||
if (fvi->owner) {
|
||||
mtree_print_mr_owner(p, f, mr);
|
||||
mtree_print_mr_owner(mr);
|
||||
}
|
||||
p(f, "\n");
|
||||
qemu_printf("\n");
|
||||
range++;
|
||||
}
|
||||
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
if (fvi->dispatch_tree && view->root) {
|
||||
mtree_print_dispatch(p, f, view->dispatch, view->root);
|
||||
mtree_print_dispatch(view->dispatch, view->root);
|
||||
}
|
||||
#endif
|
||||
|
||||
p(f, "\n");
|
||||
qemu_printf("\n");
|
||||
}
|
||||
|
||||
static gboolean mtree_info_flatview_free(gpointer key, gpointer value,
|
||||
|
@ -3037,8 +3034,7 @@ static gboolean mtree_info_flatview_free(gpointer key, gpointer value,
|
|||
return true;
|
||||
}
|
||||
|
||||
void mtree_info(fprintf_function mon_printf, void *f, bool flatview,
|
||||
bool dispatch_tree, bool owner)
|
||||
void mtree_info(bool flatview, bool dispatch_tree, bool owner)
|
||||
{
|
||||
MemoryRegionListHead ml_head;
|
||||
MemoryRegionList *ml, *ml2;
|
||||
|
@ -3047,8 +3043,6 @@ void mtree_info(fprintf_function mon_printf, void *f, bool flatview,
|
|||
if (flatview) {
|
||||
FlatView *view;
|
||||
struct FlatViewInfo fvi = {
|
||||
.mon_printf = mon_printf,
|
||||
.f = f,
|
||||
.counter = 0,
|
||||
.dispatch_tree = dispatch_tree,
|
||||
.owner = owner,
|
||||
|
@ -3082,16 +3076,16 @@ void mtree_info(fprintf_function mon_printf, void *f, bool flatview,
|
|||
QTAILQ_INIT(&ml_head);
|
||||
|
||||
QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {
|
||||
mon_printf(f, "address-space: %s\n", as->name);
|
||||
mtree_print_mr(mon_printf, f, as->root, 1, 0, &ml_head, owner);
|
||||
mon_printf(f, "\n");
|
||||
qemu_printf("address-space: %s\n", as->name);
|
||||
mtree_print_mr(as->root, 1, 0, &ml_head, owner);
|
||||
qemu_printf("\n");
|
||||
}
|
||||
|
||||
/* print aliased regions */
|
||||
QTAILQ_FOREACH(ml, &ml_head, mrqueue) {
|
||||
mon_printf(f, "memory-region: %s\n", memory_region_name(ml->mr));
|
||||
mtree_print_mr(mon_printf, f, ml->mr, 1, 0, &ml_head, owner);
|
||||
mon_printf(f, "\n");
|
||||
qemu_printf("memory-region: %s\n", memory_region_name(ml->mr));
|
||||
mtree_print_mr(ml->mr, 1, 0, &ml_head, owner);
|
||||
qemu_printf("\n");
|
||||
}
|
||||
|
||||
QTAILQ_FOREACH_SAFE(ml, &ml_head, mrqueue, ml2) {
|
||||
|
|
93
monitor.c
93
monitor.c
|
@ -430,15 +430,14 @@ void monitor_flush(Monitor *mon)
|
|||
}
|
||||
|
||||
/* flush at every end of line */
|
||||
static void monitor_puts(Monitor *mon, const char *str)
|
||||
static int monitor_puts(Monitor *mon, const char *str)
|
||||
{
|
||||
int i;
|
||||
char c;
|
||||
|
||||
qemu_mutex_lock(&mon->mon_lock);
|
||||
for(;;) {
|
||||
c = *str++;
|
||||
if (c == '\0')
|
||||
break;
|
||||
for (i = 0; str[i]; i++) {
|
||||
c = str[i];
|
||||
if (c == '\n') {
|
||||
qstring_append_chr(mon->outbuf, '\r');
|
||||
}
|
||||
|
@ -448,39 +447,37 @@ static void monitor_puts(Monitor *mon, const char *str)
|
|||
}
|
||||
}
|
||||
qemu_mutex_unlock(&mon->mon_lock);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
|
||||
int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
|
||||
{
|
||||
char *buf;
|
||||
int n;
|
||||
|
||||
if (!mon)
|
||||
return;
|
||||
return -1;
|
||||
|
||||
if (monitor_is_qmp(mon)) {
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
buf = g_strdup_vprintf(fmt, ap);
|
||||
monitor_puts(mon, buf);
|
||||
n = monitor_puts(mon, buf);
|
||||
g_free(buf);
|
||||
return n;
|
||||
}
|
||||
|
||||
void monitor_printf(Monitor *mon, const char *fmt, ...)
|
||||
int monitor_printf(Monitor *mon, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
monitor_vprintf(mon, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
int ret;
|
||||
|
||||
int monitor_fprintf(FILE *stream, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
monitor_vprintf((Monitor *)stream, fmt, ap);
|
||||
ret = monitor_vprintf(mon, fmt, ap);
|
||||
va_end(ap);
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void qmp_send_response(Monitor *mon, const QDict *rsp)
|
||||
|
@ -1048,7 +1045,7 @@ static void hmp_trace_file(Monitor *mon, const QDict *qdict)
|
|||
const char *arg = qdict_get_try_str(qdict, "arg");
|
||||
|
||||
if (!op) {
|
||||
st_print_trace_file_status((FILE *)mon, &monitor_fprintf);
|
||||
st_print_trace_file_status();
|
||||
} else if (!strcmp(op, "on")) {
|
||||
st_set_trace_file_enabled(true);
|
||||
} else if (!strcmp(op, "off")) {
|
||||
|
@ -1288,7 +1285,7 @@ static void hmp_info_registers(Monitor *mon, const QDict *qdict)
|
|||
if (all_cpus) {
|
||||
CPU_FOREACH(cs) {
|
||||
monitor_printf(mon, "\nCPU#%d\n", cs->cpu_index);
|
||||
cpu_dump_state(cs, (FILE *)mon, monitor_fprintf, CPU_DUMP_FPU);
|
||||
cpu_dump_state(cs, NULL, CPU_DUMP_FPU);
|
||||
}
|
||||
} else {
|
||||
cs = mon_get_cpu();
|
||||
|
@ -1298,7 +1295,7 @@ static void hmp_info_registers(Monitor *mon, const QDict *qdict)
|
|||
return;
|
||||
}
|
||||
|
||||
cpu_dump_state(cs, (FILE *)mon, monitor_fprintf, CPU_DUMP_FPU);
|
||||
cpu_dump_state(cs, NULL, CPU_DUMP_FPU);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1310,13 +1307,13 @@ static void hmp_info_jit(Monitor *mon, const QDict *qdict)
|
|||
return;
|
||||
}
|
||||
|
||||
dump_exec_info((FILE *)mon, monitor_fprintf);
|
||||
dump_drift_info((FILE *)mon, monitor_fprintf);
|
||||
dump_exec_info();
|
||||
dump_drift_info();
|
||||
}
|
||||
|
||||
static void hmp_info_opcount(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
dump_opcount_info((FILE *)mon, monitor_fprintf);
|
||||
dump_opcount_info();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1328,7 +1325,7 @@ static void hmp_info_sync_profile(Monitor *mon, const QDict *qdict)
|
|||
enum QSPSortBy sort_by;
|
||||
|
||||
sort_by = mean ? QSP_SORT_BY_AVG_WAIT_TIME : QSP_SORT_BY_TOTAL_WAIT_TIME;
|
||||
qsp_report((FILE *)mon, monitor_fprintf, max, sort_by, coalesce);
|
||||
qsp_report(max, sort_by, coalesce);
|
||||
}
|
||||
|
||||
static void hmp_info_history(Monitor *mon, const QDict *qdict)
|
||||
|
@ -1356,7 +1353,7 @@ static void hmp_info_cpustats(Monitor *mon, const QDict *qdict)
|
|||
monitor_printf(mon, "No CPU available\n");
|
||||
return;
|
||||
}
|
||||
cpu_dump_statistics(cs, (FILE *)mon, &monitor_fprintf, 0);
|
||||
cpu_dump_statistics(cs, 0);
|
||||
}
|
||||
|
||||
static void hmp_info_trace_events(Monitor *mon, const QDict *qdict)
|
||||
|
@ -1899,8 +1896,7 @@ static void hmp_info_mtree(Monitor *mon, const QDict *qdict)
|
|||
bool dispatch_tree = qdict_get_try_bool(qdict, "dispatch_tree", false);
|
||||
bool owner = qdict_get_try_bool(qdict, "owner", false);
|
||||
|
||||
mtree_info((fprintf_function)monitor_printf, mon, flatview, dispatch_tree,
|
||||
owner);
|
||||
mtree_info(flatview, dispatch_tree, owner);
|
||||
}
|
||||
|
||||
static void hmp_info_numa(Monitor *mon, const QDict *qdict)
|
||||
|
@ -4533,37 +4529,26 @@ static void monitor_readline_flush(void *opaque)
|
|||
monitor_flush(opaque);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print to current monitor if we have one, else to stream.
|
||||
* TODO should return int, so callers can calculate width, but that
|
||||
* requires surgery to monitor_vprintf(). Left for another day.
|
||||
*/
|
||||
void monitor_vfprintf(FILE *stream, const char *fmt, va_list ap)
|
||||
{
|
||||
if (cur_mon && !monitor_cur_is_qmp()) {
|
||||
monitor_vprintf(cur_mon, fmt, ap);
|
||||
} else {
|
||||
vfprintf(stream, fmt, ap);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Print to current monitor if we have one, else to stderr.
|
||||
* TODO should return int, so callers can calculate width, but that
|
||||
* requires surgery to monitor_vprintf(). Left for another day.
|
||||
*/
|
||||
void error_vprintf(const char *fmt, va_list ap)
|
||||
{
|
||||
monitor_vfprintf(stderr, fmt, ap);
|
||||
}
|
||||
|
||||
void error_vprintf_unless_qmp(const char *fmt, va_list ap)
|
||||
int error_vprintf(const char *fmt, va_list ap)
|
||||
{
|
||||
if (cur_mon && !monitor_cur_is_qmp()) {
|
||||
monitor_vprintf(cur_mon, fmt, ap);
|
||||
} else if (!cur_mon) {
|
||||
vfprintf(stderr, fmt, ap);
|
||||
return monitor_vprintf(cur_mon, fmt, ap);
|
||||
}
|
||||
return vfprintf(stderr, fmt, ap);
|
||||
}
|
||||
|
||||
int error_vprintf_unless_qmp(const char *fmt, va_list ap)
|
||||
{
|
||||
if (!cur_mon) {
|
||||
return vfprintf(stderr, fmt, ap);
|
||||
}
|
||||
if (!monitor_cur_is_qmp()) {
|
||||
return monitor_vprintf(cur_mon, fmt, ap);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void monitor_list_append(Monitor *mon)
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "qemu/error-report.h"
|
||||
#include "qemu/help_option.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "migration/misc.h"
|
||||
|
||||
|
@ -104,31 +105,22 @@ static bool qdev_class_has_alias(DeviceClass *dc)
|
|||
return (qdev_class_get_alias(dc) != NULL);
|
||||
}
|
||||
|
||||
static void out_printf(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
monitor_vfprintf(stdout, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static void qdev_print_devinfo(DeviceClass *dc)
|
||||
{
|
||||
out_printf("name \"%s\"", object_class_get_name(OBJECT_CLASS(dc)));
|
||||
qemu_printf("name \"%s\"", object_class_get_name(OBJECT_CLASS(dc)));
|
||||
if (dc->bus_type) {
|
||||
out_printf(", bus %s", dc->bus_type);
|
||||
qemu_printf(", bus %s", dc->bus_type);
|
||||
}
|
||||
if (qdev_class_has_alias(dc)) {
|
||||
out_printf(", alias \"%s\"", qdev_class_get_alias(dc));
|
||||
qemu_printf(", alias \"%s\"", qdev_class_get_alias(dc));
|
||||
}
|
||||
if (dc->desc) {
|
||||
out_printf(", desc \"%s\"", dc->desc);
|
||||
qemu_printf(", desc \"%s\"", dc->desc);
|
||||
}
|
||||
if (!dc->user_creatable) {
|
||||
out_printf(", no-user");
|
||||
qemu_printf(", no-user");
|
||||
}
|
||||
out_printf("\n");
|
||||
qemu_printf("\n");
|
||||
}
|
||||
|
||||
static void qdev_print_devinfos(bool show_no_user)
|
||||
|
@ -164,7 +156,7 @@ static void qdev_print_devinfos(bool show_no_user)
|
|||
continue;
|
||||
}
|
||||
if (!cat_printed) {
|
||||
out_printf("%s%s devices:\n", i ? "\n" : "", cat_name[i]);
|
||||
qemu_printf("%s%s devices:\n", i ? "\n" : "", cat_name[i]);
|
||||
cat_printed = true;
|
||||
}
|
||||
qdev_print_devinfo(dc);
|
||||
|
@ -286,20 +278,20 @@ int qdev_device_help(QemuOpts *opts)
|
|||
}
|
||||
|
||||
if (prop_list) {
|
||||
out_printf("%s options:\n", driver);
|
||||
qemu_printf("%s options:\n", driver);
|
||||
} else {
|
||||
out_printf("There are no options for %s.\n", driver);
|
||||
qemu_printf("There are no options for %s.\n", driver);
|
||||
}
|
||||
for (prop = prop_list; prop; prop = prop->next) {
|
||||
int len;
|
||||
out_printf(" %s=<%s>%n", prop->value->name, prop->value->type, &len);
|
||||
qemu_printf(" %s=<%s>%n", prop->value->name, prop->value->type, &len);
|
||||
if (prop->value->has_description) {
|
||||
if (len < 24) {
|
||||
out_printf("%*s", 24 - len, "");
|
||||
qemu_printf("%*s", 24 - len, "");
|
||||
}
|
||||
out_printf(" - %s\n", prop->value->description);
|
||||
qemu_printf(" - %s\n", prop->value->description);
|
||||
} else {
|
||||
out_printf("\n");
|
||||
qemu_printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
14
qemu-img.c
14
qemu-img.c
|
@ -85,13 +85,11 @@ static void QEMU_NORETURN GCC_FMT_ATTR(1, 2) error_exit(const char *fmt, ...)
|
|||
{
|
||||
va_list ap;
|
||||
|
||||
error_printf("qemu-img: ");
|
||||
|
||||
va_start(ap, fmt);
|
||||
error_vprintf(fmt, ap);
|
||||
error_vreport(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
error_printf("\nTry 'qemu-img --help' for more information\n");
|
||||
error_printf("Try 'qemu-img --help' for more information\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
@ -2485,11 +2483,11 @@ static void dump_snapshots(BlockDriverState *bs)
|
|||
if (nb_sns <= 0)
|
||||
return;
|
||||
printf("Snapshot list:\n");
|
||||
bdrv_snapshot_dump(fprintf, stdout, NULL);
|
||||
bdrv_snapshot_dump(NULL);
|
||||
printf("\n");
|
||||
for(i = 0; i < nb_sns; i++) {
|
||||
sn = &sn_tab[i];
|
||||
bdrv_snapshot_dump(fprintf, stdout, sn);
|
||||
bdrv_snapshot_dump(sn);
|
||||
printf("\n");
|
||||
}
|
||||
g_free(sn_tab);
|
||||
|
@ -2538,7 +2536,7 @@ static void dump_human_image_info_list(ImageInfoList *list)
|
|||
}
|
||||
delim = true;
|
||||
|
||||
bdrv_image_info_dump(fprintf, stdout, elem->value);
|
||||
bdrv_image_info_dump(elem->value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4923,8 +4921,8 @@ int main(int argc, char **argv)
|
|||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
|
||||
error_init(argv[0]);
|
||||
module_call_init(MODULE_INIT_TRACE);
|
||||
error_set_progname(argv[0]);
|
||||
qemu_init_exec_dir(argv[0]);
|
||||
|
||||
if (qemu_init_main_loop(&local_error)) {
|
||||
|
|
|
@ -1699,7 +1699,7 @@ static int info_f(BlockBackend *blk, int argc, char **argv)
|
|||
}
|
||||
if (spec_info) {
|
||||
printf("Format specific information:\n");
|
||||
bdrv_image_info_specific_dump(fprintf, stdout, spec_info);
|
||||
bdrv_image_info_specific_dump(spec_info);
|
||||
qapi_free_ImageInfoSpecific(spec_info);
|
||||
}
|
||||
|
||||
|
|
14
qemu-io.c
14
qemu-io.c
|
@ -34,8 +34,6 @@
|
|||
|
||||
#define CMD_NOFILE_OK 0x01
|
||||
|
||||
static char *progname;
|
||||
|
||||
static BlockBackend *qemuio_blk;
|
||||
static bool quit_qemu_io;
|
||||
|
||||
|
@ -312,7 +310,7 @@ static char *get_prompt(void)
|
|||
static char prompt[FILENAME_MAX + 2 /*"> "*/ + 1 /*"\0"*/ ];
|
||||
|
||||
if (!prompt[0]) {
|
||||
snprintf(prompt, sizeof(prompt), "%s> ", progname);
|
||||
snprintf(prompt, sizeof(prompt), "%s> ", error_get_progname());
|
||||
}
|
||||
|
||||
return prompt;
|
||||
|
@ -524,8 +522,8 @@ int main(int argc, char **argv)
|
|||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
|
||||
error_init(argv[0]);
|
||||
module_call_init(MODULE_INIT_TRACE);
|
||||
progname = g_path_get_basename(argv[0]);
|
||||
qemu_init_exec_dir(argv[0]);
|
||||
|
||||
qcrypto_init(&error_fatal);
|
||||
|
@ -580,10 +578,10 @@ int main(int argc, char **argv)
|
|||
break;
|
||||
case 'V':
|
||||
printf("%s version " QEMU_FULL_VERSION "\n"
|
||||
QEMU_COPYRIGHT "\n", progname);
|
||||
QEMU_COPYRIGHT "\n", error_get_progname());
|
||||
exit(0);
|
||||
case 'h':
|
||||
usage(progname);
|
||||
usage(error_get_progname());
|
||||
exit(0);
|
||||
case 'U':
|
||||
force_share = true;
|
||||
|
@ -600,13 +598,13 @@ int main(int argc, char **argv)
|
|||
imageOpts = true;
|
||||
break;
|
||||
default:
|
||||
usage(progname);
|
||||
usage(error_get_progname());
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if ((argc - optind) > 1) {
|
||||
usage(progname);
|
||||
usage(error_get_progname());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -690,8 +690,8 @@ int main(int argc, char **argv)
|
|||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
|
||||
error_init(argv[0]);
|
||||
module_call_init(MODULE_INIT_TRACE);
|
||||
error_set_progname(argv[0]);
|
||||
qcrypto_init(&error_fatal);
|
||||
|
||||
module_call_init(MODULE_INIT_QOM);
|
||||
|
|
11
qom/cpu.c
11
qom/cpu.c
|
@ -28,6 +28,7 @@
|
|||
#include "exec/log.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "hw/boards.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
|
@ -219,24 +220,22 @@ GuestPanicInformation *cpu_get_crash_info(CPUState *cpu)
|
|||
return res;
|
||||
}
|
||||
|
||||
void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags)
|
||||
void cpu_dump_state(CPUState *cpu, FILE *f, int flags)
|
||||
{
|
||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||
|
||||
if (cc->dump_state) {
|
||||
cpu_synchronize_state(cpu);
|
||||
cc->dump_state(cpu, f, cpu_fprintf, flags);
|
||||
cc->dump_state(cpu, f, flags);
|
||||
}
|
||||
}
|
||||
|
||||
void cpu_dump_statistics(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags)
|
||||
void cpu_dump_statistics(CPUState *cpu, int flags)
|
||||
{
|
||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||
|
||||
if (cc->dump_statistics) {
|
||||
cc->dump_statistics(cpu, f, cpu_fprintf, flags);
|
||||
cc->dump_statistics(cpu, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -895,6 +895,7 @@ int main(int argc, char **argv)
|
|||
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
error_init(argv[0]);
|
||||
module_call_init(MODULE_INIT_TRACE);
|
||||
module_call_init(MODULE_INIT_QOM);
|
||||
qemu_add_opts(&qemu_trace_opts);
|
||||
|
|
|
@ -2,19 +2,22 @@
|
|||
#include "qemu-common.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
||||
void error_vprintf(const char *fmt, va_list ap)
|
||||
int error_vprintf(const char *fmt, va_list ap)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (g_test_initialized() && !g_test_subprocess() &&
|
||||
getenv("QTEST_SILENT_ERRORS")) {
|
||||
char *msg = g_strdup_vprintf(fmt, ap);
|
||||
g_test_message("%s", msg);
|
||||
ret = strlen(msg);
|
||||
g_free(msg);
|
||||
} else {
|
||||
vfprintf(stderr, fmt, ap);
|
||||
return ret;
|
||||
}
|
||||
return vfprintf(stderr, fmt, ap);
|
||||
}
|
||||
|
||||
void error_vprintf_unless_qmp(const char *fmt, va_list ap)
|
||||
int error_vprintf_unless_qmp(const char *fmt, va_list ap)
|
||||
{
|
||||
error_vprintf(fmt, ap);
|
||||
return error_vprintf(fmt, ap);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,11 @@
|
|||
|
||||
__thread Monitor *cur_mon;
|
||||
|
||||
int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
int monitor_get_fd(Monitor *mon, const char *name, Error **errp)
|
||||
{
|
||||
error_setg(errp, "only QEMU supports file descriptor passing");
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "cpu.h"
|
||||
#include "qemu-common.h"
|
||||
#include "exec/exec-all.h"
|
||||
|
@ -74,23 +75,17 @@ static void alpha_cpu_realizefn(DeviceState *dev, Error **errp)
|
|||
static void alpha_cpu_list_entry(gpointer data, gpointer user_data)
|
||||
{
|
||||
ObjectClass *oc = data;
|
||||
CPUListState *s = user_data;
|
||||
|
||||
(*s->cpu_fprintf)(s->file, " %s\n",
|
||||
object_class_get_name(oc));
|
||||
qemu_printf(" %s\n", object_class_get_name(oc));
|
||||
}
|
||||
|
||||
void alpha_cpu_list(FILE *f, fprintf_function cpu_fprintf)
|
||||
void alpha_cpu_list(void)
|
||||
{
|
||||
CPUListState s = {
|
||||
.file = f,
|
||||
.cpu_fprintf = cpu_fprintf,
|
||||
};
|
||||
GSList *list;
|
||||
|
||||
list = object_class_get_list_sorted(TYPE_ALPHA_CPU, false);
|
||||
(*cpu_fprintf)(f, "Available CPUs:\n");
|
||||
g_slist_foreach(list, alpha_cpu_list_entry, &s);
|
||||
qemu_printf("Available CPUs:\n");
|
||||
g_slist_foreach(list, alpha_cpu_list_entry, NULL);
|
||||
g_slist_free(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -311,8 +311,7 @@ extern const struct VMStateDescription vmstate_alpha_cpu;
|
|||
|
||||
void alpha_cpu_do_interrupt(CPUState *cpu);
|
||||
bool alpha_cpu_exec_interrupt(CPUState *cpu, int int_req);
|
||||
void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags);
|
||||
void alpha_cpu_dump_state(CPUState *cs, FILE *f, int flags);
|
||||
hwaddr alpha_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
|
||||
int alpha_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||
int alpha_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||
|
@ -470,7 +469,7 @@ void alpha_translate_init(void);
|
|||
#define ALPHA_CPU_TYPE_NAME(model) model ALPHA_CPU_TYPE_SUFFIX
|
||||
#define CPU_RESOLVING_TYPE TYPE_ALPHA_CPU
|
||||
|
||||
void alpha_cpu_list(FILE *f, fprintf_function cpu_fprintf);
|
||||
void alpha_cpu_list(void);
|
||||
/* you can call this signal handler from your SIGBUS and SIGSEGV
|
||||
signal handlers to inform the virtual CPU of exceptions. non zero
|
||||
is returned if the signal was handled by the virtual CPU. */
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "exec/exec-all.h"
|
||||
#include "fpu/softfloat.h"
|
||||
#include "exec/helper-proto.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
|
||||
|
||||
#define CONVERT_BIT(X, SRC, DST) \
|
||||
|
@ -426,8 +427,7 @@ bool alpha_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
|
|||
return false;
|
||||
}
|
||||
|
||||
void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags)
|
||||
void alpha_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
{
|
||||
static const char *linux_reg_names[] = {
|
||||
"v0 ", "t0 ", "t1 ", "t2 ", "t3 ", "t4 ", "t5 ", "t6 ",
|
||||
|
@ -439,24 +439,24 @@ void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
|||
CPUAlphaState *env = &cpu->env;
|
||||
int i;
|
||||
|
||||
cpu_fprintf(f, " PC " TARGET_FMT_lx " PS %02x\n",
|
||||
env->pc, extract32(env->flags, ENV_FLAG_PS_SHIFT, 8));
|
||||
qemu_fprintf(f, " PC " TARGET_FMT_lx " PS %02x\n",
|
||||
env->pc, extract32(env->flags, ENV_FLAG_PS_SHIFT, 8));
|
||||
for (i = 0; i < 31; i++) {
|
||||
cpu_fprintf(f, "IR%02d %s " TARGET_FMT_lx "%c", i,
|
||||
linux_reg_names[i], cpu_alpha_load_gr(env, i),
|
||||
(i % 3) == 2 ? '\n' : ' ');
|
||||
qemu_fprintf(f, "IR%02d %s " TARGET_FMT_lx "%c", i,
|
||||
linux_reg_names[i], cpu_alpha_load_gr(env, i),
|
||||
(i % 3) == 2 ? '\n' : ' ');
|
||||
}
|
||||
|
||||
cpu_fprintf(f, "lock_a " TARGET_FMT_lx " lock_v " TARGET_FMT_lx "\n",
|
||||
env->lock_addr, env->lock_value);
|
||||
qemu_fprintf(f, "lock_a " TARGET_FMT_lx " lock_v " TARGET_FMT_lx "\n",
|
||||
env->lock_addr, env->lock_value);
|
||||
|
||||
if (flags & CPU_DUMP_FPU) {
|
||||
for (i = 0; i < 31; i++) {
|
||||
cpu_fprintf(f, "FIR%02d %016" PRIx64 "%c", i, env->fir[i],
|
||||
(i % 3) == 2 ? '\n' : ' ');
|
||||
qemu_fprintf(f, "FIR%02d %016" PRIx64 "%c", i, env->fir[i],
|
||||
(i % 3) == 2 ? '\n' : ' ');
|
||||
}
|
||||
}
|
||||
cpu_fprintf(f, "\n");
|
||||
qemu_fprintf(f, "\n");
|
||||
}
|
||||
|
||||
/* This should only be called from translate, via gen_excp.
|
||||
|
|
|
@ -650,7 +650,7 @@ target_ulong do_arm_semihosting(CPUARMState *env)
|
|||
/* fall through -- invalid for A32/T32 */
|
||||
default:
|
||||
fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr);
|
||||
cpu_dump_state(cs, stderr, fprintf, 0);
|
||||
cpu_dump_state(cs, stderr, 0);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include "qemu/osdep.h"
|
||||
#include "target/arm/idau.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/visitor.h"
|
||||
#include "cpu.h"
|
||||
|
|
|
@ -935,8 +935,7 @@ void arm_cpu_do_interrupt(CPUState *cpu);
|
|||
void arm_v7m_cpu_do_interrupt(CPUState *cpu);
|
||||
bool arm_cpu_exec_interrupt(CPUState *cpu, int int_req);
|
||||
|
||||
void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags);
|
||||
void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags);
|
||||
|
||||
hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
|
||||
MemTxAttrs *attrs);
|
||||
|
@ -1936,7 +1935,7 @@ static inline bool access_secure_reg(CPUARMState *env)
|
|||
(arm_is_secure(_env) && !arm_el_is_aa64((_env), 3)), \
|
||||
(_val))
|
||||
|
||||
void arm_cpu_list(FILE *f, fprintf_function cpu_fprintf);
|
||||
void arm_cpu_list(void);
|
||||
uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
|
||||
uint32_t cur_el, bool secure);
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "sysemu/sysemu.h"
|
||||
#include "qemu/bitops.h"
|
||||
#include "qemu/crc32c.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "exec/cpu_ldst.h"
|
||||
#include "arm_ldst.h"
|
||||
|
@ -6724,29 +6725,23 @@ static gint arm_cpu_list_compare(gconstpointer a, gconstpointer b)
|
|||
static void arm_cpu_list_entry(gpointer data, gpointer user_data)
|
||||
{
|
||||
ObjectClass *oc = data;
|
||||
CPUListState *s = user_data;
|
||||
const char *typename;
|
||||
char *name;
|
||||
|
||||
typename = object_class_get_name(oc);
|
||||
name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_ARM_CPU));
|
||||
(*s->cpu_fprintf)(s->file, " %s\n",
|
||||
name);
|
||||
qemu_printf(" %s\n", name);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
void arm_cpu_list(FILE *f, fprintf_function cpu_fprintf)
|
||||
void arm_cpu_list(void)
|
||||
{
|
||||
CPUListState s = {
|
||||
.file = f,
|
||||
.cpu_fprintf = cpu_fprintf,
|
||||
};
|
||||
GSList *list;
|
||||
|
||||
list = object_class_get_list(TYPE_ARM_CPU, false);
|
||||
list = g_slist_sort(list, arm_cpu_list_compare);
|
||||
(*cpu_fprintf)(f, "Available CPUs:\n");
|
||||
g_slist_foreach(list, arm_cpu_list_entry, &s);
|
||||
qemu_printf("Available CPUs:\n");
|
||||
g_slist_foreach(list, arm_cpu_list_entry, NULL);
|
||||
g_slist_free(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "translate.h"
|
||||
#include "internals.h"
|
||||
#include "qemu/host-utils.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
|
||||
#include "exec/semihost.h"
|
||||
#include "exec/gen-icount.h"
|
||||
|
@ -151,8 +152,7 @@ static void set_btype(DisasContext *s, int val)
|
|||
s->btype = -1;
|
||||
}
|
||||
|
||||
void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
|
||||
fprintf_function cpu_fprintf, int flags)
|
||||
void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
{
|
||||
ARMCPU *cpu = ARM_CPU(cs);
|
||||
CPUARMState *env = &cpu->env;
|
||||
|
@ -161,13 +161,13 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
|
|||
int el = arm_current_el(env);
|
||||
const char *ns_status;
|
||||
|
||||
cpu_fprintf(f, " PC=%016" PRIx64 " ", env->pc);
|
||||
qemu_fprintf(f, " PC=%016" PRIx64 " ", env->pc);
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (i == 31) {
|
||||
cpu_fprintf(f, " SP=%016" PRIx64 "\n", env->xregs[i]);
|
||||
qemu_fprintf(f, " SP=%016" PRIx64 "\n", env->xregs[i]);
|
||||
} else {
|
||||
cpu_fprintf(f, "X%02d=%016" PRIx64 "%s", i, env->xregs[i],
|
||||
(i + 2) % 3 ? " " : "\n");
|
||||
qemu_fprintf(f, "X%02d=%016" PRIx64 "%s", i, env->xregs[i],
|
||||
(i + 2) % 3 ? " " : "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,29 +176,29 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
|
|||
} else {
|
||||
ns_status = "";
|
||||
}
|
||||
cpu_fprintf(f, "PSTATE=%08x %c%c%c%c %sEL%d%c",
|
||||
psr,
|
||||
psr & PSTATE_N ? 'N' : '-',
|
||||
psr & PSTATE_Z ? 'Z' : '-',
|
||||
psr & PSTATE_C ? 'C' : '-',
|
||||
psr & PSTATE_V ? 'V' : '-',
|
||||
ns_status,
|
||||
el,
|
||||
psr & PSTATE_SP ? 'h' : 't');
|
||||
qemu_fprintf(f, "PSTATE=%08x %c%c%c%c %sEL%d%c",
|
||||
psr,
|
||||
psr & PSTATE_N ? 'N' : '-',
|
||||
psr & PSTATE_Z ? 'Z' : '-',
|
||||
psr & PSTATE_C ? 'C' : '-',
|
||||
psr & PSTATE_V ? 'V' : '-',
|
||||
ns_status,
|
||||
el,
|
||||
psr & PSTATE_SP ? 'h' : 't');
|
||||
|
||||
if (cpu_isar_feature(aa64_bti, cpu)) {
|
||||
cpu_fprintf(f, " BTYPE=%d", (psr & PSTATE_BTYPE) >> 10);
|
||||
qemu_fprintf(f, " BTYPE=%d", (psr & PSTATE_BTYPE) >> 10);
|
||||
}
|
||||
if (!(flags & CPU_DUMP_FPU)) {
|
||||
cpu_fprintf(f, "\n");
|
||||
qemu_fprintf(f, "\n");
|
||||
return;
|
||||
}
|
||||
if (fp_exception_el(env, el) != 0) {
|
||||
cpu_fprintf(f, " FPU disabled\n");
|
||||
qemu_fprintf(f, " FPU disabled\n");
|
||||
return;
|
||||
}
|
||||
cpu_fprintf(f, " FPCR=%08x FPSR=%08x\n",
|
||||
vfp_get_fpcr(env), vfp_get_fpsr(env));
|
||||
qemu_fprintf(f, " FPCR=%08x FPSR=%08x\n",
|
||||
vfp_get_fpcr(env), vfp_get_fpsr(env));
|
||||
|
||||
if (cpu_isar_feature(aa64_sve, cpu) && sve_exception_el(env, el) == 0) {
|
||||
int j, zcr_len = sve_zcr_len_for_el(env, el);
|
||||
|
@ -206,11 +206,11 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
|
|||
for (i = 0; i <= FFR_PRED_NUM; i++) {
|
||||
bool eol;
|
||||
if (i == FFR_PRED_NUM) {
|
||||
cpu_fprintf(f, "FFR=");
|
||||
qemu_fprintf(f, "FFR=");
|
||||
/* It's last, so end the line. */
|
||||
eol = true;
|
||||
} else {
|
||||
cpu_fprintf(f, "P%02d=", i);
|
||||
qemu_fprintf(f, "P%02d=", i);
|
||||
switch (zcr_len) {
|
||||
case 0:
|
||||
eol = i % 8 == 7;
|
||||
|
@ -235,46 +235,46 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
|
|||
} else {
|
||||
digits = (zcr_len % 4 + 1) * 4;
|
||||
}
|
||||
cpu_fprintf(f, "%0*" PRIx64 "%s", digits,
|
||||
env->vfp.pregs[i].p[j],
|
||||
j ? ":" : eol ? "\n" : " ");
|
||||
qemu_fprintf(f, "%0*" PRIx64 "%s", digits,
|
||||
env->vfp.pregs[i].p[j],
|
||||
j ? ":" : eol ? "\n" : " ");
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (zcr_len == 0) {
|
||||
cpu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64 "%s",
|
||||
i, env->vfp.zregs[i].d[1],
|
||||
env->vfp.zregs[i].d[0], i & 1 ? "\n" : " ");
|
||||
qemu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64 "%s",
|
||||
i, env->vfp.zregs[i].d[1],
|
||||
env->vfp.zregs[i].d[0], i & 1 ? "\n" : " ");
|
||||
} else if (zcr_len == 1) {
|
||||
cpu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64
|
||||
":%016" PRIx64 ":%016" PRIx64 "\n",
|
||||
i, env->vfp.zregs[i].d[3], env->vfp.zregs[i].d[2],
|
||||
env->vfp.zregs[i].d[1], env->vfp.zregs[i].d[0]);
|
||||
qemu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64
|
||||
":%016" PRIx64 ":%016" PRIx64 "\n",
|
||||
i, env->vfp.zregs[i].d[3], env->vfp.zregs[i].d[2],
|
||||
env->vfp.zregs[i].d[1], env->vfp.zregs[i].d[0]);
|
||||
} else {
|
||||
for (j = zcr_len; j >= 0; j--) {
|
||||
bool odd = (zcr_len - j) % 2 != 0;
|
||||
if (j == zcr_len) {
|
||||
cpu_fprintf(f, "Z%02d[%x-%x]=", i, j, j - 1);
|
||||
qemu_fprintf(f, "Z%02d[%x-%x]=", i, j, j - 1);
|
||||
} else if (!odd) {
|
||||
if (j > 0) {
|
||||
cpu_fprintf(f, " [%x-%x]=", j, j - 1);
|
||||
qemu_fprintf(f, " [%x-%x]=", j, j - 1);
|
||||
} else {
|
||||
cpu_fprintf(f, " [%x]=", j);
|
||||
qemu_fprintf(f, " [%x]=", j);
|
||||
}
|
||||
}
|
||||
cpu_fprintf(f, "%016" PRIx64 ":%016" PRIx64 "%s",
|
||||
env->vfp.zregs[i].d[j * 2 + 1],
|
||||
env->vfp.zregs[i].d[j * 2],
|
||||
odd || j == 0 ? "\n" : ":");
|
||||
qemu_fprintf(f, "%016" PRIx64 ":%016" PRIx64 "%s",
|
||||
env->vfp.zregs[i].d[j * 2 + 1],
|
||||
env->vfp.zregs[i].d[j * 2],
|
||||
odd || j == 0 ? "\n" : ":");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < 32; i++) {
|
||||
uint64_t *q = aa64_vfp_qreg(env, i);
|
||||
cpu_fprintf(f, "Q%02d=%016" PRIx64 ":%016" PRIx64 "%s",
|
||||
i, q[1], q[0], (i & 1 ? "\n" : " "));
|
||||
qemu_fprintf(f, "Q%02d=%016" PRIx64 ":%016" PRIx64 "%s",
|
||||
i, q[1], q[0], (i & 1 ? "\n" : " "));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "tcg-op-gvec.h"
|
||||
#include "qemu/log.h"
|
||||
#include "qemu/bitops.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "arm_ldst.h"
|
||||
#include "exec/semihost.h"
|
||||
|
||||
|
@ -13772,24 +13773,23 @@ void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb)
|
|||
translator_loop(ops, &dc.base, cpu, tb);
|
||||
}
|
||||
|
||||
void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags)
|
||||
void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
{
|
||||
ARMCPU *cpu = ARM_CPU(cs);
|
||||
CPUARMState *env = &cpu->env;
|
||||
int i;
|
||||
|
||||
if (is_a64(env)) {
|
||||
aarch64_cpu_dump_state(cs, f, cpu_fprintf, flags);
|
||||
aarch64_cpu_dump_state(cs, f, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
for(i=0;i<16;i++) {
|
||||
cpu_fprintf(f, "R%02d=%08x", i, env->regs[i]);
|
||||
qemu_fprintf(f, "R%02d=%08x", i, env->regs[i]);
|
||||
if ((i % 4) == 3)
|
||||
cpu_fprintf(f, "\n");
|
||||
qemu_fprintf(f, "\n");
|
||||
else
|
||||
cpu_fprintf(f, " ");
|
||||
qemu_fprintf(f, " ");
|
||||
}
|
||||
|
||||
if (arm_feature(env, ARM_FEATURE_M)) {
|
||||
|
@ -13811,15 +13811,15 @@ void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
|||
}
|
||||
}
|
||||
|
||||
cpu_fprintf(f, "XPSR=%08x %c%c%c%c %c %s%s\n",
|
||||
xpsr,
|
||||
xpsr & XPSR_N ? 'N' : '-',
|
||||
xpsr & XPSR_Z ? 'Z' : '-',
|
||||
xpsr & XPSR_C ? 'C' : '-',
|
||||
xpsr & XPSR_V ? 'V' : '-',
|
||||
xpsr & XPSR_T ? 'T' : 'A',
|
||||
ns_status,
|
||||
mode);
|
||||
qemu_fprintf(f, "XPSR=%08x %c%c%c%c %c %s%s\n",
|
||||
xpsr,
|
||||
xpsr & XPSR_N ? 'N' : '-',
|
||||
xpsr & XPSR_Z ? 'Z' : '-',
|
||||
xpsr & XPSR_C ? 'C' : '-',
|
||||
xpsr & XPSR_V ? 'V' : '-',
|
||||
xpsr & XPSR_T ? 'T' : 'A',
|
||||
ns_status,
|
||||
mode);
|
||||
} else {
|
||||
uint32_t psr = cpsr_read(env);
|
||||
const char *ns_status = "";
|
||||
|
@ -13829,15 +13829,15 @@ void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
|||
ns_status = env->cp15.scr_el3 & SCR_NS ? "NS " : "S ";
|
||||
}
|
||||
|
||||
cpu_fprintf(f, "PSR=%08x %c%c%c%c %c %s%s%d\n",
|
||||
psr,
|
||||
psr & CPSR_N ? 'N' : '-',
|
||||
psr & CPSR_Z ? 'Z' : '-',
|
||||
psr & CPSR_C ? 'C' : '-',
|
||||
psr & CPSR_V ? 'V' : '-',
|
||||
psr & CPSR_T ? 'T' : 'A',
|
||||
ns_status,
|
||||
aarch32_mode_name(psr), (psr & 0x10) ? 32 : 26);
|
||||
qemu_fprintf(f, "PSR=%08x %c%c%c%c %c %s%s%d\n",
|
||||
psr,
|
||||
psr & CPSR_N ? 'N' : '-',
|
||||
psr & CPSR_Z ? 'Z' : '-',
|
||||
psr & CPSR_C ? 'C' : '-',
|
||||
psr & CPSR_V ? 'V' : '-',
|
||||
psr & CPSR_T ? 'T' : 'A',
|
||||
ns_status,
|
||||
aarch32_mode_name(psr), (psr & 0x10) ? 32 : 26);
|
||||
}
|
||||
|
||||
if (flags & CPU_DUMP_FPU) {
|
||||
|
@ -13850,12 +13850,12 @@ void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
|||
}
|
||||
for (i = 0; i < numvfpregs; i++) {
|
||||
uint64_t v = *aa32_vfp_dreg(env, i);
|
||||
cpu_fprintf(f, "s%02d=%08x s%02d=%08x d%02d=%016" PRIx64 "\n",
|
||||
i * 2, (uint32_t)v,
|
||||
i * 2 + 1, (uint32_t)(v >> 32),
|
||||
i, v);
|
||||
qemu_fprintf(f, "s%02d=%08x s%02d=%08x d%02d=%016" PRIx64 "\n",
|
||||
i * 2, (uint32_t)v,
|
||||
i * 2 + 1, (uint32_t)(v >> 32),
|
||||
i, v);
|
||||
}
|
||||
cpu_fprintf(f, "FPSCR: %08x\n", vfp_get_fpscr(env));
|
||||
qemu_fprintf(f, "FPSCR: %08x\n", vfp_get_fpscr(env));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -166,8 +166,7 @@ static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn)
|
|||
#ifdef TARGET_AARCH64
|
||||
void a64_translate_init(void);
|
||||
void gen_a64_set_pc_im(uint64_t val);
|
||||
void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
|
||||
fprintf_function cpu_fprintf, int flags);
|
||||
void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags);
|
||||
extern const TranslatorOps aarch64_translator_ops;
|
||||
#else
|
||||
static inline void a64_translate_init(void)
|
||||
|
@ -178,9 +177,7 @@ static inline void gen_a64_set_pc_im(uint64_t val)
|
|||
{
|
||||
}
|
||||
|
||||
static inline void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
|
||||
fprintf_function cpu_fprintf,
|
||||
int flags)
|
||||
static inline void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "cpu.h"
|
||||
#include "qemu-common.h"
|
||||
#include "mmu.h"
|
||||
|
@ -103,27 +104,22 @@ static gint cris_cpu_list_compare(gconstpointer a, gconstpointer b)
|
|||
static void cris_cpu_list_entry(gpointer data, gpointer user_data)
|
||||
{
|
||||
ObjectClass *oc = data;
|
||||
CPUListState *s = user_data;
|
||||
const char *typename = object_class_get_name(oc);
|
||||
char *name;
|
||||
|
||||
name = g_strndup(typename, strlen(typename) - strlen(CRIS_CPU_TYPE_SUFFIX));
|
||||
(*s->cpu_fprintf)(s->file, " %s\n", name);
|
||||
qemu_printf(" %s\n", name);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
void cris_cpu_list(FILE *f, fprintf_function cpu_fprintf)
|
||||
void cris_cpu_list(void)
|
||||
{
|
||||
CPUListState s = {
|
||||
.file = f,
|
||||
.cpu_fprintf = cpu_fprintf,
|
||||
};
|
||||
GSList *list;
|
||||
|
||||
list = object_class_get_list(TYPE_CRIS_CPU, false);
|
||||
list = g_slist_sort(list, cris_cpu_list_compare);
|
||||
(*cpu_fprintf)(f, "Available CPUs:\n");
|
||||
g_slist_foreach(list, cris_cpu_list_entry, &s);
|
||||
qemu_printf("Available CPUs:\n");
|
||||
g_slist_foreach(list, cris_cpu_list_entry, NULL);
|
||||
g_slist_free(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -207,8 +207,7 @@ void cris_cpu_do_interrupt(CPUState *cpu);
|
|||
void crisv10_cpu_do_interrupt(CPUState *cpu);
|
||||
bool cris_cpu_exec_interrupt(CPUState *cpu, int int_req);
|
||||
|
||||
void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags);
|
||||
void cris_cpu_dump_state(CPUState *cs, FILE *f, int flags);
|
||||
|
||||
hwaddr cris_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
|
||||
|
||||
|
@ -308,6 +307,6 @@ static inline void cpu_get_tb_cpu_state(CPUCRISState *env, target_ulong *pc,
|
|||
}
|
||||
|
||||
#define cpu_list cris_cpu_list
|
||||
void cris_cpu_list(FILE *f, fprintf_function cpu_fprintf);
|
||||
void cris_cpu_list(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -60,7 +60,7 @@ int cris_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw,
|
|||
|
||||
cs->exception_index = 0xaa;
|
||||
cpu->env.pregs[PR_EDA] = address;
|
||||
cpu_dump_state(cs, stderr, fprintf, 0);
|
||||
cpu_dump_state(cs, stderr, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "exec/cpu_ldst.h"
|
||||
#include "exec/translator.h"
|
||||
#include "crisv32-decode.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
|
||||
#include "exec/helper-gen.h"
|
||||
|
||||
|
@ -3299,8 +3300,7 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
|
|||
#endif
|
||||
}
|
||||
|
||||
void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags)
|
||||
void cris_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
{
|
||||
CRISCPU *cpu = CRIS_CPU(cs);
|
||||
CPUCRISState *env = &cpu->env;
|
||||
|
@ -3308,7 +3308,7 @@ void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
|||
const char **pregnames;
|
||||
int i;
|
||||
|
||||
if (!env || !f) {
|
||||
if (!env) {
|
||||
return;
|
||||
}
|
||||
if (env->pregs[PR_VR] < 32) {
|
||||
|
@ -3319,40 +3319,40 @@ void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
|||
regnames = regnames_v32;
|
||||
}
|
||||
|
||||
cpu_fprintf(f, "PC=%x CCS=%x btaken=%d btarget=%x\n"
|
||||
"cc_op=%d cc_src=%d cc_dest=%d cc_result=%x cc_mask=%x\n",
|
||||
env->pc, env->pregs[PR_CCS], env->btaken, env->btarget,
|
||||
env->cc_op,
|
||||
env->cc_src, env->cc_dest, env->cc_result, env->cc_mask);
|
||||
qemu_fprintf(f, "PC=%x CCS=%x btaken=%d btarget=%x\n"
|
||||
"cc_op=%d cc_src=%d cc_dest=%d cc_result=%x cc_mask=%x\n",
|
||||
env->pc, env->pregs[PR_CCS], env->btaken, env->btarget,
|
||||
env->cc_op,
|
||||
env->cc_src, env->cc_dest, env->cc_result, env->cc_mask);
|
||||
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
cpu_fprintf(f, "%s=%8.8x ", regnames[i], env->regs[i]);
|
||||
qemu_fprintf(f, "%s=%8.8x ", regnames[i], env->regs[i]);
|
||||
if ((i + 1) % 4 == 0) {
|
||||
cpu_fprintf(f, "\n");
|
||||
qemu_fprintf(f, "\n");
|
||||
}
|
||||
}
|
||||
cpu_fprintf(f, "\nspecial regs:\n");
|
||||
qemu_fprintf(f, "\nspecial regs:\n");
|
||||
for (i = 0; i < 16; i++) {
|
||||
cpu_fprintf(f, "%s=%8.8x ", pregnames[i], env->pregs[i]);
|
||||
qemu_fprintf(f, "%s=%8.8x ", pregnames[i], env->pregs[i]);
|
||||
if ((i + 1) % 4 == 0) {
|
||||
cpu_fprintf(f, "\n");
|
||||
qemu_fprintf(f, "\n");
|
||||
}
|
||||
}
|
||||
if (env->pregs[PR_VR] >= 32) {
|
||||
uint32_t srs = env->pregs[PR_SRS];
|
||||
cpu_fprintf(f, "\nsupport function regs bank %x:\n", srs);
|
||||
qemu_fprintf(f, "\nsupport function regs bank %x:\n", srs);
|
||||
if (srs < ARRAY_SIZE(env->sregs)) {
|
||||
for (i = 0; i < 16; i++) {
|
||||
cpu_fprintf(f, "s%2.2d=%8.8x ",
|
||||
i, env->sregs[srs][i]);
|
||||
qemu_fprintf(f, "s%2.2d=%8.8x ",
|
||||
i, env->sregs[srs][i]);
|
||||
if ((i + 1) % 4 == 0) {
|
||||
cpu_fprintf(f, "\n");
|
||||
qemu_fprintf(f, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cpu_fprintf(f, "\n\n");
|
||||
qemu_fprintf(f, "\n\n");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "cpu.h"
|
||||
#include "qemu-common.h"
|
||||
#include "exec/exec-all.h"
|
||||
|
@ -113,22 +114,17 @@ static void hppa_cpu_realizefn(DeviceState *dev, Error **errp)
|
|||
static void hppa_cpu_list_entry(gpointer data, gpointer user_data)
|
||||
{
|
||||
ObjectClass *oc = data;
|
||||
CPUListState *s = user_data;
|
||||
|
||||
(*s->cpu_fprintf)(s->file, " %s\n", object_class_get_name(oc));
|
||||
qemu_printf(" %s\n", object_class_get_name(oc));
|
||||
}
|
||||
|
||||
void hppa_cpu_list(FILE *f, fprintf_function cpu_fprintf)
|
||||
void hppa_cpu_list(void)
|
||||
{
|
||||
CPUListState s = {
|
||||
.file = f,
|
||||
.cpu_fprintf = cpu_fprintf,
|
||||
};
|
||||
GSList *list;
|
||||
|
||||
list = object_class_get_list_sorted(TYPE_HPPA_CPU, false);
|
||||
(*cpu_fprintf)(f, "Available CPUs:\n");
|
||||
g_slist_foreach(list, hppa_cpu_list_entry, &s);
|
||||
qemu_printf("Available CPUs:\n");
|
||||
g_slist_foreach(list, hppa_cpu_list_entry, NULL);
|
||||
g_slist_free(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ void hppa_translate_init(void);
|
|||
|
||||
#define CPU_RESOLVING_TYPE TYPE_HPPA_CPU
|
||||
|
||||
void hppa_cpu_list(FILE *f, fprintf_function cpu_fprintf);
|
||||
void hppa_cpu_list(void);
|
||||
|
||||
static inline target_ulong hppa_form_gva_psw(target_ureg psw, uint64_t spc,
|
||||
target_ureg off)
|
||||
|
@ -359,7 +359,7 @@ int hppa_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
|
|||
int hppa_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||
void hppa_cpu_do_interrupt(CPUState *cpu);
|
||||
bool hppa_cpu_exec_interrupt(CPUState *cpu, int int_req);
|
||||
void hppa_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function, int);
|
||||
void hppa_cpu_dump_state(CPUState *cs, FILE *f, int);
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
int hppa_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size,
|
||||
int rw, int midx);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "fpu/softfloat.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "exec/helper-proto.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
|
||||
target_ureg cpu_hppa_get_psw(CPUHPPAState *env)
|
||||
{
|
||||
|
@ -76,8 +77,7 @@ void cpu_hppa_put_psw(CPUHPPAState *env, target_ureg psw)
|
|||
}
|
||||
}
|
||||
|
||||
void hppa_cpu_dump_state(CPUState *cs, FILE *f,
|
||||
fprintf_function cpu_fprintf, int flags)
|
||||
void hppa_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
{
|
||||
HPPACPU *cpu = HPPA_CPU(cs);
|
||||
CPUHPPAState *env = &cpu->env;
|
||||
|
@ -86,9 +86,9 @@ void hppa_cpu_dump_state(CPUState *cs, FILE *f,
|
|||
char psw_c[20];
|
||||
int i;
|
||||
|
||||
cpu_fprintf(f, "IA_F " TARGET_FMT_lx " IA_B " TARGET_FMT_lx "\n",
|
||||
hppa_form_gva_psw(psw, env->iasq_f, env->iaoq_f),
|
||||
hppa_form_gva_psw(psw, env->iasq_b, env->iaoq_b));
|
||||
qemu_fprintf(f, "IA_F " TARGET_FMT_lx " IA_B " TARGET_FMT_lx "\n",
|
||||
hppa_form_gva_psw(psw, env->iasq_f, env->iaoq_f),
|
||||
hppa_form_gva_psw(psw, env->iasq_b, env->iaoq_b));
|
||||
|
||||
psw_c[0] = (psw & PSW_W ? 'W' : '-');
|
||||
psw_c[1] = (psw & PSW_E ? 'E' : '-');
|
||||
|
@ -111,20 +111,20 @@ void hppa_cpu_dump_state(CPUState *cs, FILE *f,
|
|||
psw_c[18] = '\0';
|
||||
psw_cb = ((env->psw_cb >> 4) & 0x01111111) | (env->psw_cb_msb << 28);
|
||||
|
||||
cpu_fprintf(f, "PSW " TREG_FMT_lx " CB " TREG_FMT_lx " %s\n",
|
||||
psw, psw_cb, psw_c);
|
||||
qemu_fprintf(f, "PSW " TREG_FMT_lx " CB " TREG_FMT_lx " %s\n",
|
||||
psw, psw_cb, psw_c);
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
cpu_fprintf(f, "GR%02d " TREG_FMT_lx "%c", i, env->gr[i],
|
||||
(i & 3) == 3 ? '\n' : ' ');
|
||||
qemu_fprintf(f, "GR%02d " TREG_FMT_lx "%c", i, env->gr[i],
|
||||
(i & 3) == 3 ? '\n' : ' ');
|
||||
}
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
for (i = 0; i < 8; i++) {
|
||||
cpu_fprintf(f, "SR%02d %08x%c", i, (uint32_t)(env->sr[i] >> 32),
|
||||
(i & 3) == 3 ? '\n' : ' ');
|
||||
qemu_fprintf(f, "SR%02d %08x%c", i, (uint32_t)(env->sr[i] >> 32),
|
||||
(i & 3) == 3 ? '\n' : ' ');
|
||||
}
|
||||
#endif
|
||||
cpu_fprintf(f, "\n");
|
||||
qemu_fprintf(f, "\n");
|
||||
|
||||
/* ??? FR */
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "qemu/units.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/bitops.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
|
||||
#include "cpu.h"
|
||||
#include "exec/exec-all.h"
|
||||
|
@ -3671,7 +3672,7 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
|
|||
|
||||
/* Print all cpuid feature names in featureset
|
||||
*/
|
||||
static void listflags(FILE *f, fprintf_function print, GList *features)
|
||||
static void listflags(GList *features)
|
||||
{
|
||||
size_t len = 0;
|
||||
GList *tmp;
|
||||
|
@ -3679,13 +3680,13 @@ static void listflags(FILE *f, fprintf_function print, GList *features)
|
|||
for (tmp = features; tmp; tmp = tmp->next) {
|
||||
const char *name = tmp->data;
|
||||
if ((len + strlen(name) + 1) >= 75) {
|
||||
print(f, "\n");
|
||||
qemu_printf("\n");
|
||||
len = 0;
|
||||
}
|
||||
print(f, "%s%s", len == 0 ? " " : " ", name);
|
||||
qemu_printf("%s%s", len == 0 ? " " : " ", name);
|
||||
len += strlen(name) + 1;
|
||||
}
|
||||
print(f, "\n");
|
||||
qemu_printf("\n");
|
||||
}
|
||||
|
||||
/* Sort alphabetically by type name, respecting X86CPUClass::ordering. */
|
||||
|
@ -3721,32 +3722,26 @@ static void x86_cpu_list_entry(gpointer data, gpointer user_data)
|
|||
{
|
||||
ObjectClass *oc = data;
|
||||
X86CPUClass *cc = X86_CPU_CLASS(oc);
|
||||
CPUListState *s = user_data;
|
||||
char *name = x86_cpu_class_get_model_name(cc);
|
||||
const char *desc = cc->model_description;
|
||||
if (!desc && cc->cpu_def) {
|
||||
desc = cc->cpu_def->model_id;
|
||||
}
|
||||
|
||||
(*s->cpu_fprintf)(s->file, "x86 %-20s %-48s\n",
|
||||
name, desc);
|
||||
qemu_printf("x86 %-20s %-48s\n", name, desc);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
/* list available CPU models and flags */
|
||||
void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf)
|
||||
void x86_cpu_list(void)
|
||||
{
|
||||
int i, j;
|
||||
CPUListState s = {
|
||||
.file = f,
|
||||
.cpu_fprintf = cpu_fprintf,
|
||||
};
|
||||
GSList *list;
|
||||
GList *names = NULL;
|
||||
|
||||
(*cpu_fprintf)(f, "Available CPUs:\n");
|
||||
qemu_printf("Available CPUs:\n");
|
||||
list = get_sorted_cpu_model_list();
|
||||
g_slist_foreach(list, x86_cpu_list_entry, &s);
|
||||
g_slist_foreach(list, x86_cpu_list_entry, NULL);
|
||||
g_slist_free(list);
|
||||
|
||||
names = NULL;
|
||||
|
@ -3761,9 +3756,9 @@ void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf)
|
|||
|
||||
names = g_list_sort(names, (GCompareFunc)strcmp);
|
||||
|
||||
(*cpu_fprintf)(f, "\nRecognized CPUID flags:\n");
|
||||
listflags(f, cpu_fprintf, names);
|
||||
(*cpu_fprintf)(f, "\n");
|
||||
qemu_printf("\nRecognized CPUID flags:\n");
|
||||
listflags(names);
|
||||
qemu_printf("\n");
|
||||
g_list_free(names);
|
||||
}
|
||||
|
||||
|
|
|
@ -1521,8 +1521,7 @@ int x86_cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
|
|||
void x86_cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
|
||||
Error **errp);
|
||||
|
||||
void x86_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags);
|
||||
void x86_cpu_dump_state(CPUState *cs, FILE *f, int flags);
|
||||
|
||||
hwaddr x86_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
|
||||
|
||||
|
@ -1532,7 +1531,7 @@ int x86_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
|
|||
void x86_cpu_exec_enter(CPUState *cpu);
|
||||
void x86_cpu_exec_exit(CPUState *cpu);
|
||||
|
||||
void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf);
|
||||
void x86_cpu_list(void);
|
||||
int cpu_x86_support_mca_broadcast(CPUX86State *env);
|
||||
|
||||
int cpu_get_pic_interrupt(CPUX86State *s);
|
||||
|
@ -1924,8 +1923,7 @@ void enable_compat_apic_id_mode(void);
|
|||
#define APIC_DEFAULT_ADDRESS 0xfee00000
|
||||
#define APIC_SPACE_SIZE 0x100000
|
||||
|
||||
void x86_cpu_dump_local_apic_state(CPUState *cs, FILE *f,
|
||||
fprintf_function cpu_fprintf, int flags);
|
||||
void x86_cpu_dump_local_apic_state(CPUState *cs, int flags);
|
||||
|
||||
/* cpu.c */
|
||||
bool cpu_is_bsp(X86CPU *cpu);
|
||||
|
|
|
@ -540,7 +540,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env)
|
|||
ht->_exit_reason);
|
||||
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
|
||||
hax_vcpu_sync_state(env, 0);
|
||||
cpu_dump_state(cpu, stderr, fprintf, 0);
|
||||
cpu_dump_state(cpu, stderr, 0);
|
||||
ret = -1;
|
||||
break;
|
||||
case HAX_EXIT_HLT:
|
||||
|
@ -571,7 +571,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env)
|
|||
fprintf(stderr, "Unknown exit %x from HAX\n", ht->_exit_status);
|
||||
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
|
||||
hax_vcpu_sync_state(env, 0);
|
||||
cpu_dump_state(cpu, stderr, fprintf, 0);
|
||||
cpu_dump_state(cpu, stderr, 0);
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "qemu/osdep.h"
|
||||
#include "cpu.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "sysemu/kvm.h"
|
||||
#include "kvm_i386.h"
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
|
@ -155,38 +156,41 @@ static const char *cc_op_str[CC_OP_NB] = {
|
|||
};
|
||||
|
||||
static void
|
||||
cpu_x86_dump_seg_cache(CPUX86State *env, FILE *f, fprintf_function cpu_fprintf,
|
||||
cpu_x86_dump_seg_cache(CPUX86State *env, FILE *f,
|
||||
const char *name, struct SegmentCache *sc)
|
||||
{
|
||||
#ifdef TARGET_X86_64
|
||||
if (env->hflags & HF_CS64_MASK) {
|
||||
cpu_fprintf(f, "%-3s=%04x %016" PRIx64 " %08x %08x", name,
|
||||
sc->selector, sc->base, sc->limit, sc->flags & 0x00ffff00);
|
||||
qemu_fprintf(f, "%-3s=%04x %016" PRIx64 " %08x %08x", name,
|
||||
sc->selector, sc->base, sc->limit,
|
||||
sc->flags & 0x00ffff00);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
cpu_fprintf(f, "%-3s=%04x %08x %08x %08x", name, sc->selector,
|
||||
(uint32_t)sc->base, sc->limit, sc->flags & 0x00ffff00);
|
||||
qemu_fprintf(f, "%-3s=%04x %08x %08x %08x", name, sc->selector,
|
||||
(uint32_t)sc->base, sc->limit,
|
||||
sc->flags & 0x00ffff00);
|
||||
}
|
||||
|
||||
if (!(env->hflags & HF_PE_MASK) || !(sc->flags & DESC_P_MASK))
|
||||
goto done;
|
||||
|
||||
cpu_fprintf(f, " DPL=%d ", (sc->flags & DESC_DPL_MASK) >> DESC_DPL_SHIFT);
|
||||
qemu_fprintf(f, " DPL=%d ",
|
||||
(sc->flags & DESC_DPL_MASK) >> DESC_DPL_SHIFT);
|
||||
if (sc->flags & DESC_S_MASK) {
|
||||
if (sc->flags & DESC_CS_MASK) {
|
||||
cpu_fprintf(f, (sc->flags & DESC_L_MASK) ? "CS64" :
|
||||
((sc->flags & DESC_B_MASK) ? "CS32" : "CS16"));
|
||||
cpu_fprintf(f, " [%c%c", (sc->flags & DESC_C_MASK) ? 'C' : '-',
|
||||
(sc->flags & DESC_R_MASK) ? 'R' : '-');
|
||||
qemu_fprintf(f, (sc->flags & DESC_L_MASK) ? "CS64" :
|
||||
((sc->flags & DESC_B_MASK) ? "CS32" : "CS16"));
|
||||
qemu_fprintf(f, " [%c%c", (sc->flags & DESC_C_MASK) ? 'C' : '-',
|
||||
(sc->flags & DESC_R_MASK) ? 'R' : '-');
|
||||
} else {
|
||||
cpu_fprintf(f,
|
||||
(sc->flags & DESC_B_MASK || env->hflags & HF_LMA_MASK)
|
||||
? "DS " : "DS16");
|
||||
cpu_fprintf(f, " [%c%c", (sc->flags & DESC_E_MASK) ? 'E' : '-',
|
||||
(sc->flags & DESC_W_MASK) ? 'W' : '-');
|
||||
qemu_fprintf(f, (sc->flags & DESC_B_MASK
|
||||
|| env->hflags & HF_LMA_MASK)
|
||||
? "DS " : "DS16");
|
||||
qemu_fprintf(f, " [%c%c", (sc->flags & DESC_E_MASK) ? 'E' : '-',
|
||||
(sc->flags & DESC_W_MASK) ? 'W' : '-');
|
||||
}
|
||||
cpu_fprintf(f, "%c]", (sc->flags & DESC_A_MASK) ? 'A' : '-');
|
||||
qemu_fprintf(f, "%c]", (sc->flags & DESC_A_MASK) ? 'A' : '-');
|
||||
} else {
|
||||
static const char *sys_type_name[2][16] = {
|
||||
{ /* 32 bit mode */
|
||||
|
@ -202,13 +206,12 @@ cpu_x86_dump_seg_cache(CPUX86State *env, FILE *f, fprintf_function cpu_fprintf,
|
|||
"Reserved", "IntGate64", "TrapGate64"
|
||||
}
|
||||
};
|
||||
cpu_fprintf(f, "%s",
|
||||
sys_type_name[(env->hflags & HF_LMA_MASK) ? 1 : 0]
|
||||
[(sc->flags & DESC_TYPE_MASK)
|
||||
>> DESC_TYPE_SHIFT]);
|
||||
qemu_fprintf(f, "%s",
|
||||
sys_type_name[(env->hflags & HF_LMA_MASK) ? 1 : 0]
|
||||
[(sc->flags & DESC_TYPE_MASK) >> DESC_TYPE_SHIFT]);
|
||||
}
|
||||
done:
|
||||
cpu_fprintf(f, "\n");
|
||||
qemu_fprintf(f, "\n");
|
||||
}
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
|
@ -231,12 +234,10 @@ static inline const char *dm2str(uint32_t dm)
|
|||
return str[dm];
|
||||
}
|
||||
|
||||
static void dump_apic_lvt(FILE *f, fprintf_function cpu_fprintf,
|
||||
const char *name, uint32_t lvt, bool is_timer)
|
||||
static void dump_apic_lvt(const char *name, uint32_t lvt, bool is_timer)
|
||||
{
|
||||
uint32_t dm = (lvt & APIC_LVT_DELIV_MOD) >> APIC_LVT_DELIV_MOD_SHIFT;
|
||||
cpu_fprintf(f,
|
||||
"%s\t 0x%08x %s %-5s %-6s %-7s %-12s %-6s",
|
||||
qemu_printf("%s\t 0x%08x %s %-5s %-6s %-7s %-12s %-6s",
|
||||
name, lvt,
|
||||
lvt & APIC_LVT_INT_POLARITY ? "active-lo" : "active-hi",
|
||||
lvt & APIC_LVT_LEVEL_TRIGGER ? "level" : "edge",
|
||||
|
@ -248,9 +249,9 @@ static void dump_apic_lvt(FILE *f, fprintf_function cpu_fprintf,
|
|||
"tsc-deadline" : "one-shot",
|
||||
dm2str(dm));
|
||||
if (dm != APIC_DM_NMI) {
|
||||
cpu_fprintf(f, " (vec %u)\n", lvt & APIC_VECTOR_MASK);
|
||||
qemu_printf(" (vec %u)\n", lvt & APIC_VECTOR_MASK);
|
||||
} else {
|
||||
cpu_fprintf(f, "\n");
|
||||
qemu_printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,8 +283,7 @@ static inline void mask2str(char *str, uint32_t val, uint8_t size)
|
|||
|
||||
#define MAX_LOGICAL_APIC_ID_MASK_SIZE 16
|
||||
|
||||
static void dump_apic_icr(FILE *f, fprintf_function cpu_fprintf,
|
||||
APICCommonState *s, CPUX86State *env)
|
||||
static void dump_apic_icr(APICCommonState *s, CPUX86State *env)
|
||||
{
|
||||
uint32_t icr = s->icr[0], icr2 = s->icr[1];
|
||||
uint8_t dest_shorthand = \
|
||||
|
@ -293,16 +293,16 @@ static void dump_apic_icr(FILE *f, fprintf_function cpu_fprintf,
|
|||
uint32_t dest_field;
|
||||
bool x2apic;
|
||||
|
||||
cpu_fprintf(f, "ICR\t 0x%08x %s %s %s %s\n",
|
||||
qemu_printf("ICR\t 0x%08x %s %s %s %s\n",
|
||||
icr,
|
||||
logical_mod ? "logical" : "physical",
|
||||
icr & APIC_ICR_TRIGGER_MOD ? "level" : "edge",
|
||||
icr & APIC_ICR_LEVEL ? "assert" : "de-assert",
|
||||
shorthand2str(dest_shorthand));
|
||||
|
||||
cpu_fprintf(f, "ICR2\t 0x%08x", icr2);
|
||||
qemu_printf("ICR2\t 0x%08x", icr2);
|
||||
if (dest_shorthand != 0) {
|
||||
cpu_fprintf(f, "\n");
|
||||
qemu_printf("\n");
|
||||
return;
|
||||
}
|
||||
x2apic = env->features[FEAT_1_ECX] & CPUID_EXT_X2APIC;
|
||||
|
@ -310,9 +310,9 @@ static void dump_apic_icr(FILE *f, fprintf_function cpu_fprintf,
|
|||
|
||||
if (!logical_mod) {
|
||||
if (x2apic) {
|
||||
cpu_fprintf(f, " cpu %u (X2APIC ID)\n", dest_field);
|
||||
qemu_printf(" cpu %u (X2APIC ID)\n", dest_field);
|
||||
} else {
|
||||
cpu_fprintf(f, " cpu %u (APIC ID)\n",
|
||||
qemu_printf(" cpu %u (APIC ID)\n",
|
||||
dest_field & APIC_LOGDEST_XAPIC_ID);
|
||||
}
|
||||
return;
|
||||
|
@ -320,87 +320,84 @@ static void dump_apic_icr(FILE *f, fprintf_function cpu_fprintf,
|
|||
|
||||
if (s->dest_mode == 0xf) { /* flat mode */
|
||||
mask2str(apic_id_str, icr2 >> APIC_ICR_DEST_SHIFT, 8);
|
||||
cpu_fprintf(f, " mask %s (APIC ID)\n", apic_id_str);
|
||||
qemu_printf(" mask %s (APIC ID)\n", apic_id_str);
|
||||
} else if (s->dest_mode == 0) { /* cluster mode */
|
||||
if (x2apic) {
|
||||
mask2str(apic_id_str, dest_field & APIC_LOGDEST_X2APIC_ID, 16);
|
||||
cpu_fprintf(f, " cluster %u mask %s (X2APIC ID)\n",
|
||||
qemu_printf(" cluster %u mask %s (X2APIC ID)\n",
|
||||
dest_field >> APIC_LOGDEST_X2APIC_SHIFT, apic_id_str);
|
||||
} else {
|
||||
mask2str(apic_id_str, dest_field & APIC_LOGDEST_XAPIC_ID, 4);
|
||||
cpu_fprintf(f, " cluster %u mask %s (APIC ID)\n",
|
||||
qemu_printf(" cluster %u mask %s (APIC ID)\n",
|
||||
dest_field >> APIC_LOGDEST_XAPIC_SHIFT, apic_id_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_apic_interrupt(FILE *f, fprintf_function cpu_fprintf,
|
||||
const char *name, uint32_t *ireg_tab,
|
||||
static void dump_apic_interrupt(const char *name, uint32_t *ireg_tab,
|
||||
uint32_t *tmr_tab)
|
||||
{
|
||||
int i, empty = true;
|
||||
|
||||
cpu_fprintf(f, "%s\t ", name);
|
||||
qemu_printf("%s\t ", name);
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (apic_get_bit(ireg_tab, i)) {
|
||||
cpu_fprintf(f, "%u%s ", i,
|
||||
qemu_printf("%u%s ", i,
|
||||
apic_get_bit(tmr_tab, i) ? "(level)" : "");
|
||||
empty = false;
|
||||
}
|
||||
}
|
||||
cpu_fprintf(f, "%s\n", empty ? "(none)" : "");
|
||||
qemu_printf("%s\n", empty ? "(none)" : "");
|
||||
}
|
||||
|
||||
void x86_cpu_dump_local_apic_state(CPUState *cs, FILE *f,
|
||||
fprintf_function cpu_fprintf, int flags)
|
||||
void x86_cpu_dump_local_apic_state(CPUState *cs, int flags)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(cs);
|
||||
APICCommonState *s = APIC_COMMON(cpu->apic_state);
|
||||
if (!s) {
|
||||
cpu_fprintf(f, "local apic state not available\n");
|
||||
qemu_printf("local apic state not available\n");
|
||||
return;
|
||||
}
|
||||
uint32_t *lvt = s->lvt;
|
||||
|
||||
cpu_fprintf(f, "dumping local APIC state for CPU %-2u\n\n",
|
||||
qemu_printf("dumping local APIC state for CPU %-2u\n\n",
|
||||
CPU(cpu)->cpu_index);
|
||||
dump_apic_lvt(f, cpu_fprintf, "LVT0", lvt[APIC_LVT_LINT0], false);
|
||||
dump_apic_lvt(f, cpu_fprintf, "LVT1", lvt[APIC_LVT_LINT1], false);
|
||||
dump_apic_lvt(f, cpu_fprintf, "LVTPC", lvt[APIC_LVT_PERFORM], false);
|
||||
dump_apic_lvt(f, cpu_fprintf, "LVTERR", lvt[APIC_LVT_ERROR], false);
|
||||
dump_apic_lvt(f, cpu_fprintf, "LVTTHMR", lvt[APIC_LVT_THERMAL], false);
|
||||
dump_apic_lvt(f, cpu_fprintf, "LVTT", lvt[APIC_LVT_TIMER], true);
|
||||
dump_apic_lvt("LVT0", lvt[APIC_LVT_LINT0], false);
|
||||
dump_apic_lvt("LVT1", lvt[APIC_LVT_LINT1], false);
|
||||
dump_apic_lvt("LVTPC", lvt[APIC_LVT_PERFORM], false);
|
||||
dump_apic_lvt("LVTERR", lvt[APIC_LVT_ERROR], false);
|
||||
dump_apic_lvt("LVTTHMR", lvt[APIC_LVT_THERMAL], false);
|
||||
dump_apic_lvt("LVTT", lvt[APIC_LVT_TIMER], true);
|
||||
|
||||
cpu_fprintf(f, "Timer\t DCR=0x%x (divide by %u) initial_count = %u\n",
|
||||
qemu_printf("Timer\t DCR=0x%x (divide by %u) initial_count = %u\n",
|
||||
s->divide_conf & APIC_DCR_MASK,
|
||||
divider_conf(s->divide_conf),
|
||||
s->initial_count);
|
||||
|
||||
cpu_fprintf(f, "SPIV\t 0x%08x APIC %s, focus=%s, spurious vec %u\n",
|
||||
qemu_printf("SPIV\t 0x%08x APIC %s, focus=%s, spurious vec %u\n",
|
||||
s->spurious_vec,
|
||||
s->spurious_vec & APIC_SPURIO_ENABLED ? "enabled" : "disabled",
|
||||
s->spurious_vec & APIC_SPURIO_FOCUS ? "on" : "off",
|
||||
s->spurious_vec & APIC_VECTOR_MASK);
|
||||
|
||||
dump_apic_icr(f, cpu_fprintf, s, &cpu->env);
|
||||
dump_apic_icr(s, &cpu->env);
|
||||
|
||||
cpu_fprintf(f, "ESR\t 0x%08x\n", s->esr);
|
||||
qemu_printf("ESR\t 0x%08x\n", s->esr);
|
||||
|
||||
dump_apic_interrupt(f, cpu_fprintf, "ISR", s->isr, s->tmr);
|
||||
dump_apic_interrupt(f, cpu_fprintf, "IRR", s->irr, s->tmr);
|
||||
dump_apic_interrupt("ISR", s->isr, s->tmr);
|
||||
dump_apic_interrupt("IRR", s->irr, s->tmr);
|
||||
|
||||
cpu_fprintf(f, "\nAPR 0x%02x TPR 0x%02x DFR 0x%02x LDR 0x%02x",
|
||||
qemu_printf("\nAPR 0x%02x TPR 0x%02x DFR 0x%02x LDR 0x%02x",
|
||||
s->arb_id, s->tpr, s->dest_mode, s->log_dest);
|
||||
if (s->dest_mode == 0) {
|
||||
cpu_fprintf(f, "(cluster %u: id %u)",
|
||||
qemu_printf("(cluster %u: id %u)",
|
||||
s->log_dest >> APIC_LOGDEST_XAPIC_SHIFT,
|
||||
s->log_dest & APIC_LOGDEST_XAPIC_ID);
|
||||
}
|
||||
cpu_fprintf(f, " PPR 0x%02x\n", apic_get_ppr(s));
|
||||
qemu_printf(" PPR 0x%02x\n", apic_get_ppr(s));
|
||||
}
|
||||
#else
|
||||
void x86_cpu_dump_local_apic_state(CPUState *cs, FILE *f,
|
||||
fprintf_function cpu_fprintf, int flags)
|
||||
void x86_cpu_dump_local_apic_state(CPUState *cs, int flags)
|
||||
{
|
||||
}
|
||||
#endif /* !CONFIG_USER_ONLY */
|
||||
|
@ -408,8 +405,7 @@ void x86_cpu_dump_local_apic_state(CPUState *cs, FILE *f,
|
|||
#define DUMP_CODE_BYTES_TOTAL 50
|
||||
#define DUMP_CODE_BYTES_BACKWARD 20
|
||||
|
||||
void x86_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags)
|
||||
void x86_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(cs);
|
||||
CPUX86State *env = &cpu->env;
|
||||
|
@ -420,109 +416,107 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
|||
eflags = cpu_compute_eflags(env);
|
||||
#ifdef TARGET_X86_64
|
||||
if (env->hflags & HF_CS64_MASK) {
|
||||
cpu_fprintf(f,
|
||||
"RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"
|
||||
"RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"
|
||||
"R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"
|
||||
"R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"
|
||||
"RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",
|
||||
env->regs[R_EAX],
|
||||
env->regs[R_EBX],
|
||||
env->regs[R_ECX],
|
||||
env->regs[R_EDX],
|
||||
env->regs[R_ESI],
|
||||
env->regs[R_EDI],
|
||||
env->regs[R_EBP],
|
||||
env->regs[R_ESP],
|
||||
env->regs[8],
|
||||
env->regs[9],
|
||||
env->regs[10],
|
||||
env->regs[11],
|
||||
env->regs[12],
|
||||
env->regs[13],
|
||||
env->regs[14],
|
||||
env->regs[15],
|
||||
env->eip, eflags,
|
||||
eflags & DF_MASK ? 'D' : '-',
|
||||
eflags & CC_O ? 'O' : '-',
|
||||
eflags & CC_S ? 'S' : '-',
|
||||
eflags & CC_Z ? 'Z' : '-',
|
||||
eflags & CC_A ? 'A' : '-',
|
||||
eflags & CC_P ? 'P' : '-',
|
||||
eflags & CC_C ? 'C' : '-',
|
||||
env->hflags & HF_CPL_MASK,
|
||||
(env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
|
||||
(env->a20_mask >> 20) & 1,
|
||||
(env->hflags >> HF_SMM_SHIFT) & 1,
|
||||
cs->halted);
|
||||
qemu_fprintf(f, "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"
|
||||
"RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"
|
||||
"R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"
|
||||
"R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"
|
||||
"RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",
|
||||
env->regs[R_EAX],
|
||||
env->regs[R_EBX],
|
||||
env->regs[R_ECX],
|
||||
env->regs[R_EDX],
|
||||
env->regs[R_ESI],
|
||||
env->regs[R_EDI],
|
||||
env->regs[R_EBP],
|
||||
env->regs[R_ESP],
|
||||
env->regs[8],
|
||||
env->regs[9],
|
||||
env->regs[10],
|
||||
env->regs[11],
|
||||
env->regs[12],
|
||||
env->regs[13],
|
||||
env->regs[14],
|
||||
env->regs[15],
|
||||
env->eip, eflags,
|
||||
eflags & DF_MASK ? 'D' : '-',
|
||||
eflags & CC_O ? 'O' : '-',
|
||||
eflags & CC_S ? 'S' : '-',
|
||||
eflags & CC_Z ? 'Z' : '-',
|
||||
eflags & CC_A ? 'A' : '-',
|
||||
eflags & CC_P ? 'P' : '-',
|
||||
eflags & CC_C ? 'C' : '-',
|
||||
env->hflags & HF_CPL_MASK,
|
||||
(env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
|
||||
(env->a20_mask >> 20) & 1,
|
||||
(env->hflags >> HF_SMM_SHIFT) & 1,
|
||||
cs->halted);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
cpu_fprintf(f, "EAX=%08x EBX=%08x ECX=%08x EDX=%08x\n"
|
||||
"ESI=%08x EDI=%08x EBP=%08x ESP=%08x\n"
|
||||
"EIP=%08x EFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",
|
||||
(uint32_t)env->regs[R_EAX],
|
||||
(uint32_t)env->regs[R_EBX],
|
||||
(uint32_t)env->regs[R_ECX],
|
||||
(uint32_t)env->regs[R_EDX],
|
||||
(uint32_t)env->regs[R_ESI],
|
||||
(uint32_t)env->regs[R_EDI],
|
||||
(uint32_t)env->regs[R_EBP],
|
||||
(uint32_t)env->regs[R_ESP],
|
||||
(uint32_t)env->eip, eflags,
|
||||
eflags & DF_MASK ? 'D' : '-',
|
||||
eflags & CC_O ? 'O' : '-',
|
||||
eflags & CC_S ? 'S' : '-',
|
||||
eflags & CC_Z ? 'Z' : '-',
|
||||
eflags & CC_A ? 'A' : '-',
|
||||
eflags & CC_P ? 'P' : '-',
|
||||
eflags & CC_C ? 'C' : '-',
|
||||
env->hflags & HF_CPL_MASK,
|
||||
(env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
|
||||
(env->a20_mask >> 20) & 1,
|
||||
(env->hflags >> HF_SMM_SHIFT) & 1,
|
||||
cs->halted);
|
||||
qemu_fprintf(f, "EAX=%08x EBX=%08x ECX=%08x EDX=%08x\n"
|
||||
"ESI=%08x EDI=%08x EBP=%08x ESP=%08x\n"
|
||||
"EIP=%08x EFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",
|
||||
(uint32_t)env->regs[R_EAX],
|
||||
(uint32_t)env->regs[R_EBX],
|
||||
(uint32_t)env->regs[R_ECX],
|
||||
(uint32_t)env->regs[R_EDX],
|
||||
(uint32_t)env->regs[R_ESI],
|
||||
(uint32_t)env->regs[R_EDI],
|
||||
(uint32_t)env->regs[R_EBP],
|
||||
(uint32_t)env->regs[R_ESP],
|
||||
(uint32_t)env->eip, eflags,
|
||||
eflags & DF_MASK ? 'D' : '-',
|
||||
eflags & CC_O ? 'O' : '-',
|
||||
eflags & CC_S ? 'S' : '-',
|
||||
eflags & CC_Z ? 'Z' : '-',
|
||||
eflags & CC_A ? 'A' : '-',
|
||||
eflags & CC_P ? 'P' : '-',
|
||||
eflags & CC_C ? 'C' : '-',
|
||||
env->hflags & HF_CPL_MASK,
|
||||
(env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
|
||||
(env->a20_mask >> 20) & 1,
|
||||
(env->hflags >> HF_SMM_SHIFT) & 1,
|
||||
cs->halted);
|
||||
}
|
||||
|
||||
for(i = 0; i < 6; i++) {
|
||||
cpu_x86_dump_seg_cache(env, f, cpu_fprintf, seg_name[i],
|
||||
&env->segs[i]);
|
||||
cpu_x86_dump_seg_cache(env, f, seg_name[i], &env->segs[i]);
|
||||
}
|
||||
cpu_x86_dump_seg_cache(env, f, cpu_fprintf, "LDT", &env->ldt);
|
||||
cpu_x86_dump_seg_cache(env, f, cpu_fprintf, "TR", &env->tr);
|
||||
cpu_x86_dump_seg_cache(env, f, "LDT", &env->ldt);
|
||||
cpu_x86_dump_seg_cache(env, f, "TR", &env->tr);
|
||||
|
||||
#ifdef TARGET_X86_64
|
||||
if (env->hflags & HF_LMA_MASK) {
|
||||
cpu_fprintf(f, "GDT= %016" PRIx64 " %08x\n",
|
||||
env->gdt.base, env->gdt.limit);
|
||||
cpu_fprintf(f, "IDT= %016" PRIx64 " %08x\n",
|
||||
env->idt.base, env->idt.limit);
|
||||
cpu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",
|
||||
(uint32_t)env->cr[0],
|
||||
env->cr[2],
|
||||
env->cr[3],
|
||||
(uint32_t)env->cr[4]);
|
||||
qemu_fprintf(f, "GDT= %016" PRIx64 " %08x\n",
|
||||
env->gdt.base, env->gdt.limit);
|
||||
qemu_fprintf(f, "IDT= %016" PRIx64 " %08x\n",
|
||||
env->idt.base, env->idt.limit);
|
||||
qemu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",
|
||||
(uint32_t)env->cr[0],
|
||||
env->cr[2],
|
||||
env->cr[3],
|
||||
(uint32_t)env->cr[4]);
|
||||
for(i = 0; i < 4; i++)
|
||||
cpu_fprintf(f, "DR%d=%016" PRIx64 " ", i, env->dr[i]);
|
||||
cpu_fprintf(f, "\nDR6=%016" PRIx64 " DR7=%016" PRIx64 "\n",
|
||||
env->dr[6], env->dr[7]);
|
||||
qemu_fprintf(f, "DR%d=%016" PRIx64 " ", i, env->dr[i]);
|
||||
qemu_fprintf(f, "\nDR6=%016" PRIx64 " DR7=%016" PRIx64 "\n",
|
||||
env->dr[6], env->dr[7]);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
cpu_fprintf(f, "GDT= %08x %08x\n",
|
||||
(uint32_t)env->gdt.base, env->gdt.limit);
|
||||
cpu_fprintf(f, "IDT= %08x %08x\n",
|
||||
(uint32_t)env->idt.base, env->idt.limit);
|
||||
cpu_fprintf(f, "CR0=%08x CR2=%08x CR3=%08x CR4=%08x\n",
|
||||
(uint32_t)env->cr[0],
|
||||
(uint32_t)env->cr[2],
|
||||
(uint32_t)env->cr[3],
|
||||
(uint32_t)env->cr[4]);
|
||||
qemu_fprintf(f, "GDT= %08x %08x\n",
|
||||
(uint32_t)env->gdt.base, env->gdt.limit);
|
||||
qemu_fprintf(f, "IDT= %08x %08x\n",
|
||||
(uint32_t)env->idt.base, env->idt.limit);
|
||||
qemu_fprintf(f, "CR0=%08x CR2=%08x CR3=%08x CR4=%08x\n",
|
||||
(uint32_t)env->cr[0],
|
||||
(uint32_t)env->cr[2],
|
||||
(uint32_t)env->cr[3],
|
||||
(uint32_t)env->cr[4]);
|
||||
for(i = 0; i < 4; i++) {
|
||||
cpu_fprintf(f, "DR%d=" TARGET_FMT_lx " ", i, env->dr[i]);
|
||||
qemu_fprintf(f, "DR%d=" TARGET_FMT_lx " ", i, env->dr[i]);
|
||||
}
|
||||
cpu_fprintf(f, "\nDR6=" TARGET_FMT_lx " DR7=" TARGET_FMT_lx "\n",
|
||||
env->dr[6], env->dr[7]);
|
||||
qemu_fprintf(f, "\nDR6=" TARGET_FMT_lx " DR7=" TARGET_FMT_lx "\n",
|
||||
env->dr[6], env->dr[7]);
|
||||
}
|
||||
if (flags & CPU_DUMP_CCOP) {
|
||||
if ((unsigned)env->cc_op < CC_OP_NB)
|
||||
|
@ -531,55 +525,55 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
|||
snprintf(cc_op_name, sizeof(cc_op_name), "[%d]", env->cc_op);
|
||||
#ifdef TARGET_X86_64
|
||||
if (env->hflags & HF_CS64_MASK) {
|
||||
cpu_fprintf(f, "CCS=%016" PRIx64 " CCD=%016" PRIx64 " CCO=%-8s\n",
|
||||
env->cc_src, env->cc_dst,
|
||||
cc_op_name);
|
||||
qemu_fprintf(f, "CCS=%016" PRIx64 " CCD=%016" PRIx64 " CCO=%-8s\n",
|
||||
env->cc_src, env->cc_dst,
|
||||
cc_op_name);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
cpu_fprintf(f, "CCS=%08x CCD=%08x CCO=%-8s\n",
|
||||
(uint32_t)env->cc_src, (uint32_t)env->cc_dst,
|
||||
cc_op_name);
|
||||
qemu_fprintf(f, "CCS=%08x CCD=%08x CCO=%-8s\n",
|
||||
(uint32_t)env->cc_src, (uint32_t)env->cc_dst,
|
||||
cc_op_name);
|
||||
}
|
||||
}
|
||||
cpu_fprintf(f, "EFER=%016" PRIx64 "\n", env->efer);
|
||||
qemu_fprintf(f, "EFER=%016" PRIx64 "\n", env->efer);
|
||||
if (flags & CPU_DUMP_FPU) {
|
||||
int fptag;
|
||||
fptag = 0;
|
||||
for(i = 0; i < 8; i++) {
|
||||
fptag |= ((!env->fptags[i]) << i);
|
||||
}
|
||||
cpu_fprintf(f, "FCW=%04x FSW=%04x [ST=%d] FTW=%02x MXCSR=%08x\n",
|
||||
env->fpuc,
|
||||
(env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11,
|
||||
env->fpstt,
|
||||
fptag,
|
||||
env->mxcsr);
|
||||
qemu_fprintf(f, "FCW=%04x FSW=%04x [ST=%d] FTW=%02x MXCSR=%08x\n",
|
||||
env->fpuc,
|
||||
(env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11,
|
||||
env->fpstt,
|
||||
fptag,
|
||||
env->mxcsr);
|
||||
for(i=0;i<8;i++) {
|
||||
CPU_LDoubleU u;
|
||||
u.d = env->fpregs[i].d;
|
||||
cpu_fprintf(f, "FPR%d=%016" PRIx64 " %04x",
|
||||
i, u.l.lower, u.l.upper);
|
||||
qemu_fprintf(f, "FPR%d=%016" PRIx64 " %04x",
|
||||
i, u.l.lower, u.l.upper);
|
||||
if ((i & 1) == 1)
|
||||
cpu_fprintf(f, "\n");
|
||||
qemu_fprintf(f, "\n");
|
||||
else
|
||||
cpu_fprintf(f, " ");
|
||||
qemu_fprintf(f, " ");
|
||||
}
|
||||
if (env->hflags & HF_CS64_MASK)
|
||||
nb = 16;
|
||||
else
|
||||
nb = 8;
|
||||
for(i=0;i<nb;i++) {
|
||||
cpu_fprintf(f, "XMM%02d=%08x%08x%08x%08x",
|
||||
i,
|
||||
env->xmm_regs[i].ZMM_L(3),
|
||||
env->xmm_regs[i].ZMM_L(2),
|
||||
env->xmm_regs[i].ZMM_L(1),
|
||||
env->xmm_regs[i].ZMM_L(0));
|
||||
qemu_fprintf(f, "XMM%02d=%08x%08x%08x%08x",
|
||||
i,
|
||||
env->xmm_regs[i].ZMM_L(3),
|
||||
env->xmm_regs[i].ZMM_L(2),
|
||||
env->xmm_regs[i].ZMM_L(1),
|
||||
env->xmm_regs[i].ZMM_L(0));
|
||||
if ((i & 1) == 1)
|
||||
cpu_fprintf(f, "\n");
|
||||
qemu_fprintf(f, "\n");
|
||||
else
|
||||
cpu_fprintf(f, " ");
|
||||
qemu_fprintf(f, " ");
|
||||
}
|
||||
}
|
||||
if (flags & CPU_DUMP_CODE) {
|
||||
|
@ -588,17 +582,17 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
|||
uint8_t code;
|
||||
char codestr[3];
|
||||
|
||||
cpu_fprintf(f, "Code=");
|
||||
qemu_fprintf(f, "Code=");
|
||||
for (i = 0; i < DUMP_CODE_BYTES_TOTAL; i++) {
|
||||
if (cpu_memory_rw_debug(cs, base - offs + i, &code, 1, 0) == 0) {
|
||||
snprintf(codestr, sizeof(codestr), "%02x", code);
|
||||
} else {
|
||||
snprintf(codestr, sizeof(codestr), "??");
|
||||
}
|
||||
cpu_fprintf(f, "%s%s%s%s", i > 0 ? " " : "",
|
||||
i == offs ? "<" : "", codestr, i == offs ? ">" : "");
|
||||
qemu_fprintf(f, "%s%s%s%s", i > 0 ? " " : "",
|
||||
i == offs ? "<" : "", codestr, i == offs ? ">" : "");
|
||||
}
|
||||
cpu_fprintf(f, "\n");
|
||||
qemu_fprintf(f, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -664,8 +664,7 @@ void hmp_info_local_apic(Monitor *mon, const QDict *qdict)
|
|||
monitor_printf(mon, "No CPU available\n");
|
||||
return;
|
||||
}
|
||||
x86_cpu_dump_local_apic_state(cs, (FILE *)mon, monitor_fprintf,
|
||||
CPU_DUMP_FPU);
|
||||
x86_cpu_dump_local_apic_state(cs, CPU_DUMP_FPU);
|
||||
}
|
||||
|
||||
void hmp_info_io_apic(Monitor *mon, const QDict *qdict)
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "cpu.h"
|
||||
#include "qemu-common.h"
|
||||
|
||||
|
@ -34,27 +35,22 @@ static void lm32_cpu_set_pc(CPUState *cs, vaddr value)
|
|||
static void lm32_cpu_list_entry(gpointer data, gpointer user_data)
|
||||
{
|
||||
ObjectClass *oc = data;
|
||||
CPUListState *s = user_data;
|
||||
const char *typename = object_class_get_name(oc);
|
||||
char *name;
|
||||
|
||||
name = g_strndup(typename, strlen(typename) - strlen(LM32_CPU_TYPE_SUFFIX));
|
||||
(*s->cpu_fprintf)(s->file, " %s\n", name);
|
||||
qemu_printf(" %s\n", name);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
|
||||
void lm32_cpu_list(FILE *f, fprintf_function cpu_fprintf)
|
||||
void lm32_cpu_list(void)
|
||||
{
|
||||
CPUListState s = {
|
||||
.file = f,
|
||||
.cpu_fprintf = cpu_fprintf,
|
||||
};
|
||||
GSList *list;
|
||||
|
||||
list = object_class_get_list_sorted(TYPE_LM32_CPU, false);
|
||||
(*cpu_fprintf)(f, "Available CPUs:\n");
|
||||
g_slist_foreach(list, lm32_cpu_list_entry, &s);
|
||||
qemu_printf("Available CPUs:\n");
|
||||
g_slist_foreach(list, lm32_cpu_list_entry, NULL);
|
||||
g_slist_free(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -219,8 +219,7 @@ extern const struct VMStateDescription vmstate_lm32_cpu;
|
|||
|
||||
void lm32_cpu_do_interrupt(CPUState *cpu);
|
||||
bool lm32_cpu_exec_interrupt(CPUState *cs, int int_req);
|
||||
void lm32_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags);
|
||||
void lm32_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
|
||||
hwaddr lm32_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
|
||||
int lm32_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||
int lm32_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||
|
@ -243,7 +242,7 @@ static inline lm32_wp_t lm32_wp_type(uint32_t dc, int idx)
|
|||
is returned if the signal was handled by the virtual CPU. */
|
||||
int cpu_lm32_signal_handler(int host_signum, void *pinfo,
|
||||
void *puc);
|
||||
void lm32_cpu_list(FILE *f, fprintf_function cpu_fprintf);
|
||||
void lm32_cpu_list(void);
|
||||
void lm32_translate_init(void);
|
||||
void cpu_lm32_set_phys_msb_ignore(CPULM32State *env, int value);
|
||||
void QEMU_NORETURN raise_exception(CPULM32State *env, int index);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "exec/exec-all.h"
|
||||
#include "exec/translator.h"
|
||||
#include "tcg-op.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
|
||||
#include "exec/cpu_ldst.h"
|
||||
#include "hw/lm32/lm32_pic.h"
|
||||
|
@ -1161,38 +1162,37 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
|
|||
#endif
|
||||
}
|
||||
|
||||
void lm32_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags)
|
||||
void lm32_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
{
|
||||
LM32CPU *cpu = LM32_CPU(cs);
|
||||
CPULM32State *env = &cpu->env;
|
||||
int i;
|
||||
|
||||
if (!env || !f) {
|
||||
if (!env) {
|
||||
return;
|
||||
}
|
||||
|
||||
cpu_fprintf(f, "IN: PC=%x %s\n",
|
||||
env->pc, lookup_symbol(env->pc));
|
||||
qemu_fprintf(f, "IN: PC=%x %s\n",
|
||||
env->pc, lookup_symbol(env->pc));
|
||||
|
||||
cpu_fprintf(f, "ie=%8.8x (IE=%x EIE=%x BIE=%x) im=%8.8x ip=%8.8x\n",
|
||||
env->ie,
|
||||
(env->ie & IE_IE) ? 1 : 0,
|
||||
(env->ie & IE_EIE) ? 1 : 0,
|
||||
(env->ie & IE_BIE) ? 1 : 0,
|
||||
lm32_pic_get_im(env->pic_state),
|
||||
lm32_pic_get_ip(env->pic_state));
|
||||
cpu_fprintf(f, "eba=%8.8x deba=%8.8x\n",
|
||||
env->eba,
|
||||
env->deba);
|
||||
qemu_fprintf(f, "ie=%8.8x (IE=%x EIE=%x BIE=%x) im=%8.8x ip=%8.8x\n",
|
||||
env->ie,
|
||||
(env->ie & IE_IE) ? 1 : 0,
|
||||
(env->ie & IE_EIE) ? 1 : 0,
|
||||
(env->ie & IE_BIE) ? 1 : 0,
|
||||
lm32_pic_get_im(env->pic_state),
|
||||
lm32_pic_get_ip(env->pic_state));
|
||||
qemu_fprintf(f, "eba=%8.8x deba=%8.8x\n",
|
||||
env->eba,
|
||||
env->deba);
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
cpu_fprintf(f, "r%2.2d=%8.8x ", i, env->regs[i]);
|
||||
qemu_fprintf(f, "r%2.2d=%8.8x ", i, env->regs[i]);
|
||||
if ((i + 1) % 4 == 0) {
|
||||
cpu_fprintf(f, "\n");
|
||||
qemu_fprintf(f, "\n");
|
||||
}
|
||||
}
|
||||
cpu_fprintf(f, "\n\n");
|
||||
qemu_fprintf(f, "\n\n");
|
||||
}
|
||||
|
||||
void restore_state_to_opc(CPULM32State *env, TranslationBlock *tb,
|
||||
|
|
|
@ -179,8 +179,7 @@ static inline M68kCPU *m68k_env_get_cpu(CPUM68KState *env)
|
|||
|
||||
void m68k_cpu_do_interrupt(CPUState *cpu);
|
||||
bool m68k_cpu_exec_interrupt(CPUState *cpu, int int_req);
|
||||
void m68k_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags);
|
||||
void m68k_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
|
||||
hwaddr m68k_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
|
||||
int m68k_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||
int m68k_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||
|
@ -499,7 +498,7 @@ static inline int m68k_feature(CPUM68KState *env, int feature)
|
|||
return (env->features & (1u << feature)) != 0;
|
||||
}
|
||||
|
||||
void m68k_cpu_list(FILE *f, fprintf_function cpu_fprintf);
|
||||
void m68k_cpu_list(void);
|
||||
|
||||
void register_m68k_insns (CPUM68KState *env);
|
||||
|
||||
|
@ -573,5 +572,6 @@ static inline void cpu_get_tb_cpu_state(CPUM68KState *env, target_ulong *pc,
|
|||
}
|
||||
}
|
||||
|
||||
void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUM68KState *env);
|
||||
void dump_mmu(CPUM68KState *env);
|
||||
|
||||
#endif
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue