linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* RE: mmap64/open64/pread etc on 440GX
@ 2004-11-11  7:32 Neil Wilson
  2004-11-11 10:57 ` Mark Powell
  0 siblings, 1 reply; 4+ messages in thread
From: Neil Wilson @ 2004-11-11  7:32 UTC (permalink / raw)
  To: Matt Porter; +Cc: linuxppc-embedded

=20
> I'm working on some patches to fix 36-bit support for
> io_remap_page_range() and to fix some problems with set_pte()=20
> and friends on 36-bit platforms. This is the first bit=20
> necessary to make this work at all in 2.6. I should be=20
> posting something RSN. ;)
>=20
> -Matt

Okay, thanks for the info.

Guess I will have to put together a simple kernel driver so the hardware
boys can get 36bit access for now.

Neil

--
Neil Wilson
Airspan Communications Ltd.
Cambridge House, Oxford Road,
Uxbridge, Middx, UB8 1UN, UK.
Tel: +44(0)1895-467265

neilwilson@airspan.com
www.airspan.com

^ permalink raw reply	[flat|nested] 4+ messages in thread
* mmap64/open64/pread etc on 440GX
@ 2004-11-10 13:58 Neil Wilson
  2004-11-10 15:13 ` Matt Porter
  0 siblings, 1 reply; 4+ messages in thread
From: Neil Wilson @ 2004-11-10 13:58 UTC (permalink / raw)
  To: linuxppc-embedded

Hi,

I am trying to write a command line utility for our dev board
(440GX,2.6.9 kernel) in order to provide support for our hardware
engineers.  As a test I am trying to dump the first few bytes of the
U-boot header.

I though that this would work but using /dev/mem gives me a bad address
error on the pread64, using /dev/kmem only reads back 0 bytes.  Is there
something blindingly obvious that I am missing for using 36bit addresses
? I believe the address is correct as I can see the boot code from
within the kernel. Thanks.

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>

unsigned char buf[10240];

int main(int argc,char **argv)
{
	unsigned long long memAddr=3D0x00000001fff80000ULL;
	int x;
	int fd;
	int readSize;
	int pageSize;
=09
	pageSize=3Dsysconf(_SC_PAGESIZE);
=09
	fd=3Dopen64("/dev/mem", O_RDWR);
	if(fd=3D=3D-1)
	{
		perror("open64");
		return 0;
	}
=09
	readSize=3Dpread64(fd,(void*)buf,pageSize,memAddr);
=09
	if(readSize !=3D pageSize)
	{
		perror("pread64 ");
		printf("only read %d of %d requested bytes\n", readSize,
pageSize);
	}
=09
	close(fd);
=09
	// show some of it
	if(readSize>0)
	{
		for(x=3D0;x<25;x++)
		{
			printf("%02x(%c)
",buf[x],isprint(buf[x])?buf[x]:'.');
		}
		printf("\n");
	}
}

Neil

--
Neil Wilson
Airspan Communications Ltd.
Cambridge House, Oxford Road,
Uxbridge, Middx, UB8 1UN, UK.
Tel: +44(0)1895-467265

neilwilson@airspan.com
www.airspan.com

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

end of thread, other threads:[~2004-11-11 10:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-11  7:32 mmap64/open64/pread etc on 440GX Neil Wilson
2004-11-11 10:57 ` Mark Powell
  -- strict thread matches above, loose matches on Subject: below --
2004-11-10 13:58 Neil Wilson
2004-11-10 15:13 ` Matt Porter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).