From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=53381 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFIqy-0000iZ-LF for qemu-devel@nongnu.org; Sun, 07 Nov 2010 22:57:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PFIqx-0007uv-1A for qemu-devel@nongnu.org; Sun, 07 Nov 2010 22:57:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3672) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PFIqw-0007u9-QT for qemu-devel@nongnu.org; Sun, 07 Nov 2010 22:57:06 -0500 From: Alex Williamson Date: Sun, 07 Nov 2010 20:57:00 -0700 Message-ID: <20101108035143.26532.81891.stgit@s20.home> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] pc: Fix e820 fw_cfg for big endian List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, blauwirbel@gmail.com Cc: jes.sorensen@redhat.com, alex.williamson@redhat.com Signed-off-by: Alex Williamson --- Compile tested only. Only current user is kvm, no cross-arch users. hw/pc.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 0264e3d..cc8ec14 100644 --- 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)