[uClibc]mipsel mmap

Steven Seeger sseeger at stellartec.com
Sun Jun 15 18:56:09 UTC 2003


I had this problem as well. I wanted to mmap 0xb30a0000 in dev/kmem and had
the same problem as you. What the problem is that a new mmap calls for the
area mapped to be a page address and not a real address. Since the page size
on my arch is 0xfff, I had to map 0xb30a0 instead. Simply right shift your
address by your page size and try it again.

Regards,
Steve

>-----Original Message-----
>From: uclibc-bounces at uclibc.org [mailto:uclibc-bounces at uclibc.org]On
>Behalf Of Stuart Hughes
>Sent: Friday, June 13, 2003 8:27 AM
>To: uClibc
>Subject: [uClibc]mipsel mmap
>
>
>I'm trying to use mmap to map an area of Flash with an offset of
>1c000000 into my user space.
>If I do this on a glibc based system, this works okay, and you see the
>following map from /proc
>
>2ad00000-2bd00000 rw-s 1c000000 00:07 1262277    /dev/mem
>
>If I do the same in uclibc I can't read the Flash data (I get something
>else) and I see the following in my process's map:
>
>2abc0000-2bbc0000 rw-s 00000000 00:07 1786854    /dev/mem
>
>My mmap command is:
>
>        if((MemFd = open("/dev/mem", O_RDWR)) < 0) {
>            fprintf(stderr, "%s - open: %s\n", func, strerror(errno));
>        }
>        if((pFlashAddr = (unsigned char *)mmap(NULL, FLASH_SIZE,
>                                    PROT_READ | PROT_WRITE,
>                                    MAP_SHARED, MemFd,
>                                    FLASH_MEM_BASE_ADDRESS)) < 0) {
>
>
>I'm using uClibc-0.9.19.
>
>Also, if I strace the glibc version, I see (NOTE: old_mmap, not mmap):
>
>open("/dev/mem", O_RDWR)                = 3
>old_mmap(NULL, 16777216, PROT_READ|PROT_WRITE, MAP_SHARED, 3,
>0x1c000000) = 0x20....
>write(2, "ff ", 3ff )                      = 3
>
>
>Whereas on uClibc I see:
>
>
>open("/dev/mem", O_RDWR)                = 7
>mmap(NULL, 16777216, PROT_READ|PROT_WRITE, MAP_SHARED, 7, 0x1c000000) =
>0x2abc00
>write(2, "41", 241)                       = 2
>
>Any idea's what's wrong.
>
>
>Regards, Stuart
>_______________________________________________
>uClibc mailing list
>uClibc at uclibc.org
>http://uclibc.org/mailman/listinfo/uclibc



More information about the uClibc mailing list