Subject: Re: i386/m68k binary conversion
To: None <port-amiga@NetBSD.ORG>
From: Ezra Story <ezy@panix.com>
List: port-amiga
Date: 10/11/1996 10:10:08
Andrew Reilly writes:
> In a previous message, Dave Gilbert said:
> > the emulators job) is to determine what is actually code).
> I wonder how difficult this would really be, given that we're talking about
> an environment that is _significantly_ better behaved than the dreaded PC
> emulator, where all of the hardware has to be emulated and self-modifying,
> hand written assembly code is commonplace.
One word: htonl(), Two words: ntohl(). In fact I can cover about a
thousand words by saying that any structure passed to system functions
with words in it will be hosed because the endianess is different. I wrote
this already to someone on this thread a while back, but apparently people
still haven't given up on the translator idea. Unless your program is very
simple or your translator is very, very complex it just ain't gonna happen
from i386 -> m68k. When you here about translation occuring between these
two archs, the target will be a virtual machine (so the endianess doesn't
matter).
> Apart from the condition code handling, which would probably be
> difficult, but could perhaps be managed by letting the compiler toss
> heaps of dead code for condition evaluation that isn't used, another big
> problem could be data alignment restrictions. The i386 allows byte
> allignment, and I'm pretty sure that the m68k forces 16-bit alignment,
> and Sparcs and the like force 32 bit alignment. Maybe our compiler
> configuration makes this a non-issue already.
Alignment is trivial compared to what I mentioned above. C compilers don't
take care of these things (hence htonl,ntohl).
> In what appears to be a similar circumstance, I believe that DEC have
> quite a good i386 to Alpha translator for the Windows NT environment.
> There you've got the same virtual machine, but perhaps not as well
> controlled program segmentation, so it's perhaps a harder problem.
Worthy of note: Alpha and i386 have the same endianess (oops).
--
== Ezra Story -- ezy@panix.com -- Ezy@IRC -- http://www.panix.com/~ezy ==
** "And then I had a little luck, you were awake, I couldn't stand another **
** moment alone." - Roger Waters **