LWN.net Logo

The Bochs x86 PC Emulator

The Bochs x86 PC Emulator

Posted Jan 22, 2004 6:28 UTC (Thu) by danshearer (guest, #18686)
Parent article: The Bochs x86 PC Emulator

> Due to the x86 instruction set emulation used by Bochs, performance of
> emulated applications may not be especially speedy.

More specifically, Bochs is a fully synthetic simulation(*) environment, which means that there is no reliance on the architecture of the host. There is a piece of C++ for each CPU instruction that is implemented, and this code is run for every occurance of that instruction in object code being run on the simulated computer. Even if the same instruction could be run in a flash just by doing a quick call to the host processor, they don't. Not only is that cheating for this type of simulator, but there's a lot of good reasons why this would be bad and unexpected behaviour for the users.

This class of simulators have a maximum performance of something like -75 times the real hardware (that's *minus* 75x) and most of the time Bochs doesn't get anywhere near that. In addition, Bochs has very slow I/O. So Bochs isn't ever fast, but you don't run a full-system simulator for speed even though many people do run them for real-world workloads. (Sometimes, simulators like Bochs are much faster than real life overall because of the possibilities with checkpointing. However Bochs doesn't have support for that.)

--
Dan Shearer
dan@shearer.org

(*) inasmuch as the word "simulated" has meaning anymore, having been confused with "virtualised" until I'm not sure anyone can pick the difference


(Log in to post comments)

The Bochs x86 PC Emulator

Posted Jan 22, 2004 18:45 UTC (Thu) by eludias (subscriber, #4058) [Link]

For a better performing CPU emulator (but currently also less complete), see also QEMU: http://fabrice.bellard.free.fr/qemu/ . Reported speeds are ~10% of real computer (with cheats).

The Bochs x86 PC Emulator

Posted Jan 24, 2004 9:10 UTC (Sat) by danshearer (guest, #18686) [Link]

Agreed!

QEMU also has a modular, pluggable design that improves a lot on Bochs. It can emulate architectures other than x86.

Unfortunately it doesn't abstract out architecture descriptions well (no open source emulators do.) See some PowerPC implementation at
http://savannah.nongnu.org/cgi-bin/viewcvs/qemu/qemu/target-ppc/op.c?rev=HEAD&content-type=text/vnd.viewcvs-markup
as an example. What is required is a grammar so that there can be one canonical description for an architecture used by all sorts of emulators.

Many such grammars exist but there are no free implementations I know of. There is also no interest to use them among the people who develop emulators :-(

--
Dan Shearer
dan@shearer.org

The Bochs x86 PC Emulator

Posted Jan 24, 2004 10:01 UTC (Sat) by danshearer (guest, #18686) [Link]

This was actually a bit strong:

> There is also no interest...

Because I haven't tried all that hard to elicit any.

Dan

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds