--- solx86_mmap.c 1996/12/23 06:51:19 3.1 +++ xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_mmap.c 2000/02/08 20:32:10 3.1.2.1 @@ -43,6 +43,8 @@ int fd; unsigned char *ptr; char solx86_vtname[10]; + int mlen; + int psize = 4096; /* XXX x86 only */ /* * Solaris 2.1 x86 SVR4 (10/27/93) @@ -56,8 +58,9 @@ ErrorF("xf86ReadBios: Failed to open %s (%s)\n", solx86_vtname, strerror(errno)); return(-1); - } - ptr = mmap((caddr_t)0, 0x8000, PROT_READ, MAP_SHARED, fd, (off_t)Base); + } + mlen = (Offset + Len + psize - 1) & ~psize; + ptr = mmap((caddr_t)0, mlen, PROT_READ, MAP_SHARED, fd, (off_t)Base); if ((int)ptr == -1) { ErrorF("xf86ReadBios: %s mmap failed\n", solx86_vtname); @@ -65,7 +68,7 @@ return(-1); } (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, 0x8000); + (void)munmap((caddr_t)ptr, mlen); (void)close(fd); return(Len); } --- bios_V4mmap.c 1996/12/23 06:51:24 3.4 +++ xc/programs/Xserver/hw/xfree86/os-support/sysv/bios_V4mmap.c 2000/02/08 20:32:11 3.4.2.1 @@ -42,6 +42,8 @@ { int fd; unsigned char *ptr; + int mlen; + int psize = 4096; /* XXX x86 only */ if ((fd = open(DEV_MEM, O_RDONLY)) < 0) { @@ -49,7 +51,8 @@ strerror(errno)); return(-1); } - ptr = (unsigned char *)mmap((caddr_t)0, 0x8000, PROT_READ, MAP_SHARED, + mlen = (Offset + Len + psize - 1) & ~psize; + ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, MAP_SHARED, fd, (off_t)Base); if ((int)ptr == -1) { @@ -58,7 +61,7 @@ return(-1); } (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, 0x8000); + (void)munmap((caddr_t)ptr, mlen); (void)close(fd); return(Len); }