]> git.proxmox.com Git - qemu.git/commitdiff
pc: Fix e820 fw_cfg for big endian
authorAlex Williamson <alex.williamson@redhat.com>
Mon, 8 Nov 2010 03:57:00 +0000 (20:57 -0700)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 16 Nov 2010 20:35:00 +0000 (14:35 -0600)
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/pc.c

diff --git a/hw/pc.c b/hw/pc.c
index e7f7ac6b0e15e7c081fe5519966c067f23264dda..c34d194c251263a7159094df6ceafac7813acf83 100644 (file)
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -467,19 +467,19 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val)
 
 int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
 {
-    int index = e820_table.count;
+    int index = le32_to_cpu(e820_table.count);
     struct e820_entry *entry;
 
     if (index >= E820_NR_ENTRIES)
         return -EBUSY;
-    entry = &e820_table.entry[index];
+    entry = &e820_table.entry[index++];
 
-    entry->address = address;
-    entry->length = length;
-    entry->type = type;
+    entry->address = cpu_to_le64(address);
+    entry->length = cpu_to_le64(length);
+    entry->type = cpu_to_le32(type);
 
-    e820_table.count++;
-    return e820_table.count;
+    e820_table.count = cpu_to_le32(index);
+    return index;
 }
 
 static void *bochs_bios_init(void)