Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting raw data from an ELF .EXE file

 
SOLVED
Go to solution
Michael Moroney
Frequent Advisor

Re: Extracting raw data from an ELF .EXE file

> You can't tease us like that . . . :-)

where do I start? I brought some of this code to VMS Engineering's Porting to Itanium seminar, and some of the VMS Engineers started reaching for crosses and garlic, or just hiding under their desks. Absolute addressing. Strange stack manipulation. Ponder these two macro-32 statements for a bit and you'll get an idea...


movzwl @#CMRTFP,fp

MOVW -6(SP),R0
Michael Moroney
Frequent Advisor

Re: Extracting raw data from an ELF .EXE file

John R:

So far I've been working with elf.c that comes with the gnv kit as a starting point. It parses object files for symbols. But more can't hurt.
John Reagan
Respected Contributor

Re: Extracting raw data from an ELF .EXE file

The MOVW shouldn't be a problem, but moving into the FP is. That won't even work on Alpha by the way.

I've attached something that Hartmut wrote.
John Gillings
Honored Contributor

Re: Extracting raw data from an ELF .EXE file

John R>The MOVW shouldn't be a problem

In the sense that it's unlikely to ACCVIO, true, but how can it return a predictable result? Anything above the current SP is volatile - it could be written at any time by an AST or other interrupt. I'd call it a timing bug waiting for a place to happen.
A crucible of informative mistakes
Michael Moroney
Frequent Advisor

Re: Extracting raw data from an ELF .EXE file

re: "In the sense that it's unlikely to ACCVIO, true, but how can it return a predictable result? Anything above the current SP is volatile - it could be written at any time by an AST or other interrupt. I'd call it a timing bug waiting for a place to happen."

Exactly. Try that code with ASTs enabled. (try finding that kind of bug!)

The FP instruction is an example of how twisted this code gets. They essentially invented their own stack frames/traceback stuff between routines, via JSB/RSB, ignoring all the useful stuff provided by CALLx/RET. Also note it's a 16 bit move with an absolute address.... Yes, the Itanium MACRO-32 compiler does not like that one bit, nor does it like all the other manipulation of the FP and SP..


John R, thanks for the code, it's easier to adapt than the other code.