Emscripten "port" to Javascript of the Bochs PC Emulator, making it possible to run linux or windows in the browser.
C++ C Shell Other
Latest commit ba87fa9 Oct 20, 2012 Johannes Ahlmann added todos to readme
Permalink
Failed to load latest commit information.
bx_debug deleted some files, edited documentation Oct 18, 2012
cpu deleted some files, edited documentation Oct 18, 2012
disasm deleted some files, edited documentation Oct 18, 2012
gui removed debug statement on output Oct 18, 2012
instrument/stubs removed more files for clarity Oct 15, 2012
iodev removed some files Oct 17, 2012
linuxe added linuxe Oct 15, 2012
memory i got it working, unfortunately only slowly ;) ;( Oct 17, 2012
workspace added IPS display under EMSCRIPTEN Oct 18, 2012
.conf.everything added some files to git tracking Oct 17, 2012
.conf.linux added some files to git tracking Oct 17, 2012
BIOS-bochs-latest millions of changes, mostly printfs Oct 17, 2012
LICENSE added LICENSE and README.md Oct 17, 2012
Makefile.in millions of changes, mostly printfs Oct 17, 2012
PERFORMANCE.md deleted some files, edited documentation Oct 18, 2012
README.md added todos to readme Oct 20, 2012
VGABIOS-lgpl-latest millions of changes, mostly printfs Oct 17, 2012
aclocal.m4 initial commit Oct 14, 2012
bochs.h added IPS display under EMSCRIPTEN Oct 18, 2012
bochsrc added IPS display under EMSCRIPTEN Oct 18, 2012
build_it.sh deleted some files, edited documentation Oct 18, 2012
bxversion.h added some files to git tracking Oct 17, 2012
bxversion.h.in initial commit Oct 14, 2012
bxversion.rc added some files to git tracking Oct 17, 2012
bxversion.rc.in initial commit Oct 14, 2012
config.cc removed unused files Oct 15, 2012
config.guess initial commit Oct 14, 2012
config.h.in initial commit Oct 14, 2012
config.sub initial commit Oct 14, 2012
configure removed some files Oct 17, 2012
configure.in removed some files Oct 17, 2012
cpudb.h initial commit Oct 14, 2012
crc.cc initial commit Oct 14, 2012
emptylog millions of changes, mostly printfs Oct 17, 2012
extplugin.h initial commit Oct 14, 2012
hal91.img millions of changes, mostly printfs Oct 17, 2012
install-sh initial commit Oct 14, 2012
launch.js removed some files Oct 17, 2012
libtool added some files to git tracking Oct 17, 2012
load32bitOShack.cc initial commit Oct 14, 2012
logio.cc initial commit Oct 14, 2012
ltdl.h initial commit Oct 14, 2012
ltdlconf.h.in millions of changes, mostly printfs Oct 17, 2012
ltmain.sh initial commit Oct 14, 2012
main.cc added IPS display under EMSCRIPTEN Oct 18, 2012
msrs.def initial commit Oct 14, 2012
osdep.cc initial commit Oct 14, 2012
osdep.h initial commit Oct 14, 2012
param_names.h initial commit Oct 14, 2012
pc_system.cc added IPS display under EMSCRIPTEN Oct 18, 2012
pc_system.h millions of changes, mostly printfs Oct 17, 2012
plugin.cc removed unused files Oct 15, 2012
plugin.h initial commit Oct 14, 2012

README.md

jsbochs - Bochs PC Emulator for the Browser

Emscripten "port" to Javascript of the Bochs PC Emulator.

Inspired by Fabrice Bellard's fantastic jslinux.

(Being) Ported by Johannes Ahlmann

Status

The code runs flawlessly under javascript. The only issue is that it runs SLOOOOW. It runs the BIOS code reasonably fast, but then goes down to 0.04MIPS instead of native 30MIPS.

Also, I have almost no output options yet.

This git repo is currently my work bench and a bastadization of the original bochs code. I have removed all files that were not absolutely necessary for compilation in order to get my bearings.

Suggestions for Performance

  • -s PRECISE_I64_MATH=0 will likely not work. I am very concerned that doubles > 2^32 may not be monotonic when adding 1.
  • -s INLINING_LIMIT=0 compiles very slowly. But I will try to get it compiled (>1h)
  • replace 64bit ints with 32bit. Not sure what to replace the instruction counter with since 32bit counter will overflow in (2^32instructions/30,000,000instructions/s/60s =) 2.5 minutes. I will try a clock divider since I don't need instruction-precise timers anyway.

Install

Requirements

Building

Simply run the build_it.sh script which will configure and build the bochs.js file.

Alternatively follow the steps below:

emconfigure ./configure --disable-plugins --disable-x86-64 --enable-cpu-level=4 \
--with-term  --disable-large-ramfile --disable-cdrom --disable-debugger-gui \
--disable-readline --disable-iodebug --enable-show-ips --enable-logging \
--disable-idle-hack --disable-debugger --disable-disasm --enable-fpu

emmake make

emcc -O1 bochs.bc -o bochs.js

node launch.js

TODO

  • Currently it runs under node in the console. Get main loop running for browser
  • Get an output running. Either a nicer terminal output or SDL output in the browser
  • Get it to compile with -O2. This would be a tremendous speedup, but currently there are compiler errors about bit arithmetic.

Issues

Resolved Issues

Open Issues

  • Browser main loop
  • Compile with closure (bit arithmetic errors)
  • Speed

License

  • Bochs (and jsbochs) as a whole is released under the GNU Lesser General Public License

  • Parts of Bochs have specific licenses which are compatible with the GNU Lesser General Public License. Hence each source file contains its own licensing information.