Ejemplo n.º 1
0
/*
 * Boot time wrappers for memory allocators. Called for both permanent
 * and temporary boot memory allocations. We have to track which allocator
 * (boot or kmem) was used so that we know how to free.
 */
void *
bkmem_alloc(size_t size)
{
	/* allocate from boot scratch memory */
	void *addr;

	if (_kmem_ready)
		return (kobj_alloc(size, 0));

	/*
	 * Remember the highest BOP_ALLOC allocated address and don't free
	 * anything below it.
	 */
	addr = BOP_ALLOC(ops, 0, size, 0);
	if (scratch_max < (uintptr_t)addr + size)
		scratch_max = (uintptr_t)addr + size;
	return (addr);
}
Ejemplo n.º 2
0
void *
ctf_alloc(size_t size)
{
	return (kobj_alloc(size, KM_NOWAIT|KM_TMP));
}