(off_t)offset + bus_base_addr);
(off_t)(unsigned long)offset + bus_base_addr);
XF86DGAGetVideo(dis, screen, addr, width, bank, ram)Display *dis;int screen;char **addr;int *width, *bank, *ram;{   int offset, fd;#ifdef __EMX__   APIRET rc;   ULONG action;   HFILE hfd;#endif#ifdef	__alpha__   off_t bus_base_addr = _bus_base();   /* DGA would be broken on Jensen anyway due to the lack of      dense memory space */   if (!bus_base_addr) {        fprintf(stderr, "XF86DGAGetVideo: DGA is not supported on Jensen\n");	exit(-3);   }#else#define	bus_base_addr	0#endif   XF86DGAGetVideoLL(dis, screen , &offset, width, bank, ram);#ifndef Lynx#if defined(ISC) && defined(HAS_SVR3_MMAP)   if ((fd = open("/dev/mmap", O_RDWR)) < 0)   {        fprintf(stderr, "XF86DGAGetVideo: failed to open /dev/mmap (%s)\n",                           strerror(errno));	exit(-1);   }#else#ifdef __EMX__   /* Dragon warning here! /dev/pmap$ is never closed, except on progam exit.    * Consecutive calling of this routine will make PMAP$ driver run out    * of memory handles. Some umap/close mechanism should be provided    */   rc = DosOpen("/dev/pmap$", &hfd, &action, 0, FILE_NORMAL, FILE_OPEN,		OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE, (PEAOP2)NULL);   if (rc != 0) {	fprintf(stderr, 		"XF86DGAGetVideo: failed to open /dev/pmap$ (rc=%d)\n",		rc);	exit(-1);   }#else   if ((fd = open(DEV_MEM, O_RDWR)) < 0)   {        fprintf(stderr, "XF86DGAGetVideo: failed to open %s (%s)\n",                           DEV_MEM, strerror(errno));        exit (-1);   }#endif#endif#endif#if defined(ISC) && defined(HAS_SVR3_MMAP)   XFree86mloc.vaddr=(char *) 0;   XFree86mloc.physaddr=(char *)offset;   XFree86mloc.length=*bank;   XFree86mloc.ioflg=1;#define DEBUG_MMAP(state)     fprintf(stderr,"\        XF86DGAGetVideo: (%s) \n\            vaddr=%x/%x physaddr=%x/%x length=%d/%d\n",\        (state) ,\        XFree86mloc.vaddr,*addr,\        XFree86mloc.physaddr,offset,\        XFree86mloc.length,*bank)   DEBUG_MMAP("before MMAP");   if ((*addr = (char *) ioctl( fd, MAP, &XFree86mloc)) != (char *)-1) {     offset=(int)XFree86mloc.physaddr;     *bank=(int)XFree86mloc.length;     DEBUG_MMAP("after MMAP");   } else {     DEBUG_MMAP("after MMAP");     fprintf(stderr, "XF86DGAGetVideo: failed to mmap /dev/mmap (%s)\n",                           strerror(errno));     exit (-2);   }#else /* !ISC */#ifdef Lynx   *addr = (void *)smem_create("XF86DGA", (char *)offset, *bank, SM_READ|SM_WRITE);   if (*addr == NULL) {        fprintf(stderr, "XF86DGAGetVideo: smem_create() failed (%s)\n",                           strerror(errno));        exit (-2);   }#else /* !Lynx */#ifdef __EMX__   {	struct map_ioctl {		union {			ULONG phys;			void* user;		} a;		ULONG size;	} pmap,dmap;	ULONG plen,dlen;#define XFREE86_PMAP	0x76#define PMAP_MAP	0x44	pmap.a.phys = offset;	pmap.size = *bank;	rc = DosDevIOCtl(hfd, XFREE86_PMAP, PMAP_MAP,			 (PULONG)&pmap, sizeof(pmap), &plen,			 (PULONG)&dmap, sizeof(dmap), &dlen);	if (rc==0) {		*addr = dmap.a.user;	}   }   if (rc != 0) {        fprintf(stderr, 		"XF86DGAGetVideo: failed to mmap /dev/pmap$ (rc=%d)\n",                rc);        exit (-2);   }#else /* !__EMX__ */#ifndef MAP_FILE#define MAP_FILE 0#endif   /* This requires linux-0.99.pl10 or above */   *addr = (void *)mmap(NULL, *bank, PROT_READ,                        MAP_FILE | MAP_SHARED, fd, 			(off_t)offset + bus_base_addr);#ifdef DEBUG   fprintf(stderr, "XF86DGAGetVideo: physaddr: 0x%08x, size: %d\n",	   (long)offset, *bank);#endif   if (*addr == (char *) -1) {        fprintf(stderr, "XF86DGAGetVideo: failed to mmap %s (%s)\n",                           DEV_MEM, strerror(errno));        exit (-2);   }#endif /* !__EMX__*/#endif /* !Lynx */#endif /* !ISC && !HAS_SVR3_MMAP */   _XFree86size = *bank;   _XFree86addr = *addr;      atexit((void(*)(void))XF86cleanup);   /* one shot XF86cleanup attempts */   signal(SIGSEGV, XF86cleanup);#ifdef SIGBUS   signal(SIGBUS, XF86cleanup);#endif   signal(SIGHUP, XF86cleanup);   signal(SIGFPE, XF86cleanup);     return 1;}