Subject: mmap error
To: None <port-sparc@netbsd.org>
From: Cliff Wright <cliff@vixen.itdl.ds.boeing.com>
List: port-sparc
Date: 06/18/2001 13:04:07
I was surprised to find that a Mozilla .9 that was working on my PowerLite 85
did not work on my Sparcstation 2. I found it was due to a mmap problem, that
I suspect is a Kernel bug for the sparc. When mmap is allowed to auto-select
the virtual address, it works fine, however when supplied a large vaule, it
fails. The following code segment fails with a seg fault, and does essentially
what Mozilla does. This code does not fail if vaddr is set to 0, or
0x10000000(again the vaddr = 0x50000000 works on the PowerLite).
This was on a 1.5 system, I did not see any bug fixes that seemed to apply,
so thought I would mention here.
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include <sys/mman.h>
main()
{
int fdz;
void *rv;
int prot;
char *vaddr = (char*) 0x50000000;
fdz = open("/dev/zero",O_RDWR , 0);
prot = PROT_READ|PROT_WRITE;
rv = mmap(vaddr, 65536L, prot, MAP_PRIVATE, fdz, 0);
printf("rv = 0x%0x\n", rv);
memset(rv, 0, 216);
}
Cliff Wright