Commit fe33cc710327455a55bd4f44bc7aa69661cc7878
1 parent
00af685f
Fix PowerPC initialisation and first reset:
reset must occur after we defined the CPU features. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3317 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
20 additions
and
12 deletions
hw/ppc_chrp.c
... | ... | @@ -327,9 +327,6 @@ static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device, |
327 | 327 | |
328 | 328 | /* init CPUs */ |
329 | 329 | env = cpu_init(); |
330 | - qemu_register_reset(&cpu_ppc_reset, env); | |
331 | - register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); | |
332 | - | |
333 | 330 | if (cpu_model == NULL) |
334 | 331 | cpu_model = "default"; |
335 | 332 | ppc_find_by_name(cpu_model, &def); |
... | ... | @@ -338,9 +335,12 @@ static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device, |
338 | 335 | } |
339 | 336 | for (i = 0; i < smp_cpus; i++) { |
340 | 337 | cpu_ppc_register(env, def); |
338 | + cpu_ppc_reset(env); | |
341 | 339 | /* Set time-base frequency to 100 Mhz */ |
342 | 340 | cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); |
343 | 341 | env->osi_call = vga_osi_call; |
342 | + qemu_register_reset(&cpu_ppc_reset, env); | |
343 | + register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); | |
344 | 344 | envs[i] = env; |
345 | 345 | } |
346 | 346 | ... | ... |
hw/ppc_prep.c
... | ... | @@ -26,6 +26,9 @@ |
26 | 26 | //#define HARD_DEBUG_PPC_IO |
27 | 27 | //#define DEBUG_PPC_IO |
28 | 28 | |
29 | +/* SMP is not enabled, for now */ | |
30 | +#define MAX_CPUS 1 | |
31 | + | |
29 | 32 | #define BIOS_FILENAME "ppc_rom.bin" |
30 | 33 | #define KERNEL_LOAD_ADDR 0x01000000 |
31 | 34 | #define INITRD_LOAD_ADDR 0x01800000 |
... | ... | @@ -521,7 +524,7 @@ static void ppc_prep_init (int ram_size, int vga_ram_size, int boot_device, |
521 | 524 | const char *initrd_filename, |
522 | 525 | const char *cpu_model) |
523 | 526 | { |
524 | - CPUState *env; | |
527 | + CPUState *env, *envs[MAX_CPUS]; | |
525 | 528 | char buf[1024]; |
526 | 529 | m48t59_t *nvram; |
527 | 530 | int PPC_io_memory; |
... | ... | @@ -539,20 +542,22 @@ static void ppc_prep_init (int ram_size, int vga_ram_size, int boot_device, |
539 | 542 | linux_boot = (kernel_filename != NULL); |
540 | 543 | |
541 | 544 | /* init CPUs */ |
542 | - | |
543 | 545 | env = cpu_init(); |
544 | - qemu_register_reset(&cpu_ppc_reset, env); | |
545 | - register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); | |
546 | - | |
547 | 546 | if (cpu_model == NULL) |
548 | 547 | cpu_model = "default"; |
549 | 548 | ppc_find_by_name(cpu_model, &def); |
550 | 549 | if (def == NULL) { |
551 | 550 | cpu_abort(env, "Unable to find PowerPC CPU definition\n"); |
552 | 551 | } |
553 | - cpu_ppc_register(env, def); | |
554 | - /* Set time-base frequency to 100 Mhz */ | |
555 | - cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); | |
552 | + for (i = 0; i < smp_cpus; i++) { | |
553 | + cpu_ppc_register(env, def); | |
554 | + cpu_ppc_reset(env); | |
555 | + /* Set time-base frequency to 100 Mhz */ | |
556 | + cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); | |
557 | + qemu_register_reset(&cpu_ppc_reset, env); | |
558 | + register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); | |
559 | + envs[i] = env; | |
560 | + } | |
556 | 561 | |
557 | 562 | /* allocate RAM */ |
558 | 563 | cpu_register_physical_memory(0, ram_size, IO_MEM_RAM); | ... | ... |
target-ppc/helper.c
... | ... | @@ -2789,7 +2789,11 @@ void cpu_ppc_reset (void *opaque) |
2789 | 2789 | msr_fp = 1; /* Allow floating point exceptions */ |
2790 | 2790 | msr_pr = 1; |
2791 | 2791 | #else |
2792 | +#if defined(TARGET_PPC64) | |
2793 | + env->nip = 0x00000100; | |
2794 | +#else | |
2792 | 2795 | env->nip = 0xFFFFFFFC; |
2796 | +#endif | |
2793 | 2797 | ppc_tlb_invalidate_all(env); |
2794 | 2798 | #endif |
2795 | 2799 | do_compute_hflags(env); |
... | ... | @@ -2810,7 +2814,6 @@ CPUPPCState *cpu_ppc_init (void) |
2810 | 2814 | if (!env) |
2811 | 2815 | return NULL; |
2812 | 2816 | cpu_exec_init(env); |
2813 | - cpu_ppc_reset(env); | |
2814 | 2817 | |
2815 | 2818 | return env; |
2816 | 2819 | } | ... | ... |