status_t
LargeMemoryPhysicalPageMapper::Init(kernel_args* args,
	PhysicalPageSlotPool* initialPools, int32 initialPoolCount, size_t poolSize,
	TranslationMapPhysicalPageMapper*& _kernelPageMapper)
{
	ASSERT(initialPoolCount >= 1);

	fInitialPool = initialPools;
	for (int32 i = 0; i < initialPoolCount; i++) {
		uint8* pointer = (uint8*)initialPools + i * poolSize;
		fNonEmptyPools.Add((PhysicalPageSlotPool*)pointer);
	}

	// get the debug slot
	GetSlot(true, fDebugSlot);

	// init the kernel translation map physical page mapper
	status_t error = fKernelMapper.Init();
	if (error != B_OK) {
		panic("LargeMemoryPhysicalPageMapper::Init(): Failed to init "
			"kernel translation map physical page mapper!");
		return error;
	}
	_kernelPageMapper = &fKernelMapper;

	// init the per-CPU data
	int32 cpuCount = smp_get_num_cpus();
	for (int32 i = 0; i < cpuCount; i++)
		fPerCPUData[i].Init();

	return B_OK;
}
status_t
LargeMemoryPhysicalPageMapper::Init(kernel_args* args,
	PhysicalPageSlotPool* initialPool,
	TranslationMapPhysicalPageMapper*& _kernelPageMapper)
{
	fInitialPool = initialPool;
	fNonEmptyPools.Add(fInitialPool);

	// get the debug slot
	GetSlot(true, fDebugSlot);

	// init the kernel translation map physical page mapper
	status_t error = fKernelMapper.Init();
	if (error != B_OK) {
		panic("LargeMemoryPhysicalPageMapper::Init(): Failed to init "
			"kernel translation map physical page mapper!");
		return error;
	}
	_kernelPageMapper = &fKernelMapper;

	// init the per-CPU data
	int32 cpuCount = smp_get_num_cpus();
	for (int32 i = 0; i < cpuCount; i++)
		fPerCPUData[i].Init();

	return B_OK;
}
status_t
LargeMemoryPhysicalPageMapper::CreateTranslationMapPhysicalPageMapper(
	TranslationMapPhysicalPageMapper** _mapper)
{
	LargeMemoryTranslationMapPhysicalPageMapper* mapper
		= new(std::nothrow) LargeMemoryTranslationMapPhysicalPageMapper;
	if (mapper == NULL)
		return B_NO_MEMORY;

	status_t error = mapper->Init();
	if (error != B_OK) {
		delete mapper;
		return error;
	}

	*_mapper = mapper;
	return B_OK;
}