Commit c732abe2227954316a5db399aac2040ec0d68f91
1 parent
90251fb9
Unify '-cpu ?' option.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3380 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
8 changed files
with
14 additions
and
28 deletions
linux-user/main.c
| @@ -1945,14 +1945,9 @@ int main(int argc, char **argv) | @@ -1945,14 +1945,9 @@ int main(int argc, char **argv) | ||
| 1945 | } else if (!strcmp(r, "cpu")) { | 1945 | } else if (!strcmp(r, "cpu")) { |
| 1946 | cpu_model = argv[optind++]; | 1946 | cpu_model = argv[optind++]; |
| 1947 | if (strcmp(cpu_model, "?") == 0) { | 1947 | if (strcmp(cpu_model, "?") == 0) { |
| 1948 | -#if defined(TARGET_PPC) | ||
| 1949 | - ppc_cpu_list(stdout, &fprintf); | ||
| 1950 | -#elif defined(TARGET_ARM) | ||
| 1951 | - arm_cpu_list(); | ||
| 1952 | -#elif defined(TARGET_MIPS) | ||
| 1953 | - mips_cpu_list(stdout, &fprintf); | ||
| 1954 | -#elif defined(TARGET_SPARC) | ||
| 1955 | - sparc_cpu_list(stdout, &fprintf); | 1948 | +/* XXX: implement xxx_cpu_list for targets that still miss it */ |
| 1949 | +#if defined(cpu_list) | ||
| 1950 | + cpu_list(stdout, &fprintf); | ||
| 1956 | #endif | 1951 | #endif |
| 1957 | _exit(1); | 1952 | _exit(1); |
| 1958 | } | 1953 | } |
target-arm/cpu.h
| @@ -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) | ||
| 260 | return (env->features & (1u << feature)) != 0; | 260 | return (env->features & (1u << feature)) != 0; |
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | -void arm_cpu_list(void); | 263 | +void arm_cpu_list(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...)); |
| 264 | void cpu_arm_set_model(CPUARMState *env, const char *name); | 264 | void cpu_arm_set_model(CPUARMState *env, const char *name); |
| 265 | 265 | ||
| 266 | void cpu_arm_set_cp_io(CPUARMState *env, int cpnum, | 266 | 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, | ||
| 299 | #define cpu_exec cpu_arm_exec | 299 | #define cpu_exec cpu_arm_exec |
| 300 | #define cpu_gen_code cpu_arm_gen_code | 300 | #define cpu_gen_code cpu_arm_gen_code |
| 301 | #define cpu_signal_handler cpu_arm_signal_handler | 301 | #define cpu_signal_handler cpu_arm_signal_handler |
| 302 | +#define cpu_list arm_cpu_list | ||
| 302 | 303 | ||
| 303 | #include "cpu-all.h" | 304 | #include "cpu-all.h" |
| 304 | 305 |
target-arm/helper.c
| @@ -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[] = { | ||
| 126 | { 0, NULL} | 126 | { 0, NULL} |
| 127 | }; | 127 | }; |
| 128 | 128 | ||
| 129 | -void arm_cpu_list(void) | 129 | +void arm_cpu_list(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...)) |
| 130 | { | 130 | { |
| 131 | int i; | 131 | int i; |
| 132 | 132 | ||
| 133 | - printf ("Available CPUs:\n"); | 133 | + (*cpu_fprintf)(f, "Available CPUs:\n"); |
| 134 | for (i = 0; arm_cpu_names[i].name; i++) { | 134 | for (i = 0; arm_cpu_names[i].name; i++) { |
| 135 | - printf(" %s\n", arm_cpu_names[i].name); | 135 | + (*cpu_fprintf)(f, " %s\n", arm_cpu_names[i].name); |
| 136 | } | 136 | } |
| 137 | } | 137 | } |
| 138 | 138 |
target-mips/cpu.h
| @@ -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); | ||
| 482 | #define cpu_exec cpu_mips_exec | 482 | #define cpu_exec cpu_mips_exec |
| 483 | #define cpu_gen_code cpu_mips_gen_code | 483 | #define cpu_gen_code cpu_mips_gen_code |
| 484 | #define cpu_signal_handler cpu_mips_signal_handler | 484 | #define cpu_signal_handler cpu_mips_signal_handler |
| 485 | +#define cpu_list mips_cpu_list | ||
| 485 | 486 | ||
| 486 | #include "cpu-all.h" | 487 | #include "cpu-all.h" |
| 487 | 488 |
target-ppc/cpu.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); | ||
| 697 | #define cpu_exec cpu_ppc_exec | 697 | #define cpu_exec cpu_ppc_exec |
| 698 | #define cpu_gen_code cpu_ppc_gen_code | 698 | #define cpu_gen_code cpu_ppc_gen_code |
| 699 | #define cpu_signal_handler cpu_ppc_signal_handler | 699 | #define cpu_signal_handler cpu_ppc_signal_handler |
| 700 | +#define cpu_list ppc_cpu_list | ||
| 700 | 701 | ||
| 701 | #include "cpu-all.h" | 702 | #include "cpu-all.h" |
| 702 | 703 |
target-sparc/cpu.h
| @@ -315,6 +315,7 @@ void cpu_check_irqs(CPUSPARCState *env); | @@ -315,6 +315,7 @@ void cpu_check_irqs(CPUSPARCState *env); | ||
| 315 | #define cpu_exec cpu_sparc_exec | 315 | #define cpu_exec cpu_sparc_exec |
| 316 | #define cpu_gen_code cpu_sparc_gen_code | 316 | #define cpu_gen_code cpu_sparc_gen_code |
| 317 | #define cpu_signal_handler cpu_sparc_signal_handler | 317 | #define cpu_signal_handler cpu_sparc_signal_handler |
| 318 | +#define cpu_list sparc_cpu_list | ||
| 318 | 319 | ||
| 319 | #include "cpu-all.h" | 320 | #include "cpu-all.h" |
| 320 | 321 |
vl.c
| @@ -7690,14 +7690,9 @@ int main(int argc, char **argv) | @@ -7690,14 +7690,9 @@ int main(int argc, char **argv) | ||
| 7690 | case QEMU_OPTION_cpu: | 7690 | case QEMU_OPTION_cpu: |
| 7691 | /* hw initialization will check this */ | 7691 | /* hw initialization will check this */ |
| 7692 | if (*optarg == '?') { | 7692 | if (*optarg == '?') { |
| 7693 | -#if defined(TARGET_PPC) | ||
| 7694 | - ppc_cpu_list(stdout, &fprintf); | ||
| 7695 | -#elif defined(TARGET_ARM) | ||
| 7696 | - arm_cpu_list(); | ||
| 7697 | -#elif defined(TARGET_MIPS) | ||
| 7698 | - mips_cpu_list(stdout, &fprintf); | ||
| 7699 | -#elif defined(TARGET_SPARC) | ||
| 7700 | - sparc_cpu_list(stdout, &fprintf); | 7693 | +/* XXX: implement xxx_cpu_list for targets that still miss it */ |
| 7694 | +#if defined(cpu_list) | ||
| 7695 | + cpu_list(stdout, &fprintf); | ||
| 7701 | #endif | 7696 | #endif |
| 7702 | exit(0); | 7697 | exit(0); |
| 7703 | } else { | 7698 | } else { |
vl.h
| @@ -741,14 +741,6 @@ int qemu_register_machine(QEMUMachine *m); | @@ -741,14 +741,6 @@ int qemu_register_machine(QEMUMachine *m); | ||
| 741 | 741 | ||
| 742 | typedef void SetIRQFunc(void *opaque, int irq_num, int level); | 742 | typedef void SetIRQFunc(void *opaque, int irq_num, int level); |
| 743 | 743 | ||
| 744 | -#if defined(TARGET_PPC) | ||
| 745 | -void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...)); | ||
| 746 | -#endif | ||
| 747 | - | ||
| 748 | -#if defined(TARGET_MIPS) | ||
| 749 | -void mips_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...)); | ||
| 750 | -#endif | ||
| 751 | - | ||
| 752 | #include "hw/irq.h" | 744 | #include "hw/irq.h" |
| 753 | 745 | ||
| 754 | /* ISA bus */ | 746 | /* ISA bus */ |