FW: XFree86 Port (Message from XFree86/OS2 developer)

Suhaib M. Siddiqi ssiddiqi@inspirepharm.com
Mon Jul 26 17:28:00 GMT 1999


> > > To explain what they do:
> > > pmap allows to map arbitrary physical memory into the X
> server's address
> > > space. I don't know cygwin enough to know whether there is a working
> > > mmap/munmap Unix call available, if so, it must be capable of
> accessing
>
> Both of these call are supported by the cygwin library.
>

Hi Ernie,

Thanks.  Actually below is my code, which i named cygwin_mmap.c in
xfree86/os-support/cygwin. The Server returns
an IOPL I/O error.  Obviously I am doing something wrong; that how do we
handle
the issue of /dev/iopl, which is hard-coded at several places in XFree86
source code.
Any advice, please?
Thanks
Suhaib
--------------------
#include "X.h"
#include "misc.h"

#define DevicePtr int
#include "xf86_OSlib.h"

#define BIOS_SIZE 0x20000
#define KERN_SUCCESS 0

int xf86ReadBIOS(Base, Offset, Buf, Len)
unsigned long Base;
unsigned long Offset;
unsigned char *Buf;
int Len;
{
	int fd;
	int screen_addr;
	int ret;

	if ((fd = open("/dev/iopl", O_RDWR, 0)) < 0)
	{
		ErrorF("xf86ReadBIOS: Failed to open /dev/iopl\n");
		return(-1);
	}
	if (KERN_SUCCESS != vm_allocate(task_self(), &screen_addr,
					BIOS_SIZE, TRUE))
	{
		ErrorF("xf86ReadBIOS: Failed vmallocate %x\n", BIOS_SIZE);
		close(fd);
		return(-1);
	}
	if (mmap(screen_addr, BIOS_SIZE, 3, 1, fd, Base) < 0)
	{
		ErrorF("xf86ReadBIOS: Failed to mmap %x at %x\n",
		       BIOS_SIZE, Base);
		vm_deallocate(task_self(), screen_addr, BIOS_SIZE);
		close(fd);
		return(-1);
	}
	memcpy(Buf, (unsigned char *)(screen_addr + Offset), Len);
	if (KERN_SUCCESS != vm_deallocate(task_self(), screen_addr, BIOS_SIZE))
	{
		ErrorF("xf86ReadBIOS: Failed vmdeallocate %x\n", BIOS_SIZE);
		close(fd);
		return(-1);
	}
	close(fd);
	return(Len);
}



More information about the Cygwin-xfree mailing list