Re: Forcing loader to load a prog at a fixed memory location

From: Richard B. Johnson
Date: Wed Jun 29 2005 - 15:58:03 EST


On Wed, 29 Jun 2005, Sreeni wrote:

Hello,

May I know the possible ways of instrcuting the compiler/loader to
place a process's 'data segments (data, stack, heap bss etc)' at a
*fixed* physical/virtual addresses?

Thanks
Sreeni


.org ADDRESS

Starts code or data at the OFFSET specified. However, you would
need to know where `ld` put the beginning of that segment to
know what the offset referred to.

If the code is in the kernel, You can tell the linker set fixups
for some load address as the kernel does. Look at linux-`uname -r`/arch/i386/boot/compressed/Makefile to see a possible syntax.

In user-space, you can check where the loader put label '_start' and
'_end' using. You can make code that is supposed to execute at
an offset from there. However, it will never be a physical location
that you can count on.

The way a user-mode program accesses physical memory is by using
mmap() MAP_FIXED.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.12 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/