public static ByteBuffer bufferForValue(Register register, RegisterValue value) {
		byte[] bytes = value.toBytes().clone();
		int start = bytes.length / 2;
		// NB: I guess contextreg is always big?
		if (!register.isBigEndian() && !register.isProcessorContext()) {
			ArrayUtils.reverse(bytes, start, bytes.length);
		}
		int offset = TraceRegisterUtils.computeMaskOffset(register);
		return ByteBuffer.wrap(bytes, start + offset, register.getNumBytes());
	}
Convert a set in an overlay space to the corresponding set in its physical space

@param set a set contained entirely in one space
@return the physical set
Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/util/TraceRegisterUtils.java