private void initMemState(RegisterState rstate) {

		memState = new FilteredMemoryState(language);

		for (AddressSpace space : addrFactory.getPhysicalSpaces()) {
			if (!space.isLoadedMemorySpace()) {
				continue;
			}
			FilteredMemoryPageOverlay ramBank = getMemoryBank(space, getValidPageSize(space));
			memState.setMemoryBank(ramBank);
		}

		AddressSpace registerSpace = addrFactory.getRegisterSpace();
		registerState = new FilteredRegisterBank(registerSpace, pageSize, rstate, language,
			writeBack, faultHandler);

		memState.setMemoryBank(registerState);

		initRegisters(false);
	}
Get the page size to use with a specific AddressSpace. The page containers (MemoryBank)
assume page size is always power of 2. Any address space is assigned at least 8-bits of
addressable locations, so at the very least, the size is divisible by 256. Starting with this
minimum, this method finds the power of 2 that is closest to the preferred page size
(pageSize) but that still divides the size of the space.

@param space is the specific AddressSpace
@return the page size to use
Ghidra/Framework/Emulation/src/main/java/ghidra/app/emulator/DefaultEmulator.java