OK, I know that many people dislike this, but I know others
who occasionally need it anyway. So I don't post it for general
inclusion, but for interested people.
What is it ? it's a software emulator for x86 opcodes not handled
by the processor. Emulations available are :
- BSWAP, CMPXCHG, XADD on 386 (486 instructions)
- CMOV on any x86 processor (pentium-pro instructions)
It is not meant to replace a correct compilation, but it may have
happened to all of us to try to rescue a damaged system or with a
boot disk, and copying some programs with a floppy, and then get
an 'Illegal instruction' because these programs have been compiled
with a badly configured compiler. I once had a gcc which did i686
by default, and I had a hard time trying to execute an e2fsck it
had compiled, on my k6 notebook !
Same if you take a disk from a system, and try to boot it on
another one. Well, I won't spend more time finding examples.
I've been using the 486 emulation on my 386 firewall for a few
years now, and have been quite happy with it. I cleaned the code
a bit and added support for cmov. All this will grow your bzImage
with less than 1kB.
As I stated above, it is *NOT* meant to replace a recompilation
for the correct target. Emulation is quite slow because of the
time the CPU spends processing the trap. I measured about 450
cycles for a cmov, which is quite a overhead, but still
acceptable for occasionnal purposes (1us on my k6/450).
I was thinking about adding some statistics informations, such
as the number of traps caught, globally and by process, but
finally realized that this was only bloat for something that
should not be used permanently.
I didn't have the time to try VMWare on top of this. It could
be interesting to be able to provide CMOV or other instructions
to guest systems.
Here is the patch against 2.4.19-rc1.
Comments and criticisms welcome, but flames to /dev/null.
This archive was generated by hypermail 2b29 : Sun Jun 30 2002 - 22:00:14 EST