mirror of https://github.com/xqemu/xqemu.git
Implement --cpu for ARM.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2474 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
76a66253e5
commit
3371d27293
|
@ -471,7 +471,7 @@ static void icp_control_init(uint32_t base)
|
||||||
static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device,
|
static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device,
|
||||||
DisplayState *ds, const char **fd_filename, int snapshot,
|
DisplayState *ds, const char **fd_filename, int snapshot,
|
||||||
const char *kernel_filename, const char *kernel_cmdline,
|
const char *kernel_filename, const char *kernel_cmdline,
|
||||||
const char *initrd_filename, uint32_t cpuid)
|
const char *initrd_filename, const char *cpu_model)
|
||||||
{
|
{
|
||||||
CPUState *env;
|
CPUState *env;
|
||||||
uint32_t bios_offset;
|
uint32_t bios_offset;
|
||||||
|
@ -479,7 +479,9 @@ static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device,
|
||||||
void *cpu_pic;
|
void *cpu_pic;
|
||||||
|
|
||||||
env = cpu_init();
|
env = cpu_init();
|
||||||
cpu_arm_set_model(env, cpuid);
|
if (!cpu_model)
|
||||||
|
cpu_model = "arm926";
|
||||||
|
cpu_arm_set_model(env, cpu_model);
|
||||||
bios_offset = ram_size + vga_ram_size;
|
bios_offset = ram_size + vga_ram_size;
|
||||||
/* ??? On a real system the first 1Mb is mapped as SSRAM or boot flash. */
|
/* ??? On a real system the first 1Mb is mapped as SSRAM or boot flash. */
|
||||||
/* ??? RAM shoud repeat to fill physical memory space. */
|
/* ??? RAM shoud repeat to fill physical memory space. */
|
||||||
|
@ -513,34 +515,8 @@ static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device,
|
||||||
initrd_filename, 0x113);
|
initrd_filename, 0x113);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void integratorcp926_init(int ram_size, int vga_ram_size,
|
QEMUMachine integratorcp_machine = {
|
||||||
int boot_device, DisplayState *ds, const char **fd_filename, int snapshot,
|
"integratorcp",
|
||||||
const char *kernel_filename, const char *kernel_cmdline,
|
|
||||||
const char *initrd_filename, const char *cpu_model)
|
|
||||||
{
|
|
||||||
integratorcp_init(ram_size, vga_ram_size, boot_device, ds, fd_filename,
|
|
||||||
snapshot, kernel_filename, kernel_cmdline,
|
|
||||||
initrd_filename, ARM_CPUID_ARM926);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void integratorcp1026_init(int ram_size, int vga_ram_size,
|
|
||||||
int boot_device, DisplayState *ds, const char **fd_filename, int snapshot,
|
|
||||||
const char *kernel_filename, const char *kernel_cmdline,
|
|
||||||
const char *initrd_filename, const char *cpu_model)
|
|
||||||
{
|
|
||||||
integratorcp_init(ram_size, vga_ram_size, boot_device, ds, fd_filename,
|
|
||||||
snapshot, kernel_filename, kernel_cmdline,
|
|
||||||
initrd_filename, ARM_CPUID_ARM1026);
|
|
||||||
}
|
|
||||||
|
|
||||||
QEMUMachine integratorcp926_machine = {
|
|
||||||
"integratorcp926",
|
|
||||||
"ARM Integrator/CP (ARM926EJ-S)",
|
"ARM Integrator/CP (ARM926EJ-S)",
|
||||||
integratorcp926_init,
|
integratorcp_init,
|
||||||
};
|
|
||||||
|
|
||||||
QEMUMachine integratorcp1026_machine = {
|
|
||||||
"integratorcp1026",
|
|
||||||
"ARM Integrator/CP (ARM1026EJ-S)",
|
|
||||||
integratorcp1026_init,
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,8 +26,9 @@ static void realview_init(int ram_size, int vga_ram_size, int boot_device,
|
||||||
int done_smc = 0;
|
int done_smc = 0;
|
||||||
|
|
||||||
env = cpu_init();
|
env = cpu_init();
|
||||||
cpu_arm_set_model(env, ARM_CPUID_ARM926);
|
if (!cpu_model)
|
||||||
//cpu_arm_set_model(env, ARM_CPUID_ARM11MPCORE);
|
cpu_model = "arm926";
|
||||||
|
cpu_arm_set_model(env, cpu_model);
|
||||||
/* ??? RAM shoud repeat to fill physical memory space. */
|
/* ??? RAM shoud repeat to fill physical memory space. */
|
||||||
/* SDRAM at address zero. */
|
/* SDRAM at address zero. */
|
||||||
cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
|
cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
|
||||||
|
|
|
@ -154,7 +154,8 @@ static vpb_sic_state *vpb_sic_init(uint32_t base, void *parent, int irq)
|
||||||
static void versatile_init(int ram_size, int vga_ram_size, int boot_device,
|
static void versatile_init(int ram_size, int vga_ram_size, int boot_device,
|
||||||
DisplayState *ds, const char **fd_filename, int snapshot,
|
DisplayState *ds, const char **fd_filename, int snapshot,
|
||||||
const char *kernel_filename, const char *kernel_cmdline,
|
const char *kernel_filename, const char *kernel_cmdline,
|
||||||
const char *initrd_filename, int board_id)
|
const char *initrd_filename, const char *cpu_model,
|
||||||
|
int board_id)
|
||||||
{
|
{
|
||||||
CPUState *env;
|
CPUState *env;
|
||||||
void *pic;
|
void *pic;
|
||||||
|
@ -166,7 +167,9 @@ static void versatile_init(int ram_size, int vga_ram_size, int boot_device,
|
||||||
int done_smc = 0;
|
int done_smc = 0;
|
||||||
|
|
||||||
env = cpu_init();
|
env = cpu_init();
|
||||||
cpu_arm_set_model(env, ARM_CPUID_ARM926);
|
if (!cpu_model)
|
||||||
|
cpu_model = "arm926";
|
||||||
|
cpu_arm_set_model(env, cpu_model);
|
||||||
/* ??? RAM shoud repeat to fill physical memory space. */
|
/* ??? RAM shoud repeat to fill physical memory space. */
|
||||||
/* SDRAM at address zero. */
|
/* SDRAM at address zero. */
|
||||||
cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
|
cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
|
||||||
|
@ -262,7 +265,7 @@ static void vpb_init(int ram_size, int vga_ram_size, int boot_device,
|
||||||
versatile_init(ram_size, vga_ram_size, boot_device,
|
versatile_init(ram_size, vga_ram_size, boot_device,
|
||||||
ds, fd_filename, snapshot,
|
ds, fd_filename, snapshot,
|
||||||
kernel_filename, kernel_cmdline,
|
kernel_filename, kernel_cmdline,
|
||||||
initrd_filename, 0x183);
|
initrd_filename, cpu_model, 0x183);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vab_init(int ram_size, int vga_ram_size, int boot_device,
|
static void vab_init(int ram_size, int vga_ram_size, int boot_device,
|
||||||
|
@ -273,7 +276,7 @@ static void vab_init(int ram_size, int vga_ram_size, int boot_device,
|
||||||
versatile_init(ram_size, vga_ram_size, boot_device,
|
versatile_init(ram_size, vga_ram_size, boot_device,
|
||||||
ds, fd_filename, snapshot,
|
ds, fd_filename, snapshot,
|
||||||
kernel_filename, kernel_cmdline,
|
kernel_filename, kernel_cmdline,
|
||||||
initrd_filename, 0x25e);
|
initrd_filename, cpu_model, 0x25e);
|
||||||
}
|
}
|
||||||
|
|
||||||
QEMUMachine versatilepb_machine = {
|
QEMUMachine versatilepb_machine = {
|
||||||
|
|
|
@ -1756,7 +1756,7 @@ int main(int argc, char **argv)
|
||||||
#elif defined(TARGET_ARM)
|
#elif defined(TARGET_ARM)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
cpu_arm_set_model(env, ARM_CPUID_ARM1026);
|
cpu_arm_set_model(env, "arm926");
|
||||||
cpsr_write(env, regs->uregs[16], 0xffffffff);
|
cpsr_write(env, regs->uregs[16], 0xffffffff);
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 16; i++) {
|
||||||
env->regs[i] = regs->uregs[i];
|
env->regs[i] = regs->uregs[i];
|
||||||
|
|
|
@ -209,7 +209,7 @@ static inline int arm_feature(CPUARMState *env, int feature)
|
||||||
return (env->features & (1u << feature)) != 0;
|
return (env->features & (1u << feature)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cpu_arm_set_model(CPUARMState *env, uint32_t id);
|
void cpu_arm_set_model(CPUARMState *env, const char *name);
|
||||||
|
|
||||||
#define ARM_CPUID_ARM1026 0x4106a262
|
#define ARM_CPUID_ARM1026 0x4106a262
|
||||||
#define ARM_CPUID_ARM926 0x41069265
|
#define ARM_CPUID_ARM926 0x41069265
|
||||||
|
|
|
@ -36,8 +36,35 @@ static inline void set_feature(CPUARMState *env, int feature)
|
||||||
env->features |= 1u << feature;
|
env->features |= 1u << feature;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cpu_arm_set_model(CPUARMState *env, uint32_t id)
|
struct arm_cpu_t {
|
||||||
|
uint32_t id;
|
||||||
|
const char *name;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct arm_cpu_t arm_cpu_names[] = {
|
||||||
|
{ ARM_CPUID_ARM926, "arm926"},
|
||||||
|
{ ARM_CPUID_ARM1026, "arm1026"},
|
||||||
|
{ 0, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
void cpu_arm_set_model(CPUARMState *env, 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;
|
||||||
|
}
|
||||||
|
|
||||||
env->cp15.c0_cpuid = id;
|
env->cp15.c0_cpuid = id;
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case ARM_CPUID_ARM926:
|
case ARM_CPUID_ARM926:
|
||||||
|
|
3
vl.c
3
vl.c
|
@ -6710,8 +6710,7 @@ void register_machines(void)
|
||||||
qemu_register_machine(&sun4m_machine);
|
qemu_register_machine(&sun4m_machine);
|
||||||
#endif
|
#endif
|
||||||
#elif defined(TARGET_ARM)
|
#elif defined(TARGET_ARM)
|
||||||
qemu_register_machine(&integratorcp926_machine);
|
qemu_register_machine(&integratorcp_machine);
|
||||||
qemu_register_machine(&integratorcp1026_machine);
|
|
||||||
qemu_register_machine(&versatilepb_machine);
|
qemu_register_machine(&versatilepb_machine);
|
||||||
qemu_register_machine(&versatileab_machine);
|
qemu_register_machine(&versatileab_machine);
|
||||||
qemu_register_machine(&realview_machine);
|
qemu_register_machine(&realview_machine);
|
||||||
|
|
3
vl.h
3
vl.h
|
@ -1304,8 +1304,7 @@ void lsi_scsi_attach(void *opaque, BlockDriverState *bd, int id);
|
||||||
void *lsi_scsi_init(PCIBus *bus, int devfn);
|
void *lsi_scsi_init(PCIBus *bus, int devfn);
|
||||||
|
|
||||||
/* integratorcp.c */
|
/* integratorcp.c */
|
||||||
extern QEMUMachine integratorcp926_machine;
|
extern QEMUMachine integratorcp_machine;
|
||||||
extern QEMUMachine integratorcp1026_machine;
|
|
||||||
|
|
||||||
/* versatilepb.c */
|
/* versatilepb.c */
|
||||||
extern QEMUMachine versatilepb_machine;
|
extern QEMUMachine versatilepb_machine;
|
||||||
|
|
Loading…
Reference in New Issue