adam at os.inf.tu-dresden.de
Tue Jun 28 21:57:45 CEST 2005
On Tue Jun 28, 2005 at 15:40:43 +0200, Bert van Leeuwen wrote:
> Is there a way to get a program's relocated address? I think I need this to
> make my program work correctly when run from loader via tftp... I access a
> PCI device, the code at one point calls virt_to_bus, which uses an extern
> unsigned int offset which is 0, but there is a comment saying that the
> offset should be set to the program's relocated address instead of 0...
> Running my program from grub works just fine, but not from loader,
> presumably because of this. The program itself "works" from loader, but not
> the PCI interfacing, so I'm sure its got something to do with relocation.
Ok, what you actually want to have is a working virt_to_phys. When
being run via the loader the memory for the program comes in dataspaces,
so that you can query the data space manager for the physical addresses
(l4dm_mem_phys_addr). That is the way to go.
Any virtual address isn't going to give you much as the loader or any
other involved component may give you arbitrary physical memory. When
using memory for DMA, one should make sure that the used memory area is
physically contiguous, for obvious reasons.
Adam adam at os.inf.tu-dresden.de
More information about the l4-hackers