is it possible to retrieve section header addresses?

is it possible to retrieve section header addresses?

I?m porting my OS over to C++ (from assembly), and wanted to know if there is anyway to get the address and size of the ?.text?, ?.data?, and ?.data1? sections inserted into a variable at compile time. It?s a cinch to do in MASM but I?m having difficulty in C++, any suggestions.

linux uses the following code to address the various sections:
extern char _text, _etext, _edata, __bss_start, _end;

A last resort would have my PE loader store the section header along with the ?image base? variable and pass it during load of the executable to memory.

I?m using the Intel C++ 7.0 Compiler for Windows (updated as of today)

Thanks for any help,
Jeremy

4 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

Not sure. How do you do this in masm? Could you use inline asm in C++ to do the same. Perhaps some things are best left in asm.

Max

> Not sure. How do you do this in masm?

define labels at the start and end of the .data, .data?, and .code segments, see the attached code and disassembly

> Could you use inline asm in C++ to do the same.

the closest thing I?ve come up with is defining static variables but since .data1 is used to initialize local (stack) variables, I can't assign a start/end, (or can i?)

> Perhaps some things are best left in asm.

Looks like it, Premier Support suggested I ask my question here.

Sorry, I don't think I can provide any further thoughts other than ask, How does Linux provide this functionality?

Max

Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui