mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
added cpu_model parameter to cpu_init()
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3562 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
7d77bf2006
commit
aaed909a49
46 changed files with 320 additions and 324 deletions
|
@ -165,8 +165,6 @@
|
|||
/* 2 <= NWINDOWS <= 32. In QEMU it must also be a power of two. */
|
||||
#define NWINDOWS 8
|
||||
|
||||
typedef struct sparc_def_t sparc_def_t;
|
||||
|
||||
#if !defined(TARGET_SPARC64)
|
||||
#define NB_MMU_MODES 2
|
||||
#else
|
||||
|
@ -270,14 +268,12 @@ typedef struct CPUSPARCState {
|
|||
} while (0)
|
||||
#endif
|
||||
|
||||
CPUSPARCState *cpu_sparc_init(void);
|
||||
CPUSPARCState *cpu_sparc_init(const char *cpu_model);
|
||||
int cpu_sparc_exec(CPUSPARCState *s);
|
||||
int cpu_sparc_close(CPUSPARCState *s);
|
||||
int sparc_find_by_name (const unsigned char *name, const sparc_def_t **def);
|
||||
void sparc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt,
|
||||
...));
|
||||
int cpu_sparc_register (CPUSPARCState *env, const sparc_def_t *def,
|
||||
unsigned int cpu);
|
||||
void cpu_sparc_set_id(CPUSPARCState *env, unsigned int cpu);
|
||||
|
||||
#define GET_PSR(env) (env->version | (env->psr & PSR_ICC) | \
|
||||
(env->psref? PSR_EF : 0) | \
|
||||
|
|
|
@ -54,6 +54,8 @@ typedef struct DisasContext {
|
|||
struct TranslationBlock *tb;
|
||||
} DisasContext;
|
||||
|
||||
typedef struct sparc_def_t sparc_def_t;
|
||||
|
||||
struct sparc_def_t {
|
||||
const unsigned char *name;
|
||||
target_ulong iu_version;
|
||||
|
@ -62,6 +64,8 @@ struct sparc_def_t {
|
|||
uint32_t mmu_bm;
|
||||
};
|
||||
|
||||
static const sparc_def_t *cpu_sparc_find_by_name(const unsigned char *name);
|
||||
|
||||
static uint16_t *gen_opc_ptr;
|
||||
static uint32_t *gen_opparam_ptr;
|
||||
extern FILE *logfile;
|
||||
|
@ -3489,15 +3493,36 @@ void cpu_reset(CPUSPARCState *env)
|
|||
#endif
|
||||
}
|
||||
|
||||
CPUSPARCState *cpu_sparc_init(void)
|
||||
CPUSPARCState *cpu_sparc_init(const char *cpu_model)
|
||||
{
|
||||
CPUSPARCState *env;
|
||||
const sparc_def_t *def;
|
||||
|
||||
def = cpu_sparc_find_by_name(cpu_model);
|
||||
if (!def)
|
||||
return NULL;
|
||||
|
||||
env = qemu_mallocz(sizeof(CPUSPARCState));
|
||||
if (!env)
|
||||
return NULL;
|
||||
cpu_exec_init(env);
|
||||
return (env);
|
||||
env->version = def->iu_version;
|
||||
env->fsr = def->fpu_version;
|
||||
#if !defined(TARGET_SPARC64)
|
||||
env->mmu_bm = def->mmu_bm;
|
||||
env->mmuregs[0] |= def->mmu_version;
|
||||
cpu_sparc_set_id(env, 0);
|
||||
#endif
|
||||
cpu_reset(env);
|
||||
|
||||
return env;
|
||||
}
|
||||
|
||||
void cpu_sparc_set_id(CPUSPARCState *env, unsigned int cpu)
|
||||
{
|
||||
#if !defined(TARGET_SPARC64)
|
||||
env->mxccregs[7] = ((cpu + 8) & 0xf) << 24;
|
||||
#endif
|
||||
}
|
||||
|
||||
static const sparc_def_t sparc_defs[] = {
|
||||
|
@ -3744,22 +3769,16 @@ static const sparc_def_t sparc_defs[] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
int sparc_find_by_name(const unsigned char *name, const sparc_def_t **def)
|
||||
static const sparc_def_t *cpu_sparc_find_by_name(const unsigned char *name)
|
||||
{
|
||||
int ret;
|
||||
unsigned int i;
|
||||
|
||||
ret = -1;
|
||||
*def = NULL;
|
||||
for (i = 0; i < sizeof(sparc_defs) / sizeof(sparc_def_t); i++) {
|
||||
if (strcasecmp(name, sparc_defs[i].name) == 0) {
|
||||
*def = &sparc_defs[i];
|
||||
ret = 0;
|
||||
break;
|
||||
return &sparc_defs[i];
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void sparc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
|
||||
|
@ -3775,19 +3794,6 @@ void sparc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
|
|||
}
|
||||
}
|
||||
|
||||
int cpu_sparc_register (CPUSPARCState *env, const sparc_def_t *def, unsigned int cpu)
|
||||
{
|
||||
env->version = def->iu_version;
|
||||
env->fsr = def->fpu_version;
|
||||
#if !defined(TARGET_SPARC64)
|
||||
env->mmu_bm = def->mmu_bm;
|
||||
env->mmuregs[0] |= def->mmu_version;
|
||||
env->mxccregs[7] = ((cpu + 8) & 0xf) << 24;
|
||||
#endif
|
||||
cpu_reset(env);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define GET_FLAG(a,b) ((env->psr & a)?b:'-')
|
||||
|
||||
void cpu_dump_state(CPUState *env, FILE *f,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue