ts-7000
[Top] [All Lists]

[ts-7000] Mmap Maps to the Wrong Address

To:
Subject: [ts-7000] Mmap Maps to the Wrong Address
From: "agreensplat" <>
Date: Thu, 16 Nov 2006 03:08:46 -0000
Hi,

I've searched through this list and can't seem to figure out what's
going on. 

All that my program does is try to get a start value Mmaped to
0x80840000. The idea is to build stuff on top of this once I get it
working.

I'm having the program print out the file descriptor and the memory
map address.

The output I get is 3 for the FD (which is expected) and mmap sends
the variable start to 2aac2000. If I specify MAP_FIXED, then I get a
zero back (so mmap failed).

Anyone have any thoughts as to what's going on? 

Thanks for your help!

Aaron

Here is my code: 

#include <stdio.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

main()
{       
        unsigned int *PADR, *PADDR;
        unsigned char *start;
        int fd = open("/dev/mem", O_RDWR|O_SYNC);
        printf("FD: %d \n",fd);
        
        start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd,
0x80840000);
        printf("Start Address Map: %x \n", start);
        close(fd);
}
        
Output from the program:

$ ./a.out
FD: 3
Start Address Map: 2aac2000
$






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU