aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorVijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>2016-10-24 16:26:49 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-10-24 16:26:49 +0100
commit2615fabd42ea0078dd9e659bdb21a5b7a1f87a9a (patch)
tree1c1cded08274393ab23770731f0eece7f6782366 /exec.c
parentadb65dec4ba80ac6440aa45ca9bf409392c6da63 (diff)
downloadqemu-2615fabd42ea0078dd9e659bdb21a5b7a1f87a9a.zip
qemu-2615fabd42ea0078dd9e659bdb21a5b7a1f87a9a.tar.gz
qemu-2615fabd42ea0078dd9e659bdb21a5b7a1f87a9a.tar.bz2
exec.c: Remove static allocation of sub_section of sub_page
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 <vijayak@cavium.com> Message-id: 1465808915-4887-3-git-send-email-vijayak@caviumnetworks.com [PMM: use flexible array member rather than separate malloc so we don't need an extra pointer deref when using it] Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/exec.c b/exec.c
index 6d7f600..93128fd 100644
--- a/exec.c
+++ b/exec.c
@@ -153,7 +153,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
@@ -2215,8 +2215,7 @@ static subpage_t *subpage_init(AddressSpace *as, hwaddr base)
{
subpage_t *mmio;
- mmio = g_malloc0(sizeof(subpage_t));
-
+ mmio = g_malloc0(sizeof(subpage_t) + TARGET_PAGE_SIZE * sizeof(uint16_t));
mmio->as = as;
mmio->base = base;
memory_region_init_io(&mmio->iomem, NULL, &subpage_ops, mmio,