JSLinux rewritten to be human readable, hand deobfuscated and annotated
github.com
github.com
There are much cleaner emulators to study in JS: for the x86 family, I recommend v86 https://github.com/copy/v86
For general emulation, RISC architectures are much simpler to understand, jor1k https://github.com/s-macke/jor1k performs very well, and can simulate the OpenRISC 1000 architecture as well as RISC-V (32bit only). There's also the 64bit ANGEL emulator for RISC-V http://riscv.org/angel/
All of these are probably more useful pedagogically than my hand-unrolled jslinux repo, unless you're particularly interested in that emulator.
I would love to see such js emulators one-day used in operating-systems courses, allowing one to step through bootloaders and kernel init code to get a real feel for the code, along with other dynamic illustrations of the machine state and various kernel data structures on the same page. If I weren't devoted full-time to synthetic biology I might be tempted to try such a thing myself!
https://github.com/s-macke/jor1k/wiki/Benchmark-with-other-e...
In the guess of a cpu emulator, it’s actually much simpler, there’s extremely comprehensive documentation on how the 386 is supposed to behave. In this case I simply had to recognize the clever tricks used to emulate such behavior efficiently in software, e.g. using XOR operations to efficiently simulate the behavior of the translation lookaside buffer (TLB). It was mostly just reformatting, documenting and renaming things intelligently.
I have to confess that I find it all therapeutic in a way. Normally I read papers and do experiments and attempt to design things in biology, where nothing is clear at all, ever. We have the genome, which looks simple, but no way to simulate anything usefully (microscopic physics is hard and traverses a vast temporal hierarchy in “running” a cell). We’re left with uncertain measurements of the behavior of enzymes and molecules to guess at what’s going on inside the stochastic, dynamic maelstrom of a cell. It’s still reverse engineering, but it’s so much slower to do on an alien, practically uncomputable architecture than in a synthetic universe made by human minds to be understandable by human minds.
(I just submitted it to YC in the recent application batch)
There is a Terminal application with a fairly complete shell implementation.
I am currently working on integrating the *nix command line environment by bringing in PNaCl implementations of vim and python. So far, I have vim working as normal in my local development system, and python integration is underway. I should be getting a decent numpy/matplotlib developer environment up and running in the coming weeks.
It is Chrome-only, due to the dependency on the HTML5 Filesystem API and PNaCl.
ps. If you are trying to use the Terminal and it doesn't seem to respond to key presses, a simple refresh of the page should do the trick. There is a weird bug that I have yet to start tracking down.