/*
- * Copyright (c) 2015 Cisco and/or its affiliates.
+ * Copyright (c) 2015-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
return SSVM_API_ERROR_SLAVE_TIMEOUT;
re_map_it:
- ssvm->requested_va = (u64) sh->ssvm_va;
+ ssvm->requested_va = sh->ssvm_va;
ssvm->ssvm_size = sh->ssvm_size;
munmap (sh, MMAP_PAGESIZE);
vec_free (fn);
vec_free (ssvm->name);
- munmap ((void *) ssvm->requested_va, ssvm->ssvm_size);
+ munmap ((void *) ssvm->sh, ssvm->ssvm_size);
}
/**
u32 rnd_size = 0;
u8 *heap;
- rnd_size = (ssvm->ssvm_size + (pagesize - 1)) & ~(pagesize - 1);
- rnd_size = clib_min (rnd_size, ((u64) 1 << 32) - pagesize);
+ rnd_size = clib_max (ssvm->ssvm_size + (pagesize - 1), ssvm->ssvm_size);
+ rnd_size &= ~(pagesize - 1);
#if USE_DLMALLOC == 0
{
}
#else
heap = create_mspace (rnd_size, 1 /* locked */ );
+ if (heap == 0)
+ {
+ clib_unix_warning ("mheap alloc");
+ return -1;
+ }
+
+ mspace_disable_expand (heap);
#endif
ssvm->ssvm_size = rnd_size;
clib_memset (sh, 0, sizeof (*sh));
sh->heap = heap;
+ sh->ssvm_va = pointer_to_uword (heap);
sh->type = SSVM_SEGMENT_PRIVATE;
+ sh->name = ssvm->name;
return 0;
}