pc: Fix e820 fw_cfg for big endian

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Alex Williamson 2010-11-07 20:57:00 -07:00 committed by Anthony Liguori
parent 67d4b0c190
commit 8ca209ad90

14
hw/pc.c
View file

@ -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 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; struct e820_entry *entry;
if (index >= E820_NR_ENTRIES) if (index >= E820_NR_ENTRIES)
return -EBUSY; return -EBUSY;
entry = &e820_table.entry[index]; entry = &e820_table.entry[index++];
entry->address = address; entry->address = cpu_to_le64(address);
entry->length = length; entry->length = cpu_to_le64(length);
entry->type = type; entry->type = cpu_to_le32(type);
e820_table.count++; e820_table.count = cpu_to_le32(index);
return e820_table.count; return index;
} }
static void *bochs_bios_init(void) static void *bochs_bios_init(void)