From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <afaerber@suse.de>, rth@twiddle.net
Subject: [Qemu-devel] [PATCH 3/7] target-alpha: Add support for -cpu ?
Date: Wed, 31 Oct 2012 04:04:00 +0100 [thread overview]
Message-ID: <1351652644-18687-4-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1351652644-18687-1-git-send-email-afaerber@suse.de>
Implement alphabetical listing of CPU subclasses.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
target-alpha/cpu.c | 41 +++++++++++++++++++++++++++++++++++++++++
target-alpha/cpu.h | 4 +++-
2 Dateien geändert, 44 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c
index e1a5739..ab25c44 100644
--- a/target-alpha/cpu.c
+++ b/target-alpha/cpu.c
@@ -23,6 +23,47 @@
#include "qemu-common.h"
+typedef struct AlphaCPUListState {
+ fprintf_function cpu_fprintf;
+ FILE *file;
+} AlphaCPUListState;
+
+/* Sort alphabetically by type name. */
+static gint alpha_cpu_list_compare(gconstpointer a, gconstpointer b)
+{
+ ObjectClass *class_a = (ObjectClass *)a;
+ ObjectClass *class_b = (ObjectClass *)b;
+ const char *name_a, *name_b;
+
+ name_a = object_class_get_name(class_a);
+ name_b = object_class_get_name(class_b);
+ return strcmp(name_a, name_b);
+}
+
+static void alpha_cpu_list_entry(gpointer data, gpointer user_data)
+{
+ ObjectClass *oc = data;
+ AlphaCPUListState *s = user_data;
+
+ (*s->cpu_fprintf)(s->file, " %s\n",
+ object_class_get_name(oc));
+}
+
+void alpha_cpu_list(FILE *f, fprintf_function cpu_fprintf)
+{
+ AlphaCPUListState s = {
+ .file = f,
+ .cpu_fprintf = cpu_fprintf,
+ };
+ GSList *list;
+
+ list = object_class_get_list(TYPE_ALPHA_CPU, false);
+ list = g_slist_sort(list, alpha_cpu_list_compare);
+ (*cpu_fprintf)(f, "Available CPUs:\n");
+ g_slist_foreach(list, alpha_cpu_list_entry, &s);
+ g_slist_free(list);
+}
+
/* Models */
static void ev4_cpu_initfn(Object *obj)
diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h
index 8f131b7..28999ab 100644
--- a/target-alpha/cpu.h
+++ b/target-alpha/cpu.h
@@ -298,6 +298,7 @@ struct CPUAlphaState {
};
#define cpu_init cpu_alpha_init
+#define cpu_list alpha_cpu_list
#define cpu_exec cpu_alpha_exec
#define cpu_gen_code cpu_alpha_gen_code
#define cpu_signal_handler cpu_alpha_signal_handler
@@ -434,7 +435,8 @@ enum {
IR_ZERO = 31,
};
-CPUAlphaState * cpu_alpha_init (const char *cpu_model);
+CPUAlphaState *cpu_alpha_init(const char *cpu_model);
+void alpha_cpu_list(FILE *f, fprintf_function cpu_fprintf);
int cpu_alpha_exec(CPUAlphaState *s);
/* you can call this signal handler from your SIGBUS and SIGSEGV
signal handlers to inform the virtual CPU of exceptions. non zero
--
1.7.10.4
next prev parent reply other threads:[~2012-10-31 3:04 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-31 3:03 [Qemu-devel] [PATCH 0/7] target-alpha: More CPU QOM'ifications Andreas Färber
2012-10-31 3:03 ` [Qemu-devel] [FYI 1/7] target-alpha: Use consistent include paths Andreas Färber
2012-10-31 3:03 ` [Qemu-devel] [PATCH 2/7] target-alpha: Turn CPU definitions into subclasses Andreas Färber
2012-10-31 4:57 ` Richard Henderson
2012-12-06 10:11 ` Andreas Färber
2012-12-07 13:58 ` Richard Henderson
2012-12-06 15:29 ` Eduardo Habkost
2012-12-06 15:51 ` Andreas Färber
2012-12-06 16:09 ` Eduardo Habkost
2012-12-06 16:21 ` Andreas Färber
2012-10-31 3:04 ` Andreas Färber [this message]
2012-10-31 5:01 ` [Qemu-devel] [PATCH 3/7] target-alpha: Add support for -cpu ? Richard Henderson
2012-12-06 15:37 ` Eduardo Habkost
2012-12-06 15:42 ` Andreas Färber
2012-12-06 16:02 ` Andreas Färber
2012-12-06 17:45 ` Eduardo Habkost
2012-12-06 15:59 ` Peter Maydell
2012-12-06 16:10 ` Eduardo Habkost
2012-10-31 3:04 ` [Qemu-devel] [PATCH 4/7] target-alpha: Let cpu_alpha_init() return AlphaCPU Andreas Färber
2012-10-31 5:02 ` Richard Henderson
2012-10-31 3:04 ` [Qemu-devel] [PATCH 5/7] alpha: Pass AlphaCPU array to Typhoon Andreas Färber
2012-10-31 5:04 ` Richard Henderson
2012-10-31 3:04 ` [Qemu-devel] [PATCH 6/7] target-alpha: Avoid leaking the alarm timer over reset Andreas Färber
2012-10-31 5:08 ` Richard Henderson
2012-10-31 3:04 ` [Qemu-devel] [RFC 7/7] target-alpha: Implement CPU reset Andreas Färber
2012-10-31 5:10 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1351652644-18687-4-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).