提交 c6faa758 编写于 作者: A Ard Biesheuvel 提交者: Peter Maydell

hw/arm/boot: register cpu reset handlers if using -bios

Move the registering of CPU reset handlers to before the point where
we leave the function in the -bios (not -kernel) case, so CPU reset
works correctly with -bios as well.
Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
上级 b32a9509
...@@ -478,7 +478,7 @@ static void do_cpu_reset(void *opaque) ...@@ -478,7 +478,7 @@ static void do_cpu_reset(void *opaque)
void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
{ {
CPUState *cs = CPU(cpu); CPUState *cs;
int kernel_size; int kernel_size;
int initrd_size; int initrd_size;
int is_linux = 0; int is_linux = 0;
...@@ -488,6 +488,15 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) ...@@ -488,6 +488,15 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
int big_endian; int big_endian;
static const ARMInsnFixup *primary_loader; static const ARMInsnFixup *primary_loader;
/* CPU objects (unlike devices) are not automatically reset on system
* reset, so we must always register a handler to do so. If we're
* actually loading a kernel, the handler is also responsible for
* arranging that we start it correctly.
*/
for (cs = CPU(cpu); cs; cs = CPU_NEXT(cs)) {
qemu_register_reset(do_cpu_reset, ARM_CPU(cs));
}
/* Load the kernel. */ /* Load the kernel. */
if (!info->kernel_filename) { if (!info->kernel_filename) {
...@@ -652,9 +661,7 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) ...@@ -652,9 +661,7 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
} }
info->is_linux = is_linux; info->is_linux = is_linux;
for (; cs; cs = CPU_NEXT(cs)) { for (cs = CPU(cpu); cs; cs = CPU_NEXT(cs)) {
cpu = ARM_CPU(cs); ARM_CPU(cs)->env.boot_info = info;
cpu->env.boot_info = info;
qemu_register_reset(do_cpu_reset, cpu);
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册