Buggy mmap()??

Jacky Lam jackylam at astri.org
Fri Apr 2 18:15:17 EST 2004


Dear all,

    Currently,I write a small program to access /dev/mem. However, I find
that the data I get from mmap() is different from what I get from normal
read(). I have heard about there is some bug in mmap() in PPC. Is there any
patch to solve this? (I am using Monvista vista 3.0 kernel and libraries)

    The program I used is:

    void main(void)
    {
        int fd;
        char *addr;
        char c;

        fd=open("/dev/mem", O_RDONLY);
        addr=mmap(NULL, 0x00100000, PROT_READ, MAP_SHARED, fd, 0x00300000);
        printf("%x\n", *addr);

        lseek(fd, 0x00300000, SEEK_SET);
        read(fd, &c, 1);
        printf("%x\n", c);

        close(fd);
    }


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-embedded mailing list