[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 2/7] exec.c: Remove static allocation of sub_sect
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PATCH v3 2/7] exec.c: Remove static allocation of sub_section of sub_page |
Date: |
Tue, 11 Oct 2016 18:08:14 +0100 |
From: Vijaya Kumar K <address@hidden>
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 <address@hidden>
Message-id: address@hidden
[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 <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
---
exec.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/exec.c b/exec.c
index 374c364..86b09ac 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
@@ -2205,8 +2205,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,
--
2.7.4
- [Qemu-devel] [PATCH v3 0/7] Runtime pagesize computation, Peter Maydell, 2016/10/11
- [Qemu-devel] [PATCH v3 5/7] migration/savevm.c: migrate non-default page size, Peter Maydell, 2016/10/11
- [Qemu-devel] [PATCH v3 1/7] migration: Remove static allocation of xzblre cache buffer, Peter Maydell, 2016/10/11
- [Qemu-devel] [PATCH v3 4/7] cpu: Support a target CPU having a variable page size, Peter Maydell, 2016/10/11
- [Qemu-devel] [PATCH v3 2/7] exec.c: Remove static allocation of sub_section of sub_page,
Peter Maydell <=
- Re: [Qemu-devel] [Qemu-arm] [PATCH v3 0/7] Runtime pagesize computation, Peter Maydell, 2016/10/11
- Re: [Qemu-devel] [PATCH v3 0/7] Runtime pagesize computation, Richard Henderson, 2016/10/11
- Re: [Qemu-devel] [PATCH v3 0/7] Runtime pagesize computation, no-reply, 2016/10/11
- Re: [Qemu-devel] [Qemu-arm] [PATCH v3 0/7] Runtime pagesize computation, Peter Maydell, 2016/10/21