public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* mmap going to wrong physical address
@ 2004-11-03 21:51 mark slutz
  2004-11-04 21:38 ` Bill Davidsen
  0 siblings, 1 reply; 2+ messages in thread
From: mark slutz @ 2004-11-03 21:51 UTC (permalink / raw)
  To: linux-kernel

I am writting an application that needs control over large (1gig+)
portions of contiguous memory. I am currently doing this by using
mem=1024m during boot. My system is a dual opteron with 5 gig of
memory. In my program I have

if ((fd=open("/dev/mem", O_RDWR))<0)
{
perror("open");
exit(-1);
}


PtrMemoryBase = (void *) mmap64(
NULL,
size,
PROT_READ | PROT_WRITE,
MAP_FILE | MAP_SHARED,
fd,
base );

size = 1MB

I also have -D_FILE_OFFSET_BITS=64.

If base is between 1 and 3 gig the process works fine. When base is 4
gig + the mmap64 works but the memory does not seem to be mapped to
the base location. I write a pattern to PtrMemoryBase then have my
hardware start doing DMA transfers from the base address but I do not
get the data I wrote to PtrMemoryBase.

Thanks for any help
Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: mmap going to wrong physical address
  2004-11-03 21:51 mmap going to wrong physical address mark slutz
@ 2004-11-04 21:38 ` Bill Davidsen
  0 siblings, 0 replies; 2+ messages in thread
From: Bill Davidsen @ 2004-11-04 21:38 UTC (permalink / raw)
  To: mark slutz; +Cc: linux-kernel

mark slutz wrote:
> I am writting an application that needs control over large (1gig+)
> portions of contiguous memory. I am currently doing this by using
> mem=1024m during boot. My system is a dual opteron with 5 gig of
> memory. In my program I have
> 
> if ((fd=open("/dev/mem", O_RDWR))<0)
> {
> perror("open");
> exit(-1);
> }
> 
> 
> PtrMemoryBase = (void *) mmap64(
> NULL,
> size,
> PROT_READ | PROT_WRITE,
> MAP_FILE | MAP_SHARED,
> fd,
> base );
> 
> size = 1MB
> 
> I also have -D_FILE_OFFSET_BITS=64.
> 
> If base is between 1 and 3 gig the process works fine. When base is 4
> gig + the mmap64 works but the memory does not seem to be mapped to
> the base location. I write a pattern to PtrMemoryBase then have my
> hardware start doing DMA transfers from the base address but I do not
> get the data I wrote to PtrMemoryBase.
> 
> Thanks for any help

I'm not sure it will help, but have you tried the MAP_FIXED option, and 
is your address which doesn't work a multiple of the page size?

-- 
    -bill davidsen (davidsen@tmr.com)
"The secret to procrastination is to put things off until the
  last possible moment - but no longer"  -me


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-11-05 15:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-03 21:51 mmap going to wrong physical address mark slutz
2004-11-04 21:38 ` Bill Davidsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox