My error, didn't read the code... but now i don't understand what's your problem... the "2aac2000" is the pointer returned by mmap, in my prog i think i'm getting the same address, so? where is the bad address?.
On 11/16/06, Alvaro Aguirre <> wrote:
"I've searched through this list and can't seem to figure out what's
going on. "
Check http://tech.groups.yahoo.com/group/ts-7000/message/4311
On 11/16/06,
Don W. Carr <> wrote:
Looks like it is working correctly. Remember, it give you an address in your address space that corresponds to the real address. The mapping is done in real-time when you write to that address.
Also, you should use the keyword "volotile" in front of you declarations to memory that has been mapped. Otherwise, the compiler could optimize you code, not realizing this memory can change on its own.
Don.
On 11/15/06, agreensplat <> wrote:
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
$
-- Dr. Don W. Carr J. G. Montenegro 2258 Guadalajara, Mexico +52-333-630-0704 +52-333-836-4500 ext 2930
__._,_.___
SPONSORED LINKS
__,_._,___
|