Commit c732abe2 authored by j_mayer's avatar j_mayer
Browse files

Unify '-cpu ?' option.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3380 c046a42c-6fe2-441c-8c8c-71466251a162
parent 90251fb9
...@@ -1945,14 +1945,9 @@ int main(int argc, char **argv) ...@@ -1945,14 +1945,9 @@ int main(int argc, char **argv)
} else if (!strcmp(r, "cpu")) { } else if (!strcmp(r, "cpu")) {
cpu_model = argv[optind++]; cpu_model = argv[optind++];
if (strcmp(cpu_model, "?") == 0) { if (strcmp(cpu_model, "?") == 0) {
#if defined(TARGET_PPC) /* XXX: implement xxx_cpu_list for targets that still miss it */
ppc_cpu_list(stdout, &fprintf); #if defined(cpu_list)
#elif defined(TARGET_ARM) cpu_list(stdout, &fprintf);
arm_cpu_list();
#elif defined(TARGET_MIPS)
mips_cpu_list(stdout, &fprintf);
#elif defined(TARGET_SPARC)
sparc_cpu_list(stdout, &fprintf);
#endif #endif
_exit(1); _exit(1);
} }
......
...@@ -260,7 +260,7 @@ static inline int arm_feature(CPUARMState *env, int feature) ...@@ -260,7 +260,7 @@ static inline int arm_feature(CPUARMState *env, int feature)
return (env->features & (1u << feature)) != 0; return (env->features & (1u << feature)) != 0;
} }
void arm_cpu_list(void); void arm_cpu_list(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...));
void cpu_arm_set_model(CPUARMState *env, const char *name); void cpu_arm_set_model(CPUARMState *env, const char *name);
void cpu_arm_set_cp_io(CPUARMState *env, int cpnum, void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,
...@@ -299,6 +299,7 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum, ...@@ -299,6 +299,7 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,
#define cpu_exec cpu_arm_exec #define cpu_exec cpu_arm_exec
#define cpu_gen_code cpu_arm_gen_code #define cpu_gen_code cpu_arm_gen_code
#define cpu_signal_handler cpu_arm_signal_handler #define cpu_signal_handler cpu_arm_signal_handler
#define cpu_list arm_cpu_list
#include "cpu-all.h" #include "cpu-all.h"
......
...@@ -126,13 +126,13 @@ static const struct arm_cpu_t arm_cpu_names[] = { ...@@ -126,13 +126,13 @@ static const struct arm_cpu_t arm_cpu_names[] = {
{ 0, NULL} { 0, NULL}
}; };
void arm_cpu_list(void) void arm_cpu_list(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
{ {
int i; int i;
printf ("Available CPUs:\n"); (*cpu_fprintf)(f, "Available CPUs:\n");
for (i = 0; arm_cpu_names[i].name; i++) { for (i = 0; arm_cpu_names[i].name; i++) {
printf(" %s\n", arm_cpu_names[i].name); (*cpu_fprintf)(f, " %s\n", arm_cpu_names[i].name);
} }
} }
......
...@@ -482,6 +482,7 @@ int cpu_mips_register (CPUMIPSState *env, mips_def_t *def); ...@@ -482,6 +482,7 @@ int cpu_mips_register (CPUMIPSState *env, mips_def_t *def);
#define cpu_exec cpu_mips_exec #define cpu_exec cpu_mips_exec
#define cpu_gen_code cpu_mips_gen_code #define cpu_gen_code cpu_mips_gen_code
#define cpu_signal_handler cpu_mips_signal_handler #define cpu_signal_handler cpu_mips_signal_handler
#define cpu_list mips_cpu_list
#include "cpu-all.h" #include "cpu-all.h"
......
...@@ -697,6 +697,7 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val); ...@@ -697,6 +697,7 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val);
#define cpu_exec cpu_ppc_exec #define cpu_exec cpu_ppc_exec
#define cpu_gen_code cpu_ppc_gen_code #define cpu_gen_code cpu_ppc_gen_code
#define cpu_signal_handler cpu_ppc_signal_handler #define cpu_signal_handler cpu_ppc_signal_handler
#define cpu_list ppc_cpu_list
#include "cpu-all.h" #include "cpu-all.h"
......
...@@ -315,6 +315,7 @@ void cpu_check_irqs(CPUSPARCState *env); ...@@ -315,6 +315,7 @@ void cpu_check_irqs(CPUSPARCState *env);
#define cpu_exec cpu_sparc_exec #define cpu_exec cpu_sparc_exec
#define cpu_gen_code cpu_sparc_gen_code #define cpu_gen_code cpu_sparc_gen_code
#define cpu_signal_handler cpu_sparc_signal_handler #define cpu_signal_handler cpu_sparc_signal_handler
#define cpu_list sparc_cpu_list
#include "cpu-all.h" #include "cpu-all.h"
......
...@@ -7690,14 +7690,9 @@ int main(int argc, char **argv) ...@@ -7690,14 +7690,9 @@ int main(int argc, char **argv)
case QEMU_OPTION_cpu: case QEMU_OPTION_cpu:
/* hw initialization will check this */ /* hw initialization will check this */
if (*optarg == '?') { if (*optarg == '?') {
#if defined(TARGET_PPC) /* XXX: implement xxx_cpu_list for targets that still miss it */
ppc_cpu_list(stdout, &fprintf); #if defined(cpu_list)
#elif defined(TARGET_ARM) cpu_list(stdout, &fprintf);
arm_cpu_list();
#elif defined(TARGET_MIPS)
mips_cpu_list(stdout, &fprintf);
#elif defined(TARGET_SPARC)
sparc_cpu_list(stdout, &fprintf);
#endif #endif
exit(0); exit(0);
} else { } else {
......
...@@ -741,14 +741,6 @@ int qemu_register_machine(QEMUMachine *m); ...@@ -741,14 +741,6 @@ int qemu_register_machine(QEMUMachine *m);
typedef void SetIRQFunc(void *opaque, int irq_num, int level); typedef void SetIRQFunc(void *opaque, int irq_num, int level);
#if defined(TARGET_PPC)
void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...));
#endif
#if defined(TARGET_MIPS)
void mips_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...));
#endif
#include "hw/irq.h" #include "hw/irq.h"
/* ISA bus */ /* ISA bus */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment