private MemoryBlock setReadOnlyBlockRange(MemoryBlock block, AddressRange range)
			throws MemoryBlockException, LockException, NotFoundException {
		if (!block.isWrite()) {
			return block;
		}
		Address startAddr = block.getStart();
		boolean split = false;
		if (!startAddr.equals(block.getStart())) {
			memory.split(block, startAddr);
			block = memory.getBlock(startAddr);
			split = true;
		}
		if (!range.contains(block.getEnd())) {
			memory.split(block, range.getMaxAddress().next());
			block = memory.getBlock(startAddr);
			split = true;
		}
		String msg = "";
		if (split) {
			msg = " (block split was required)";
		}
		log("Setting block " + block.getName() + " to read-only" + msg);
		block.setWrite(false);
		return block;
	}
Transition memory range to read-only
@param range constrained read-only region or null for entire load segment
Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/ElfProgramBuilder.java