linux-gcc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: andreas.ames@de.transport.bombardier.com
To: linux-gcc@vger.kernel.org
Subject: Some basic questions from a userland jerk about kernel binary format
Date: Tue, 5 May 2009 15:08:03 +0200	[thread overview]
Message-ID: <OF6AAEE414.9F24ED82-ONC12575AD.00483B21-C12575AD.0048472C@bombardier.com> (raw)

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



                 reply	other threads:[~2009-05-05 13:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OF6AAEE414.9F24ED82-ONC12575AD.00483B21-C12575AD.0048472C@bombardier.com \
    --to=andreas.ames@de.transport.bombardier.com \
    --cc=linux-gcc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).