ports = rm.claimIOResource(device, basePort, SVGA_NUM_PORTS * 4);
ports = claimPorts(rm, device, basePort, SVGA_NUM_PORTS * 4);
	public VMWareCore(VMWareDriver driver, PCIDevice device) throws ResourceNotFreeException, DriverException {		super(640, 480);		this.driver = driver;		final int basePort;		if (device.getConfig().getDeviceID() == PCI_DEVICE_ID_VMWARE_SVGA) {			basePort = SVGA_LEGACY_BASE_PORT;			this.indexPort = SVGA_LEGACY_BASE_PORT + SVGA_INDEX_PORT * 4;			this.valuePort = SVGA_LEGACY_BASE_PORT + SVGA_VALUE_PORT * 4;		} else {			basePort = device.getConfig().getBaseAddresses()[0].getIOBase();			this.indexPort = basePort + SVGA_INDEX_PORT;			this.valuePort = basePort + SVGA_VALUE_PORT;		}		log.debug("Found VMWare SVGA device using ports 0x" + NumberUtils.hex(indexPort) + " and 0x" + NumberUtils.hex(valuePort));		try {			final ResourceManager rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);			ports = rm.claimIOResource(device, basePort, SVGA_NUM_PORTS * 4);			final int id = getVMWareID();			if (id == SVGA_ID_0 || id == SVGA_ID_INVALID) {				dumpState();				throw new DriverException("No supported VMWare SVGA found, found id 0x" + NumberUtils.hex(id));			} else {				log.debug("VMWare SVGA ID: 0x" + NumberUtils.hex(id));			}			fifo = initFifo(device, rm);			this.capabilities = getReg32(SVGA_REG_CAPABILITIES);			this.videoRamSize = getReg32(SVGA_REG_FB_MAX_SIZE);			final int videoRamBase = getReg32(SVGA_REG_FB_START);			this.maxWidth = getReg32(SVGA_REG_MAX_WIDTH);			this.maxHeight = getReg32(SVGA_REG_MAX_HEIGHT);			final int bitsPerPixel = getReg32(SVGA_REG_BITS_PER_PIXEL);			this.bytesPerLine = getReg32(SVGA_REG_BYTES_PER_LINE);			this.videoRam = rm.claimMemoryResource(device, Address.valueOf(videoRamBase), videoRamSize, ResourceManager.MEMMODE_NORMAL);			this.bitsPerPixel = bitsPerPixel;			switch (bitsPerPixel) {				case 8 :					{						bitmapGraphics = BitmapGraphics.create8bppInstance(videoRam, width, height, bytesPerLine, 0);					}					break;				case 16 :					{						bitmapGraphics = BitmapGraphics.create16bppInstance(videoRam, width, height, bytesPerLine, 0);					}					break;				case 24 :					{						bitmapGraphics = BitmapGraphics.create24bppInstance(videoRam, width, height, bytesPerLine, 0);					}					break;				case 32 :					{						bitmapGraphics = BitmapGraphics.create32bppInstance(videoRam, width, height, bytesPerLine, 0);					}					break;				default :					throw new DriverException("Unknown bits/pixel value " + bitsPerPixel);			}			this.redMask = getReg32(SVGA_REG_RED_MASK);			this.greenMask = getReg32(SVGA_REG_GREEN_MASK);			this.blueMask = getReg32(SVGA_REG_BLUE_MASK);			this.redMaskShift = getMaskShift(redMask);			this.greenMaskShift = getMaskShift(greenMask);			this.blueMaskShift = getMaskShift(blueMask);		} catch (NameNotFoundException ex) {			throw new ResourceNotFreeException(ex);		}	}