mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
target-sh4: Introduce SuperHCPU subclasses
Store legacy name in SuperHCPUClass for -cpu ? and for case-insensitive class lookup. List CPUs by iterating over TYPE_SUPERH_CPU subclasses. Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
151d1322a3
commit
c1b382e77d
3 changed files with 186 additions and 85 deletions
|
@ -175,90 +175,6 @@ void cpu_dump_state(CPUSH4State * env, FILE * f,
|
|||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int id;
|
||||
uint32_t pvr;
|
||||
uint32_t prr;
|
||||
uint32_t cvr;
|
||||
uint32_t features;
|
||||
} sh4_def_t;
|
||||
|
||||
static sh4_def_t sh4_defs[] = {
|
||||
{
|
||||
.name = "SH7750R",
|
||||
.id = SH_CPU_SH7750R,
|
||||
.pvr = 0x00050000,
|
||||
.prr = 0x00000100,
|
||||
.cvr = 0x00110000,
|
||||
.features = SH_FEATURE_BCR3_AND_BCR4,
|
||||
}, {
|
||||
.name = "SH7751R",
|
||||
.id = SH_CPU_SH7751R,
|
||||
.pvr = 0x04050005,
|
||||
.prr = 0x00000113,
|
||||
.cvr = 0x00110000, /* Neutered caches, should be 0x20480000 */
|
||||
.features = SH_FEATURE_BCR3_AND_BCR4,
|
||||
}, {
|
||||
.name = "SH7785",
|
||||
.id = SH_CPU_SH7785,
|
||||
.pvr = 0x10300700,
|
||||
.prr = 0x00000200,
|
||||
.cvr = 0x71440211,
|
||||
.features = SH_FEATURE_SH4A,
|
||||
},
|
||||
};
|
||||
|
||||
static const sh4_def_t *cpu_sh4_find_by_name(const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (strcasecmp(name, "any") == 0)
|
||||
return &sh4_defs[0];
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(sh4_defs); i++)
|
||||
if (strcasecmp(name, sh4_defs[i].name) == 0)
|
||||
return &sh4_defs[i];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void sh4_cpu_list(FILE *f, fprintf_function cpu_fprintf)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(sh4_defs); i++)
|
||||
(*cpu_fprintf)(f, "%s\n", sh4_defs[i].name);
|
||||
}
|
||||
|
||||
static void cpu_register(CPUSH4State *env, const sh4_def_t *def)
|
||||
{
|
||||
env->pvr = def->pvr;
|
||||
env->prr = def->prr;
|
||||
env->cvr = def->cvr;
|
||||
env->id = def->id;
|
||||
}
|
||||
|
||||
SuperHCPU *cpu_sh4_init(const char *cpu_model)
|
||||
{
|
||||
SuperHCPU *cpu;
|
||||
CPUSH4State *env;
|
||||
const sh4_def_t *def;
|
||||
|
||||
def = cpu_sh4_find_by_name(cpu_model);
|
||||
if (!def)
|
||||
return NULL;
|
||||
cpu = SUPERH_CPU(object_new(TYPE_SUPERH_CPU));
|
||||
env = &cpu->env;
|
||||
env->features = def->features;
|
||||
env->cpu_model_str = cpu_model;
|
||||
cpu_register(env, def);
|
||||
|
||||
object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
|
||||
|
||||
return cpu;
|
||||
}
|
||||
|
||||
static void gen_goto_tb(DisasContext * ctx, int n, target_ulong dest)
|
||||
{
|
||||
TranslationBlock *tb;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue