Received: from eggs.gnu.org ([2001:4830:134:3::10]:40059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCNsW-00040l-57 for qemu-devel@nongnu.org; Mon, 13 Jun 2016 05:09:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCNsU-0003LL-29 for qemu-devel@nongnu.org; Mon, 13 Jun 2016 05:09:51 -0400 From: Date: Mon, 13 Jun 2016 14:38:33 +0530 Message-ID: <1465808915-4887-3-git-send-email-vijayak@caviumnetworks.com> In-Reply-To: <1465808915-4887-1-git-send-email-vijayak@caviumnetworks.com> References: <1465808915-4887-1-git-send-email-vijayak@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [RFC PATCH v1 2/4] exec.c: Remove static allocation of sub_section of sub_page List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-arm@nongnu.org, peter.maydell@linaro.org, pbonzini@redhat.com, quintela@redhat.com Cc: qemu-devel@nongnu.org, Prasun.Kapoor@caviumnetworks.com, vijay.kilari@gmail.com, Vijaya Kumar K , Vijaya Kumar K From: Vijaya Kumar K Allocate sub_section dynamically. Remove dependency on TARGET_PAGE_SIZE to make run-time page size detection for arm platforms. Signed-off-by: Vijaya Kumar K --- exec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index a9d465b..e803a41 100644 --- a/exec.c +++ b/exec.c @@ -154,7 +154,7 @@ typedef struct subpage_t { MemoryRegion iomem; AddressSpace *as; hwaddr base; - uint16_t sub_section[TARGET_PAGE_SIZE]; + uint16_t *sub_section; } subpage_t; #define PHYS_SECTION_UNASSIGNED 0 @@ -1151,6 +1151,7 @@ static void phys_section_destroy(MemoryRegion *mr) if (have_sub_page) { subpage_t *subpage = container_of(mr, subpage_t, iomem); object_unref(OBJECT(&subpage->iomem)); + g_free(subpage->sub_section); g_free(subpage); } } @@ -2272,7 +2273,7 @@ static subpage_t *subpage_init(AddressSpace *as, hwaddr base) subpage_t *mmio; mmio = g_malloc0(sizeof(subpage_t)); - + mmio->sub_section = g_malloc0(TARGET_PAGE_SIZE * sizeof(uint16_t)); mmio->as = as; mmio->base = base; memory_region_init_io(&mmio->iomem, NULL, &subpage_ops, mmio, -- 1.7.9.5