[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Google
  Web www.spinics.net

Some basic questions from a userland jerk about kernel binary format



Hi all, 

I hope my topic is appropriate for this list, if not please point me 
in the right direction. 

I know the thing I want to achieve is strange as I could do the same 
better by using the dynamic module loader.  Unfortunately I've got to 
port an application from another OS and I'm currently not able to 
change the inner workings too much. 

What I want to achieve is to dynamically access arbitrary variables in 
my kernel module by determining the offset of the variable's address 
offline as an offest regarding a common base address within my 
module.  To achieve that I need to know the following: 

1. How many segments does a kernel module binary usually have? Is it 
   the same as in userland, i.e. .bss, .data and .text? Or are there 
   others or only a single one? 

2. (How) can I instruct the linker to put a certain variable 'near' 
   the beginning of each segment? This would become my base address, 
   one for each segment.  I would use the dynamic loader to access 
   this base address at runtime.  The most important prerequisite 
   would be that this base address needs to be 'in front of' every 
   application variable. 

3. I want to use binutils/nm to compute the offset of my application 
   variables in terms of their distance to the relevant base address. 
   This can obviously change from revision to revision of my my 
   module, which is ok.  Is that viable (I don't know the dynamic 
   linker of the kernel)? 

4. At runtime I want to compute my application variable's address by: 

   real_adr = base address + offset 

   Is that also ok? 


TIA, 

Andreas Ames 

--
 
  
Please consider the environment before you print / Merci de penser à 
l'environnement avant d'imprimer / Bitte denken Sie an die Umwelt bevor 
Sie drucken 

Bombardier Transportation GmbH 
Vorsitzender des Aufsichtsrats / Chairman of Supervisory Board: Peter Witt 

Geschäftsführung / Executive Board: Dr. Klaus Baur 
(Vorsitzender/Chairman), Luc Charlemagne, Stephan Krenz, Stefan Schönholz 
Sitz der Gesellschaft / Principal Office: Berlin 
Registergericht / Registration Court: Amtsgericht Charlottenburg, HRB 
64838 

_______________________________________________________________________________________________________________ 

This e-mail communication (and any attachment/s) may contain confidential 
or privileged information and is intended only for the individual(s) or 
entity named above and to others who have been specifically authorized to 
receive it. If you are not the intended recipient, please do not read, 
copy, use or disclose the contents of this communication to others. Please 
notify the sender that you have received this e-mail in error by reply 
e-mail, and delete the e-mail subsequently. Please note that in order to 
protect the security of our information systems an AntiSPAM solution is in 
use and will browse through incoming emails. 
Thank you. 
_________________________________________________________________________________________________________________ 


Ce message (ainsi que le(s) fichier(s)), transmis par courriel, peut 
contenir des renseignements confidentiels ou protégés et est destiné à 
l?usage exclusif du destinataire ci-dessus. Toute autre personne est, par 
les présentes, avisée qu?il est strictement interdit de le diffuser, le 
distribuer ou le reproduire. Si vous l?avez reçu par inadvertance, 
veuillez nous en aviser et détruire ce message. Veuillez prendre note 
qu'une solution antipollupostage (AntiSPAM) est utilisée afin d'assurer la 
sécurité de nos systèmes d'information et qu'elle furètera les courriels 
entrants.
Merci. 
_________________________________________________________________________________________________________________ 


--
To unsubscribe from this list: send the line "unsubscribe linux-gcc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Kernel]     [Linux ARM]     [Linux]     [Photo]     [Yosemite News]     [Linux SCSI]     [Linux Hams]     [Motherboards]

Add to Google