mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07: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:
+10
-1
@@ -785,6 +785,7 @@ int main(int argc, char **argv)
|
||||
int optind;
|
||||
short use_gdbstub = 0;
|
||||
const char *r;
|
||||
const char *cpu_model;
|
||||
|
||||
if (argc <= 1)
|
||||
usage();
|
||||
@@ -855,7 +856,15 @@ int main(int argc, char **argv)
|
||||
|
||||
/* NOTE: we need to init the CPU at this stage to get
|
||||
qemu_host_page_size */
|
||||
env = cpu_init();
|
||||
#if defined(TARGET_I386)
|
||||
cpu_model = "qemu32";
|
||||
#elif defined(TARGET_PPC)
|
||||
cpu_model = "750";
|
||||
#else
|
||||
#error unsupported CPU
|
||||
#endif
|
||||
|
||||
env = cpu_init(cpu_model);
|
||||
|
||||
printf("Starting %s with qemu\n----------------\n", filename);
|
||||
|
||||
|
||||
@@ -1314,6 +1314,8 @@ void cpu_abort(CPUState *env, const char *fmt, ...)
|
||||
|
||||
CPUState *cpu_copy(CPUState *env)
|
||||
{
|
||||
#if 0
|
||||
/* XXX: broken, must be handled by each CPU */
|
||||
CPUState *new_env = cpu_init();
|
||||
/* preserve chaining and index */
|
||||
CPUState *next_cpu = new_env->next_cpu;
|
||||
@@ -1322,6 +1324,9 @@ CPUState *cpu_copy(CPUState *env)
|
||||
new_env->next_cpu = next_cpu;
|
||||
new_env->cpu_index = cpu_index;
|
||||
return new_env;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
|
||||
+2
-2
@@ -37,10 +37,10 @@ static void an5206_init(int ram_size, int vga_ram_size, const char *boot_device,
|
||||
uint64_t elf_entry;
|
||||
target_ulong entry;
|
||||
|
||||
env = cpu_init();
|
||||
if (!cpu_model)
|
||||
cpu_model = "m5206";
|
||||
if (cpu_m68k_set_model(env, cpu_model)) {
|
||||
env = cpu_init(cpu_model);
|
||||
if (!env) {
|
||||
cpu_abort(env, "Unable to find m68k CPU definition\n");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ void bareetraxfs_init (int ram_size, int vga_ram_size, const char *boot_device,
|
||||
if (cpu_model == NULL) {
|
||||
cpu_model = "crisv32";
|
||||
}
|
||||
env = cpu_init();
|
||||
env = cpu_init(cpu_model);
|
||||
/* register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); */
|
||||
qemu_register_reset(main_cpu_reset, env);
|
||||
irqs = qemu_allocate_irqs(dummy_cpu_set_irq, env, 32);
|
||||
|
||||
+5
-2
@@ -473,10 +473,13 @@ static void integratorcp_init(int ram_size, int vga_ram_size,
|
||||
qemu_irq *pic;
|
||||
qemu_irq *cpu_pic;
|
||||
|
||||
env = cpu_init();
|
||||
if (!cpu_model)
|
||||
cpu_model = "arm926";
|
||||
cpu_arm_set_model(env, cpu_model);
|
||||
env = cpu_init(cpu_model);
|
||||
if (!env) {
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
bios_offset = ram_size + vga_ram_size;
|
||||
/* ??? On a real system the first 1Mb is mapped as SSRAM or boot flash. */
|
||||
/* ??? RAM shoud repeat to fill physical memory space. */
|
||||
|
||||
+4
-3
@@ -209,11 +209,12 @@ static void mcf5208evb_init(int ram_size, int vga_ram_size,
|
||||
target_ulong entry;
|
||||
qemu_irq *pic;
|
||||
|
||||
env = cpu_init();
|
||||
if (!cpu_model)
|
||||
cpu_model = "m5208";
|
||||
if (cpu_m68k_set_model(env, cpu_model)) {
|
||||
cpu_abort(env, "Unable to find m68k CPU definition\n");
|
||||
env = cpu_init(cpu_model);
|
||||
if (!env) {
|
||||
fprintf(stderr, "Unable to find m68k CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Initialize CPU registers. */
|
||||
|
||||
+5
-6
@@ -735,7 +735,6 @@ static void main_cpu_reset(void *opaque)
|
||||
{
|
||||
CPUState *env = opaque;
|
||||
cpu_reset(env);
|
||||
cpu_mips_register(env, NULL);
|
||||
|
||||
/* The bootload does not need to be rewritten as it is located in a
|
||||
read only location. The kernel location and the arguments table
|
||||
@@ -761,7 +760,6 @@ void mips_malta_init (int ram_size, int vga_ram_size, const char *boot_device,
|
||||
/* fdctrl_t *floppy_controller; */
|
||||
MaltaFPGAState *malta_fpga;
|
||||
int ret;
|
||||
mips_def_t *def;
|
||||
qemu_irq *i8259;
|
||||
int piix4_devfn;
|
||||
uint8_t *eeprom_buf;
|
||||
@@ -776,10 +774,11 @@ void mips_malta_init (int ram_size, int vga_ram_size, const char *boot_device,
|
||||
cpu_model = "24Kf";
|
||||
#endif
|
||||
}
|
||||
if (mips_find_by_name(cpu_model, &def) != 0)
|
||||
def = NULL;
|
||||
env = cpu_init();
|
||||
cpu_mips_register(env, def);
|
||||
env = cpu_init(cpu_model);
|
||||
if (!env) {
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
register_savevm("cpu", 0, 3, cpu_save, cpu_load, env);
|
||||
qemu_register_reset(main_cpu_reset, env);
|
||||
|
||||
|
||||
+5
-5
@@ -94,7 +94,6 @@ static void main_cpu_reset(void *opaque)
|
||||
{
|
||||
CPUState *env = opaque;
|
||||
cpu_reset(env);
|
||||
cpu_mips_register(env, NULL);
|
||||
|
||||
if (loaderparams.kernel_filename)
|
||||
load_kernel (env);
|
||||
@@ -120,10 +119,11 @@ mips_mipssim_init (int ram_size, int vga_ram_size, const char *boot_device,
|
||||
cpu_model = "24Kf";
|
||||
#endif
|
||||
}
|
||||
if (mips_find_by_name(cpu_model, &def) != 0)
|
||||
def = NULL;
|
||||
env = cpu_init();
|
||||
cpu_mips_register(env, def);
|
||||
env = cpu_init(cpu_model);
|
||||
if (!env) {
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
register_savevm("cpu", 0, 3, cpu_save, cpu_load, env);
|
||||
qemu_register_reset(main_cpu_reset, env);
|
||||
|
||||
|
||||
+5
-5
@@ -51,7 +51,6 @@ static void main_cpu_reset(void *opaque)
|
||||
{
|
||||
CPUState *env = opaque;
|
||||
cpu_reset(env);
|
||||
cpu_mips_register(env, NULL);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -78,10 +77,11 @@ void mips_pica61_init (int ram_size, int vga_ram_size, const char *boot_device,
|
||||
cpu_model = "24Kf";
|
||||
#endif
|
||||
}
|
||||
if (mips_find_by_name(cpu_model, &def) != 0)
|
||||
def = NULL;
|
||||
env = cpu_init();
|
||||
cpu_mips_register(env, def);
|
||||
env = cpu_init(cpu_model);
|
||||
if (!env) {
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
register_savevm("cpu", 0, 3, cpu_save, cpu_load, env);
|
||||
qemu_register_reset(main_cpu_reset, env);
|
||||
|
||||
|
||||
+5
-5
@@ -135,7 +135,6 @@ static void main_cpu_reset(void *opaque)
|
||||
{
|
||||
CPUState *env = opaque;
|
||||
cpu_reset(env);
|
||||
cpu_mips_register(env, NULL);
|
||||
|
||||
if (loaderparams.kernel_filename)
|
||||
load_kernel (env);
|
||||
@@ -164,10 +163,11 @@ void mips_r4k_init (int ram_size, int vga_ram_size, const char *boot_device,
|
||||
cpu_model = "24Kf";
|
||||
#endif
|
||||
}
|
||||
if (mips_find_by_name(cpu_model, &def) != 0)
|
||||
def = NULL;
|
||||
env = cpu_init();
|
||||
cpu_mips_register(env, def);
|
||||
env = cpu_init(cpu_model);
|
||||
if (!env) {
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
register_savevm("cpu", 0, 3, cpu_save, cpu_load, env);
|
||||
qemu_register_reset(main_cpu_reset, env);
|
||||
|
||||
|
||||
@@ -4620,15 +4620,20 @@ struct omap_mpu_state_s *omap310_mpu_init(unsigned long sdram_size,
|
||||
struct omap_mpu_state_s *s = (struct omap_mpu_state_s *)
|
||||
qemu_mallocz(sizeof(struct omap_mpu_state_s));
|
||||
ram_addr_t imif_base, emiff_base;
|
||||
|
||||
if (!core)
|
||||
core = "ti925t";
|
||||
|
||||
/* Core */
|
||||
s->mpu_model = omap310;
|
||||
s->env = cpu_init();
|
||||
s->env = cpu_init(core);
|
||||
if (!s->env) {
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
s->sdram_size = sdram_size;
|
||||
s->sram_size = OMAP15XX_SRAM_SIZE;
|
||||
|
||||
cpu_arm_set_model(s->env, core ?: "ti925t");
|
||||
|
||||
s->wakeup = qemu_allocate_irqs(omap_mpu_wakeup, s, 1)[0];
|
||||
|
||||
/* Clocks */
|
||||
|
||||
@@ -700,12 +700,12 @@ static void pc_init1(int ram_size, int vga_ram_size, const char *boot_device,
|
||||
#endif
|
||||
}
|
||||
|
||||
if (x86_find_cpu_by_name(cpu_model)) {
|
||||
fprintf(stderr, "Unable to find x86 CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
for(i = 0; i < smp_cpus; i++) {
|
||||
env = cpu_init();
|
||||
env = cpu_init(cpu_model);
|
||||
if (!env) {
|
||||
fprintf(stderr, "Unable to find x86 CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
if (i != 0)
|
||||
env->hflags |= HF_HALTED_MASK;
|
||||
if (smp_cpus > 1) {
|
||||
|
||||
+5
-8
@@ -37,17 +37,14 @@ CPUState *ppc4xx_init (const unsigned char *cpu_model,
|
||||
uint32_t sysclk)
|
||||
{
|
||||
CPUState *env;
|
||||
ppc_def_t *def;
|
||||
|
||||
/* init CPUs */
|
||||
env = cpu_init();
|
||||
ppc_find_by_name(cpu_model, &def);
|
||||
if (def == NULL) {
|
||||
cpu_abort(env, "Unable to find PowerPC %s CPU definition\n",
|
||||
cpu_model);
|
||||
env = cpu_init(cpu_model);
|
||||
if (!env) {
|
||||
fprintf(stderr, "Unable to find PowerPC %s CPU definition\n",
|
||||
cpu_model);
|
||||
exit(1);
|
||||
}
|
||||
cpu_ppc_register(env, def);
|
||||
cpu_ppc_reset(env);
|
||||
cpu_clk->cb = NULL; /* We don't care about CPU clock frequency changes */
|
||||
cpu_clk->opaque = env;
|
||||
/* Set time-base frequency to sysclk */
|
||||
|
||||
+6
-9
@@ -56,14 +56,13 @@ static void ppc_core99_init (int ram_size, int vga_ram_size,
|
||||
const char *initrd_filename,
|
||||
const char *cpu_model)
|
||||
{
|
||||
CPUState *env, *envs[MAX_CPUS];
|
||||
CPUState *env = NULL, *envs[MAX_CPUS];
|
||||
char buf[1024];
|
||||
qemu_irq *pic, **openpic_irqs;
|
||||
int unin_memory;
|
||||
int linux_boot, i;
|
||||
unsigned long bios_offset, vga_bios_offset;
|
||||
uint32_t kernel_base, kernel_size, initrd_base, initrd_size;
|
||||
ppc_def_t *def;
|
||||
PCIBus *pci_bus;
|
||||
nvram_t nvram;
|
||||
#if 0
|
||||
@@ -80,16 +79,14 @@ static void ppc_core99_init (int ram_size, int vga_ram_size,
|
||||
linux_boot = (kernel_filename != NULL);
|
||||
|
||||
/* init CPUs */
|
||||
env = cpu_init();
|
||||
if (cpu_model == NULL)
|
||||
cpu_model = "default";
|
||||
ppc_find_by_name(cpu_model, &def);
|
||||
if (def == NULL) {
|
||||
cpu_abort(env, "Unable to find PowerPC CPU definition\n");
|
||||
}
|
||||
for (i = 0; i < smp_cpus; i++) {
|
||||
cpu_ppc_register(env, def);
|
||||
cpu_ppc_reset(env);
|
||||
env = cpu_init(cpu_model);
|
||||
if (!env) {
|
||||
fprintf(stderr, "Unable to find PowerPC CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
/* Set time-base frequency to 100 Mhz */
|
||||
cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL);
|
||||
#if 0
|
||||
|
||||
+6
-9
@@ -100,7 +100,7 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size,
|
||||
const char *initrd_filename,
|
||||
const char *cpu_model)
|
||||
{
|
||||
CPUState *env, *envs[MAX_CPUS];
|
||||
CPUState *env = NULL, *envs[MAX_CPUS];
|
||||
char buf[1024];
|
||||
qemu_irq *pic, **heathrow_irqs;
|
||||
nvram_t nvram;
|
||||
@@ -108,7 +108,6 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size,
|
||||
int linux_boot, i;
|
||||
unsigned long bios_offset, vga_bios_offset;
|
||||
uint32_t kernel_base, kernel_size, initrd_base, initrd_size;
|
||||
ppc_def_t *def;
|
||||
PCIBus *pci_bus;
|
||||
MacIONVRAMState *nvr;
|
||||
int vga_bios_size, bios_size;
|
||||
@@ -119,16 +118,14 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size,
|
||||
linux_boot = (kernel_filename != NULL);
|
||||
|
||||
/* init CPUs */
|
||||
env = cpu_init();
|
||||
if (cpu_model == NULL)
|
||||
cpu_model = "default";
|
||||
ppc_find_by_name(cpu_model, &def);
|
||||
if (def == NULL) {
|
||||
cpu_abort(env, "Unable to find PowerPC CPU definition\n");
|
||||
}
|
||||
for (i = 0; i < smp_cpus; i++) {
|
||||
cpu_ppc_register(env, def);
|
||||
cpu_ppc_reset(env);
|
||||
env = cpu_init(cpu_model);
|
||||
if (!env) {
|
||||
fprintf(stderr, "Unable to find PowerPC CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
/* Set time-base frequency to 100 Mhz */
|
||||
cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL);
|
||||
env->osi_call = vga_osi_call;
|
||||
|
||||
+5
-8
@@ -536,7 +536,6 @@ static void ppc_prep_init (int ram_size, int vga_ram_size, const char *boot_devi
|
||||
int linux_boot, i, nb_nics1, bios_size;
|
||||
unsigned long bios_offset;
|
||||
uint32_t kernel_base, kernel_size, initrd_base, initrd_size;
|
||||
ppc_def_t *def;
|
||||
PCIBus *pci_bus;
|
||||
qemu_irq *i8259;
|
||||
int ppc_boot_device = boot_device[0];
|
||||
@@ -548,16 +547,14 @@ static void ppc_prep_init (int ram_size, int vga_ram_size, const char *boot_devi
|
||||
linux_boot = (kernel_filename != NULL);
|
||||
|
||||
/* init CPUs */
|
||||
env = cpu_init();
|
||||
if (cpu_model == NULL)
|
||||
cpu_model = "default";
|
||||
ppc_find_by_name(cpu_model, &def);
|
||||
if (def == NULL) {
|
||||
cpu_abort(env, "Unable to find PowerPC CPU definition\n");
|
||||
}
|
||||
for (i = 0; i < smp_cpus; i++) {
|
||||
cpu_ppc_register(env, def);
|
||||
cpu_ppc_reset(env);
|
||||
env = cpu_init(cpu_model);
|
||||
if (!env) {
|
||||
fprintf(stderr, "Unable to find PowerPC CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
/* Set time-base frequency to 100 Mhz */
|
||||
cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL);
|
||||
qemu_register_reset(&cpu_ppc_reset, env);
|
||||
|
||||
+14
-5
@@ -2023,9 +2023,14 @@ struct pxa2xx_state_s *pxa270_init(unsigned int sdram_size,
|
||||
fprintf(stderr, "Machine requires a PXA27x processor.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
s->env = cpu_init();
|
||||
cpu_arm_set_model(s->env, revision ?: "pxa270");
|
||||
if (!revision)
|
||||
revision = "pxa270";
|
||||
|
||||
s->env = cpu_init(revision);
|
||||
if (!s->env) {
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
register_savevm("cpu", 0, 0, cpu_save, cpu_load, s->env);
|
||||
|
||||
/* SDRAM & Internal Memory Storage */
|
||||
@@ -2132,10 +2137,14 @@ struct pxa2xx_state_s *pxa255_init(unsigned int sdram_size,
|
||||
struct pxa2xx_state_s *s;
|
||||
struct pxa2xx_ssp_s *ssp;
|
||||
int iomemtype, i;
|
||||
|
||||
s = (struct pxa2xx_state_s *) qemu_mallocz(sizeof(struct pxa2xx_state_s));
|
||||
|
||||
s->env = cpu_init();
|
||||
cpu_arm_set_model(s->env, "pxa255");
|
||||
s->env = cpu_init("pxa255");
|
||||
if (!s->env) {
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
register_savevm("cpu", 0, 0, cpu_save, cpu_load, s->env);
|
||||
|
||||
/* SDRAM & Internal Memory Storage */
|
||||
|
||||
@@ -35,7 +35,14 @@ static void r2d_init(int ram_size, int vga_ram_size, const char *boot_device,
|
||||
CPUState *env;
|
||||
struct SH7750State *s;
|
||||
|
||||
env = cpu_init();
|
||||
if (!cpu_model)
|
||||
cpu_model = "any";
|
||||
|
||||
env = cpu_init(cpu_model);
|
||||
if (!env) {
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Allocate memory space */
|
||||
cpu_register_physical_memory(SDRAM_BASE, SDRAM_SIZE, 0);
|
||||
|
||||
+6
-2
@@ -26,10 +26,14 @@ static void realview_init(int ram_size, int vga_ram_size,
|
||||
int n;
|
||||
int done_smc = 0;
|
||||
|
||||
env = cpu_init();
|
||||
if (!cpu_model)
|
||||
cpu_model = "arm926";
|
||||
cpu_arm_set_model(env, cpu_model);
|
||||
env = cpu_init(cpu_model);
|
||||
if (!env) {
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* ??? RAM shoud repeat to fill physical memory space. */
|
||||
/* SDRAM at address zero. */
|
||||
cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
|
||||
|
||||
@@ -70,9 +70,12 @@ static void shix_init(int ram_size, int vga_ram_size, const char *boot_device,
|
||||
int ret;
|
||||
CPUState *env;
|
||||
struct SH7750State *s;
|
||||
|
||||
if (!cpu_model)
|
||||
cpu_model = "any";
|
||||
|
||||
printf("Initializing CPU\n");
|
||||
env = cpu_init();
|
||||
env = cpu_init(cpu_model);
|
||||
|
||||
/* Allocate memory space */
|
||||
printf("Allocating ROM\n");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user