Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly x86 > Re: x86 disasse...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 9 Topic 4611 of 4729
Post > Topic >>

Re: x86 disassembly + reassembly

by "Rod Pemberton" <spamtrap@[EMAIL PROTECTED] > May 4, 2008 at 12:28 AM

"ljp" <spamtrap@[EMAIL PROTECTED]
> wrote in message
news:909ff863-ad25-4534-930f-281c84fd9df6@[EMAIL PROTECTED]
> Alternately, does anyone know of a way to "link" assembly files, e.g.,
> if the normal order of things is:
>
>     foo.s -> ASSEMBLER -> foo.o
>     bar.s -> ASSEMBLER -> bar.o
>     foo.o, bar.o -> LINKER -> foobar.exe
>
> then I want to get foobar.s such that
>
>    foo.s, bar.s ->  ??? -> foobar.s
>    foobar.s -> ASSEMBLER -> foobar.exe
>

Is there some reason you can't put the source for foo and bar together
using
an editor?
  (Evenbit mentioned this in the alt.lang.asm thread and Frank implied it
here.)

> The reason I'm considering this is that I need a single assembly file
> representing the program /after/ linking.

Two threads later (other is on alt.lang.asm), I'm still unsure as to /why/
do you /need/ the linked code, object header (e.g.,ELF) , etc. as
assembly...?

Are you trying to eliminate the linker during compilation?
Are you trying to transfer the application to another platform which has
no
linker?
Are you trying to get or understand the header code for the object format?
Do you need some "mystery" process (the one between the complete
disassembly
and reassembly) to be automated?
  E.g., automatic instruction insertion for instruction testing... which
would be easier by writing the instruction to a buffer padded with nop's
and
a ret and then calling the instruction.


"reassembly unambiguously" (as Alex mentions) isn't an easy task on x86.
Binary encoding of instructions don't correspond 1:1 to assembly.  I
recently did binary equivalent ****ts of two small FORTH interpreters from
MASM to NASM.  By "binary equivalent ****ts," I mean that the instructions
are either 1) identical binary encoding or 2) same instruction with same
instruction length but different binary encoding.  I haven't been able to
post them yet since NASM uses different binary encodings than MASM for
some
instructions.  I.e., I've got lots and lots of instructions to disassemble
to ensure the correctness of the ****ts.

Terje brought up the issue of size.  If it's really trivial, you can use a
binary editor to insert a binary patch.  If it's slightly larger, you
might
hex dump the program.  hex dump the patch.  edit together.  undump hex.  I
use my own programs to do this.  If it's even larger, you can split and
unsplit the files then hex...  If it's really large, you can disassemble
and
reassemble while manually reworking until entire program until it matches
both the binary and the source for the objects.  Having the source for the
objects should dramatically reduce the amount of work.  I.e., you can tell
where each one is in the binary even from an incomplete or partially
incorrect disassembly.


Rod Pemberton
 




 9 Posts in Topic:
x86 disassembly + reassembly
ljp <spamtrap@[EMAIL   2008-04-10 11:21:44 
Re: x86 disassembly + reassembly
Belal <spamtrap@[EMAI  2008-04-30 23:08:40 
Re: x86 disassembly + reassembly
"Alexei A. Frounze&q  2008-05-01 02:43:29 
Re: x86 disassembly + reassembly
ArarghMail805NOSPAM <s  2008-05-01 20:55:32 
Re: x86 disassembly + reassembly
Frank Kotler <spamtra  2008-05-03 02:37:40 
Re: x86 disassembly + reassembly
"Alexei A. Frounze&q  2008-05-03 00:00:34 
Re: x86 disassembly + reassembly
Terje Mathisen <spamt  2008-05-03 11:45:51 
Re: x86 disassembly + reassembly
"Alexei A. Frounze&q  2008-05-03 11:49:38 
Re: x86 disassembly + reassembly
"Rod Pemberton"  2008-05-04 00:28:04 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 2:28:05 CDT 2008.