summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-04-23 15:13:48 +0300
committerAvi Kivity <avi@redhat.com>2009-04-23 15:16:08 +0300
commit02d4417f7518ba3ab1b1f1cd456a9986c227dd00 (patch)
tree675831620cf9520f231ea4eb5c6b3ae1189106fa /hw/extboot.c
parentkvm: libkvm: Compile with correct kernel include directory (diff)
parentxen: add -vga xenfb option, configure xenfb (Gerd Hoffmann) (diff)
downloadqemu-kvm-02d4417f7518ba3ab1b1f1cd456a9986c227dd00.tar.gz
qemu-kvm-02d4417f7518ba3ab1b1f1cd456a9986c227dd00.tar.bz2
qemu-kvm-02d4417f7518ba3ab1b1f1cd456a9986c227dd00.zip
Merge branch 'master' of git://git.sv.gnu.org/qemu into master
* commit 'master': (180 commits) xen: add -vga xenfb option, configure xenfb (Gerd Hoffmann) simplify vga selection (Gerd Hoffmann) xen: pv domain builder. (Gerd Hoffmann) xen: blk & nic configuration via cmd line. (Gerd Hoffmann) xen: add net backend driver. (Gerd Hoffmann) xen: add block device backend driver. (Gerd Hoffmann) xen: add framebuffer backend driver (Gerd Hoffmann) xen: add console backend driver. (Gerd Hoffmann) xen: backend driver core (Gerd Hoffmann) xen: groundwork for xen support (Gerd Hoffmann) update .gitignore: add qemu-io (Gerd Hoffmann) qcow2: Add plausibility check for L1/L2 entries (Kevin Wolf) qcow2: Refcount checking code cleanup (Kevin Wolf) Introduce qemu-img check subcommand (Kevin Wolf) Introduce bdrv_check (Kevin Wolf) qcow2: Fix warnings in check_refcount() (Kevin Wolf) sending NUMA topology to BIOS (Andre Przywara) add info numa command to monitor (Andre Przywara) added -numa cmdline parameter parser (Andre Przywara) Safety net for the cases where disassembler/translator disagree over instruction decoding ... Conflicts: Makefile Makefile.target configure cpu-all.h gdbstub.c hw/apic.c hw/cirrus_vga.c hw/eepro100.c hw/pc.c hw/pcnet.c hw/rtl8139.c hw/vga.c net.c pc-bios/bios.bin sysemu.h vl.c Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/extboot.c')
-rw-r--r--hw/extboot.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/hw/extboot.c b/hw/extboot.c
index 13ffafa9e..f66b6c515 100644
--- a/hw/extboot.c
+++ b/hw/extboot.c
@@ -73,7 +73,7 @@ static uint32_t extboot_read(void *opaque, uint32_t addr)
static void extboot_write_cmd(void *opaque, uint32_t addr, uint32_t value)
{
- union extboot_cmd *cmd = (void *)(phys_ram_base + ((value & 0xFFFF) << 4));
+ union extboot_cmd cmd;
BlockDriverState *bs = opaque;
int cylinders, heads, sectors, err;
uint64_t nb_sectors;
@@ -81,24 +81,27 @@ static void extboot_write_cmd(void *opaque, uint32_t addr, uint32_t value)
int blen = 0;
void *buf = NULL;
- if (cmd->type == 0x01 || cmd->type == 0x02) {
- pa = cmd->xfer.segment * 16 + cmd->xfer.offset;
- blen = cmd->xfer.nb_sectors * 512;
+ cpu_physical_memory_read((value & 0xFFFF) << 4, (uint8_t *)&buf,
+ sizeof(buf));
+
+ if (cmd.type == 0x01 || cmd.type == 0x02) {
+ pa = cmd.xfer.segment * 16 + cmd.xfer.offset;
+ blen = cmd.xfer.nb_sectors * 512;
buf = qemu_memalign(512, blen);
}
- switch (cmd->type) {
+ switch (cmd.type) {
case 0x00:
get_translated_chs(bs, &cylinders, &heads, &sectors);
bdrv_get_geometry(bs, &nb_sectors);
- cmd->query_geometry.cylinders = cylinders;
- cmd->query_geometry.heads = heads;
- cmd->query_geometry.sectors = sectors;
- cmd->query_geometry.nb_sectors = nb_sectors;
+ cmd.query_geometry.cylinders = cylinders;
+ cmd.query_geometry.heads = heads;
+ cmd.query_geometry.sectors = sectors;
+ cmd.query_geometry.nb_sectors = nb_sectors;
cpu_physical_memory_set_dirty((value & 0xFFFF) << 4);
break;
case 0x01:
- err = bdrv_read(bs, cmd->xfer.sector, buf, cmd->xfer.nb_sectors);
+ err = bdrv_read(bs, cmd.xfer.sector, buf, cmd.xfer.nb_sectors);
if (err)
printf("Read failed\n");
@@ -108,7 +111,7 @@ static void extboot_write_cmd(void *opaque, uint32_t addr, uint32_t value)
case 0x02:
cpu_physical_memory_read(pa, buf, blen);
- err = bdrv_write(bs, cmd->xfer.sector, buf, cmd->xfer.nb_sectors);
+ err = bdrv_write(bs, cmd.xfer.sector, buf, cmd.xfer.nb_sectors);
if (err)
printf("Write failed\n");