Subject: i386/m68k binary conversion
To: Jose Alburquerque <jose@alexandria.net>
From: David Gilbert <dgilbert@jaywon.pci.on.ca>
List: current-users
Date: 10/06/1996 22:40:35
>>>>> "Jose" == Jose Alburquerque <jose@alexandria.net> writes:

Jose> Would it be possible to convert a binary program or library for
Jose> NetBSD-i386 to m68k-NetBSD binary fomat with some sort of
Jose> conversion program?  Just curious.

	Possible, yes.  Practical?  Well... without going into
intricate detail, I would expect that running binaries from other
NetBSD platforms would be 'easier' than some other emulation efforts
already underway.  Easier in this case being the fact that you don't
have to spend enormous amounts of time watching for all the foreign
traps and hardware stuff that plagues so many of these efforts.

	What would be involved?  You'd need to write a 'simulator' for
the i386 that runs on the m68k.  Actually writing this simulator isn't
that hard... for each of the few hundred valid i386 instructions, you
could create a subroutine to 'simulate' it's action.  This would suck,
however.

	The really hard thing about this type of emulation is that you
really have to optimize the crap out of it... and squeezing
performance out of this type of thing is very difficult.

	You're asking about one step further... which is basically
writing out this new executable.  Think about it another way.  If you
had the source, then you could just recompile.  So you're really
asking about compiling with your source language being an i386 binary
and your destination being a m68k one.

	Again... your chief problem is optimization... since the
trivial (dumb) translation is fairly feasible.  The only roadblock
here is discerning what to translate.  Sicne code generators often put
data in the code segment, another difficult job (more difficult than
the emulators job) is to determine what is actually code).

Dave.

-- 
============================================================================
|David Gilbert, PCI, Richmond Hill, Ontario.  | Two things can only be     |
|Mail:      dgilbert@jaywon.pci.on.ca         |  equal if and only if they |
|http://www.pci.on.ca/~dgilbert               |   are precisely opposite.  |
=========================================================GLO================