linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* virtual memory issue
@ 2001-11-04  8:42 Ofer Rashuk
  2001-11-05 19:11 ` Dan Malek
  0 siblings, 1 reply; 2+ messages in thread
From: Ofer Rashuk @ 2001-11-04  8:42 UTC (permalink / raw)
  To: 'linuxppc-embedded@lists.linuxppc.org'


Hi.
on my custom board with PPC8240 I'm trying to run some small user space
program.
the program tries to read a device (Galileo device) that on the PCI bus.
i configured the access to the device using mmap and got a pointer with a
virtual address.

my question is who can i translate the virtual address to a physical one.
i tried it use several functions such as virt_to_phys and virt_to_bus but i
keep getting a compilation error
target/user/include/asm-ppc/io.h:214:undefined reference to 'iopa'

what am i doing wrong, is there any lib that I'm forgetting.

my compile line is as follows:
.c.o:
	$(CC) $(CFLAGS) -c $*.c

CFLAGS	= -g -Wall -O2 -I. -D_GNU_SOURCE -D_REENTRANT

#---------------------------------------------------------------------------
-
# Make the program...
#---------------------------------------------------------------------------
-
OBJS =  \
	task.o queue.o vqueue.o event.o memblk.o timer.o sema4.o demo2.o

PROG = demo

all:	$(PROG)

$(PROG): $(OBJS) Makefile
	$(CC) $(CFLAGS) $(OBJS) -o $(PROG) -lpthread



Ofer Rashuk-Rosenthal.
Software team leader.
mailto:oferr@radlan.com


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

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

* Re: virtual memory issue
  2001-11-04  8:42 virtual memory issue Ofer Rashuk
@ 2001-11-05 19:11 ` Dan Malek
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Malek @ 2001-11-05 19:11 UTC (permalink / raw)
  To: Ofer Rashuk; +Cc: 'linuxppc-embedded@lists.linuxppc.org'


Ofer Rashuk wrote:


> my question is who can i translate the virtual address to a physical one.

You can't from a user program, nor do you want to do this.  Using
mmap() to physical devices from a user application must be done
with great care, and is often used just for debugging purposes.  There
are resources used by the kernel and other applications that cause
race conditions you can't control.

If you need access to physical memory for any reason, you must
write a kernel device driver for this device so you can properly
manage the resources necessary to ensure proper system operation.

Thanks.


	-- Dan


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

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

end of thread, other threads:[~2001-11-05 19:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-04  8:42 virtual memory issue Ofer Rashuk
2001-11-05 19:11 ` Dan Malek

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).