gvegidy / rpms / qemu

Forked from rpms/qemu 5 months ago
Clone
Blob Blame History Raw
From d6ecb03610dba922cbfde42acb41603e2c658047 Mon Sep 17 00:00:00 2001
From: Glauber Costa <glommer@redhat.com>
Date: Fri, 8 May 2009 02:22:13 -0300
Subject: [PATCH 2/2] reset state for load_linux

The linux loader is just an option rom like any other, just with
some special requirements. Right now, our option rom resetting
mechanism is not being applied to it. As a result, users using
-kernel will not be able to successfully reboot their machines

This patch fixes it by saving all the data we generated in
the load_linux() function, to be used later by the option rom
resetting mechanism.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/pc.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Index: qemu-kvm-0.10/qemu/hw/pc.c
===================================================================
--- qemu-kvm-0.10.orig/qemu/hw/pc.c
+++ qemu-kvm-0.10/qemu/hw/pc.c
@@ -527,6 +527,7 @@ static void generate_bootsect(uint8_t *o
     rom[sizeof(rom) - 1] = -sum;
 
     memcpy(option_rom, rom, sizeof(rom));
+    option_rom_setup_reset(option_rom, sizeof (rom));
 }
 
 static long get_file_size(FILE *f)
@@ -694,6 +695,12 @@ static void load_linux(uint8_t *option_r
     memset(gpr, 0, sizeof gpr);
     gpr[4] = cmdline_addr-real_addr-16;	/* SP (-16 is paranoia) */
 
+    option_rom_setup_reset(real_addr, setup_size);
+    option_rom_setup_reset(prot_addr, kernel_size);
+    option_rom_setup_reset(cmdline_addr, cmdline_size);
+    if (initrd_filename)
+        option_rom_setup_reset(initrd_addr, initrd_size);
+
     generate_bootsect(option_rom, gpr, seg, 0);
 }