]> Git Repo - qemu.git/blobdiff - tests/libqos/malloc-pc.c
Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-05-21' into...
[qemu.git] / tests / libqos / malloc-pc.c
index c9c48fddc9893bf7da408114e31e2e2f7e46a65e..949a99361d16faad870b8d5b59fb5136c47bd144 100644 (file)
  * See the COPYING file in the top-level directory.
  */
 
+#include "qemu/osdep.h"
 #include "libqos/malloc-pc.h"
 #include "libqos/fw_cfg.h"
 
-#define NO_QEMU_PROTOS
-#include "hw/nvram/fw_cfg.h"
+#include "standard-headers/linux/qemu_fw_cfg.h"
 
 #include "qemu-common.h"
-#include <glib.h>
 
 #define PAGE_SIZE (4096)
 
-/*
- * Mostly for valgrind happiness, but it does offer
- * a chokepoint for debugging guest memory leaks, too.
- */
-void pc_alloc_uninit(QGuestAllocator *allocator)
+void pc_alloc_init(QGuestAllocator *s, QTestState *qts, QAllocOpts flags)
 {
-    alloc_uninit(allocator);
-}
-
-QGuestAllocator *pc_alloc_init_flags(QAllocOpts flags)
-{
-    QGuestAllocator *s = g_malloc0(sizeof(*s));
     uint64_t ram_size;
-    QFWCFG *fw_cfg = pc_fw_cfg_init();
-    MemBlock *node;
-
-    s->opts = flags;
-    s->page_size = PAGE_SIZE;
+    QFWCFG *fw_cfg = pc_fw_cfg_init(qts);
 
     ram_size = qfw_cfg_get_u64(fw_cfg, FW_CFG_RAM_SIZE);
-
-    /* Start at 1MB */
-    s->start = 1 << 20;
-
-    /* Respect PCI hole */
-    s->end = MIN(ram_size, 0xE0000000);
+    alloc_init(s, flags, 1 << 20, MIN(ram_size, 0xE0000000), PAGE_SIZE);
 
     /* clean-up */
     g_free(fw_cfg);
-
-    QTAILQ_INIT(&s->used);
-    QTAILQ_INIT(&s->free);
-
-    node = mlist_new(s->start, s->end - s->start);
-    QTAILQ_INSERT_HEAD(&s->free, node, MLIST_ENTNAME);
-
-    return s;
-}
-
-inline QGuestAllocator *pc_alloc_init(void)
-{
-    return pc_alloc_init_flags(ALLOC_NO_FLAGS);
 }
This page took 0.024625 seconds and 4 git commands to generate.