diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-11-10 15:15:54 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-11-10 15:15:54 +0000 |
commit | aaed909a495e78364abc6812df672d2e764961a8 (patch) | |
tree | 704ab4280f250fa310bee6a3d0ba94e5417daef3 /target-arm | |
parent | 7d77bf200682ed8cbd0c94bdfbac64dc4b23b149 (diff) |
added cpu_model parameter to cpu_init()
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3562 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-arm')
-rw-r--r-- | target-arm/cpu.h | 3 | ||||
-rw-r--r-- | target-arm/helper.c | 19 |
2 files changed, 12 insertions, 10 deletions
diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 5ffca1145b..fb22b908d7 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -164,7 +164,7 @@ typedef struct CPUARMState { target_phys_addr_t loader_start; } CPUARMState; -CPUARMState *cpu_arm_init(void); +CPUARMState *cpu_arm_init(const char *cpu_model); int cpu_arm_exec(CPUARMState *s); void cpu_arm_close(CPUARMState *s); void do_interrupt(CPUARMState *); @@ -263,7 +263,6 @@ static inline int arm_feature(CPUARMState *env, int feature) } 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_cp_io(CPUARMState *env, int cpnum, ARMReadCPFunc *cp_read, ARMWriteCPFunc *cp_write, diff --git a/target-arm/helper.c b/target-arm/helper.c index d06ee69e7a..06eac66a15 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -5,6 +5,8 @@ #include "cpu.h" #include "exec-all.h" +static uint32_t cpu_arm_find_by_name(const char *name); + static inline void set_feature(CPUARMState *env, int feature) { env->features |= 1u << feature; @@ -89,14 +91,19 @@ void cpu_reset(CPUARMState *env) tlb_flush(env, 1); } -CPUARMState *cpu_arm_init(void) +CPUARMState *cpu_arm_init(const char *cpu_model) { CPUARMState *env; + uint32_t id; + id = cpu_arm_find_by_name(cpu_model); + if (id == 0) + return NULL; env = qemu_mallocz(sizeof(CPUARMState)); if (!env) return NULL; cpu_exec_init(env); + env->cp15.c0_cpuid = id; cpu_reset(env); return env; } @@ -136,24 +143,20 @@ void arm_cpu_list(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...)) } } -void cpu_arm_set_model(CPUARMState *env, const char *name) +/* return 0 if not found */ +static uint32_t cpu_arm_find_by_name(const char *name) { int i; uint32_t id; id = 0; - i = 0; for (i = 0; arm_cpu_names[i].name; i++) { if (strcmp(name, arm_cpu_names[i].name) == 0) { id = arm_cpu_names[i].id; break; } } - if (!id) { - cpu_abort(env, "Unknown CPU '%s'", name); - return; - } - cpu_reset_model_id(env, id); + return id; } void cpu_arm_close(CPUARMState *env) |