qemu/tests/libqos/malloc-spapr.c
<<
>>
Prefs
   1/*
   2 * libqos malloc support for SPAPR
   3 *
   4 * This work is licensed under the terms of the GNU GPL, version 2 or later.
   5 * See the COPYING file in the top-level directory.
   6 */
   7
   8#include "qemu/osdep.h"
   9#include "libqos/malloc-spapr.h"
  10
  11#include "qemu-common.h"
  12
  13#define PAGE_SIZE 4096
  14
  15/* Memory must be a multiple of 256 MB,
  16 * so we have at least 256MB
  17 */
  18#define SPAPR_MIN_SIZE 0x10000000
  19
  20void spapr_alloc_uninit(QGuestAllocator *allocator)
  21{
  22    alloc_uninit(allocator);
  23}
  24
  25QGuestAllocator *spapr_alloc_init_flags(QTestState *qts, QAllocOpts flags)
  26{
  27    QGuestAllocator *s;
  28
  29    s = alloc_init_flags(flags, 1 << 20, SPAPR_MIN_SIZE);
  30    alloc_set_page_size(s, PAGE_SIZE);
  31
  32    return s;
  33}
  34
  35QGuestAllocator *spapr_alloc_init(void)
  36{
  37    return spapr_alloc_init_flags(NULL, ALLOC_NO_FLAGS);
  38}
  39