[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 06/13] [PATCH] turn info kqemu into generic info acc
From: |
Glauber Costa |
Subject: |
[Qemu-devel] [PATCH 06/13] [PATCH] turn info kqemu into generic info accelerator |
Date: |
Thu, 15 May 2008 11:09:26 -0300 |
---
exec-all.h | 8 ++++++++
kqemu.c | 24 ++++++++++++++++++++++++
monitor.c | 36 +++++++++++++-----------------------
3 files changed, 45 insertions(+), 23 deletions(-)
diff --git a/exec-all.h b/exec-all.h
index bfc6576..f1bd7ae 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -583,6 +583,7 @@ typedef struct QEMUAccel {
void (*init_env)(CPUState *env);
void (*flush_cache)(CPUState *env, int global);
void (*flush_page)(CPUState *env, target_ulong addr);
+ int (*info)(CPUState *env, char *buf);
} QEMUAccel;
extern QEMUAccel *current_accel;
@@ -616,6 +617,13 @@ static inline void accel_flush_page(CPUState *env,
target_ulong addr)
current_accel->flush_page(env, addr);
}
+static inline int accel_info(CPUState *env, char *buf)
+{
+ if (current_accel && current_accel->info)
+ return current_accel->info(env, buf);
+ return 0;
+}
+
#ifdef USE_KQEMU
#define KQEMU_MODIFY_PAGE_MASK (0xff & ~(VGA_DIRTY_FLAG | CODE_DIRTY_FLAG))
diff --git a/kqemu.c b/kqemu.c
index 524c74d..451d1d4 100644
--- a/kqemu.c
+++ b/kqemu.c
@@ -284,11 +284,35 @@ void kqemu_flush(CPUState *env, int global)
nb_pages_to_flush = KQEMU_FLUSH_ALL;
}
+int kqemu_info(CPUState *env, char *buf)
+{
+ int val, len;
+ val = 0;
+ val = env->kqemu_enabled;
+ len = sprintf(buf, "kqemu support: ");
+ buf += len;
+
+ switch(val) {
+ default:
+ len += sprintf(buf, "present, but bogus value\n");
+ break;
+ case 1:
+ len += sprintf(buf, "enabled for user code\n");
+ break;
+ case 2:
+ len += sprintf(buf, "enabled for user and kernel code\n");
+ break;
+ }
+
+ return len;
+}
+
QEMUAccel kqemu_accel = {
.cpu_interrupt = kqemu_cpu_interrupt,
.init_env = kqemu_init_env,
.flush_cache = kqemu_flush,
.flush_page = kqemu_flush_page,
+ .info = kqemu_info,
};
diff --git a/monitor.c b/monitor.c
index 236b827..cb9faef 100644
--- a/monitor.c
+++ b/monitor.c
@@ -34,6 +34,7 @@
#include "block.h"
#include "audio/audio.h"
#include "disas.h"
+#include "exec-all.h"
#include <dirent.h>
#ifdef CONFIG_PROFILER
@@ -1165,34 +1166,23 @@ static void mem_info(void)
}
#endif
-static void do_info_kqemu(void)
+#define MAX_BUF 1024
+static void do_info_accelerator(void)
{
-#ifdef USE_KQEMU
+ char buf[MAX_BUF];
CPUState *env;
- int val;
- val = 0;
+
env = mon_get_cpu();
+
if (!env) {
term_printf("No cpu initialized yet");
return;
}
- val = env->kqemu_enabled;
- term_printf("kqemu support: ");
- switch(val) {
- default:
- case 0:
- term_printf("disabled\n");
- break;
- case 1:
- term_printf("enabled for user code\n");
- break;
- case 2:
- term_printf("enabled for user and kernel code\n");
- break;
- }
-#else
- term_printf("kqemu support: not compiled\n");
-#endif
+
+ if (accel_info(env, buf))
+ term_printf(buf);
+ else
+ term_printf("No accelerator present\n");
}
#ifdef CONFIG_PROFILER
@@ -1422,8 +1412,8 @@ static term_cmd_t info_cmds[] = {
#endif
{ "jit", "", do_info_jit,
"", "show dynamic compiler info", },
- { "kqemu", "", do_info_kqemu,
- "", "show kqemu information", },
+ { "accelerator", "", do_info_accelerator,
+ "", "show accelerator information", },
{ "usb", "", usb_info,
"", "show guest USB devices", },
{ "usbhost", "", usb_host_info,
--
1.5.5
- [Qemu-devel] [PATCH 0/13] New shot at QEMUAccel, Glauber Costa, 2008/05/15
- [Qemu-devel] [PATCH 01/13] [PATCH] make cpu_exec_init symmetric, Glauber Costa, 2008/05/15
- [Qemu-devel] [PATCH 02/13] [PATCH] split kqemu_init into two, Glauber Costa, 2008/05/15
- [Qemu-devel] [PATCH 03/13] [PATCH] introduce QEMUAccel and fill it with interrupt specific driver, Glauber Costa, 2008/05/15
- [Qemu-devel] [PATCH 04/13] [PATCH] init env made accel driver, Glauber Costa, 2008/05/15
- [Qemu-devel] [PATCH 05/13] [PATCH] wrap cache flushing functions into accel drivers, Glauber Costa, 2008/05/15
- [Qemu-devel] [PATCH 06/13] [PATCH] turn info kqemu into generic info accelerator,
Glauber Costa <=
- [Qemu-devel] [PATCH 07/13] [PATCH] separate accelerator part of info profiler, Glauber Costa, 2008/05/15
- [Qemu-devel] [PATCH 08/13] [PATCH] move kqemu externs to kqemu.h, Glauber Costa, 2008/05/15
- [Qemu-devel] [PATCH 09/13] [PATCH] move disabling code to kqemu.c instead of vl.c, Glauber Costa, 2008/05/15
- [Qemu-devel] [PATCH 10/13] [PATCH] set_notdirty goes through accel wrapper, Glauber Costa, 2008/05/15
- [Qemu-devel] [PATCH 11/13] [PATCH] wrap modify_page through accel calls, Glauber Costa, 2008/05/15
- [Qemu-devel] [PATCH 12/13] [PATCH] remove kqemu reference from hw/pc.c, Glauber Costa, 2008/05/15
- [Qemu-devel] [PATCH 13/13] [PATCH] build list of available accelerators, Glauber Costa, 2008/05/15