summaryrefslogtreecommitdiff
path: root/tools/testing/memblock/tests/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/memblock/tests/common.c')
-rw-r--r--tools/testing/memblock/tests/common.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/testing/memblock/tests/common.c b/tools/testing/memblock/tests/common.c
index dd7e87c589fe..62d3191f7c9a 100644
--- a/tools/testing/memblock/tests/common.c
+++ b/tools/testing/memblock/tests/common.c
@@ -5,6 +5,8 @@
#define INIT_MEMBLOCK_REGIONS 128
#define INIT_MEMBLOCK_RESERVED_REGIONS INIT_MEMBLOCK_REGIONS
+static struct test_memory memory_block;
+
void reset_memblock_regions(void)
{
memset(memblock.memory.regions, 0,
@@ -27,3 +29,20 @@ void reset_memblock_attributes(void)
memblock.bottom_up = false;
memblock.current_limit = MEMBLOCK_ALLOC_ANYWHERE;
}
+
+void setup_memblock(void)
+{
+ reset_memblock_regions();
+ memblock_add((phys_addr_t)memory_block.base, MEM_SIZE);
+}
+
+void dummy_physical_memory_init(void)
+{
+ memory_block.base = malloc(MEM_SIZE);
+ assert(memory_block.base);
+}
+
+void dummy_physical_memory_cleanup(void)
+{
+ free(memory_block.base);
+}