diff options
author | Glauber Costa <glommer@redhat.com> | 2009-05-08 02:22:12 -0300 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-05-08 15:24:10 -0500 |
commit | e28f988427c3a27cf42ef2229f12f0a7e67cb00c (patch) | |
tree | 6fa233bcac63b6882a3f9d9823a2d37b4b139acf | |
parent | d4d698f020e50333d6eae48ce323752613b5c3ea (diff) | |
download | hqemu-e28f988427c3a27cf42ef2229f12f0a7e67cb00c.zip hqemu-e28f988427c3a27cf42ef2229f12f0a7e67cb00c.tar.gz |
register reset handler for option_roms
Currently, boot options are not preserved across a system reset.
option roms can modify themselves, or can for instance restore the real
int 0x19 vector after they tried to boot from it.
To properly do that, we need a reset handler registered to deal with option
roms. This patch is based on current version on qemu-kvm.git
Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | hw/pc.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -63,6 +63,30 @@ static PITState *pit; static IOAPICState *ioapic; static PCIDevice *i440fx_state; +typedef struct rom_reset_data { + uint8_t *data; + target_phys_addr_t addr; + unsigned size; +} RomResetData; + +static void option_rom_reset(void *_rrd) +{ + RomResetData *rrd = _rrd; + + cpu_physical_memory_write_rom(rrd->addr, rrd->data, rrd->size); +} + +static void option_rom_setup_reset(target_phys_addr_t addr, unsigned size) +{ + RomResetData *rrd = qemu_malloc(sizeof *rrd); + + rrd->data = qemu_malloc(size); + cpu_physical_memory_read(addr, rrd->data, size); + rrd->addr = addr; + rrd->size = size; + qemu_register_reset(option_rom_reset, rrd); +} + static void ioport80_write(void *opaque, uint32_t addr, uint32_t data) { } @@ -806,6 +830,7 @@ static int load_option_rom(const char *oprom, target_phys_addr_t start, } /* Round up optiom rom size to the next 2k boundary */ size = (size + 2047) & ~2047; + option_rom_setup_reset(start, size); return size; } |