Received: from eggs.gnu.org ([2001:4830:134:3::10]:53364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz5wG-0006oE-Tp for qemu-devel@nongnu.org; Thu, 11 Dec 2014 10:46:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xz5wA-0003IP-PE for qemu-devel@nongnu.org; Thu, 11 Dec 2014 10:46:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36633) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz5wA-0003IH-G8 for qemu-devel@nongnu.org; Thu, 11 Dec 2014 10:45:54 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBBFjg6f012426 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 11 Dec 2014 10:45:54 -0500 From: Igor Mammedov Date: Thu, 11 Dec 2014 15:36:58 +0000 Message-Id: <1418312221-13879-2-git-send-email-imammedo@redhat.com> In-Reply-To: <1418312221-13879-1-git-send-email-imammedo@redhat.com> References: <1418312221-13879-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH V2 1/4] pc: acpi-build: make linker table dynamic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, marcel.a@redhat.com, mst@redhat.com linker table is build only once, so if later during rebuild sizes of other ACPI tables change pointers will be patched incorrectly due to wrong offsets leading to tables corruption. Fix is to rebuild linker table along with the rest of ACPI tables so that it would have correct offsets. Signed-off-by: Igor Mammedov --- hw/i386/acpi-build.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index b37a397..4d2b3b9 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1509,6 +1509,8 @@ struct AcpiBuildState { /* Copy of table in RAM (for patching). */ ram_addr_t table_ram; uint32_t table_size; + ram_addr_t linker_ram; + uint32_t linker_size; /* Is table patched? */ uint8_t patched; PcGuestInfo *guest_info; @@ -1714,6 +1716,8 @@ static void acpi_build_update(void *build_opaque, uint32_t offset) assert(acpi_data_len(tables.table_data) == build_state->table_size); memcpy(qemu_get_ram_ptr(build_state->table_ram), tables.table_data->data, build_state->table_size); + memcpy(qemu_get_ram_ptr(build_state->linker_ram), tables.linker->data, + build_state->linker_size); cpu_physical_memory_set_dirty_range_nocode(build_state->table_ram, build_state->table_size); @@ -1779,7 +1783,9 @@ void acpi_setup(PcGuestInfo *guest_info) assert(build_state->table_ram != RAM_ADDR_MAX); build_state->table_size = acpi_data_len(tables.table_data); - acpi_add_rom_blob(NULL, tables.linker, "etc/table-loader"); + build_state->linker_ram = acpi_add_rom_blob(build_state, tables.linker, + "etc/table-loader"); + build_state->linker_size = acpi_data_len(tables.linker); fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_TPMLOG_FILE, tables.tcpalog->data, acpi_data_len(tables.tcpalog)); -- 1.8.3.1