[clug] Javascript Emulator

steve jenkin sjenkin at canb.auug.org.au
Wed May 25 21:36:54 MDT 2011


Good one, Scott!
Thanks very much to you and the amazing Fabrice Bellard.


If, like me, you were a bit confused to be presented with a 'terminal
window', albeit running a recognisable linux (!), you might like to read
these links first [small writing at bottom].
I had to read the FAQ to figure what the clipboard box was about :-(

FAQ & Technical notes
<http://bellard.org/jslinux/faq.html>
<http://bellard.org/jslinux/tech.html>

These are the files it downloads:
http://bellard.org/jslinux/index.html		(1Kb)
http://bellard.org/jslinux/jslinux.js		(1Kb)
http://bellard.org/jslinux/cpux86-ta.js		(90Kb) [see tech notes]
http://bellard.org/jslinux/vmlinux26.bin	(1.7Mb)
http://bellard.org/jslinux/root.bin		(2.0Mb) [ext2 fsys]
http://bellard.org/jslinux/linuxstart.bin	(15Kb)


The FAQ addresses two important questions:
* How can I copy data to the Virtual Machine ?
* How can I copy data from the Virtual Machine ?

=> he's implemented /dev/clipboard. You read/write to/from it.
   Understands 'uuencoded' data as well.

Something else of import in the FAQ:
* When will there be network support ?
  It is relatively easy to add a virtual network interface.
  The problem  is to make it communicate with other hosts, ... due
  to security restrictions, it is only possible to communicate
  with the web site hosting the VM or with cooperating servers

-------

Bellard very nicely tells us in the Technical notes:

* The code is written in pure Javascript using the W3C Typed Arrays.
 A slightly slower fallback mode is implemented for browsers missing
this support.
 For the exact list of supported browsers, see the FAQ.
 In any case, a fast Javascript engine is needed to have good performance.

* Linux distribution

I compiled a 2.6.20 Linux kernel (I guess any other version would work
provided there is still an FPU emulator).
The Linux kernel configuration, patch and the source code of the Linux
starter (kind of BIOS) are available: linuxstart-20110523.tar.gz.

* What's the use ?

I did it for fun, just because newer Javascript Engines are fast enough
to do complicated things.
Real uses could be:
+ Benchmarking of Javascript engines
+ Learning to use command line Unix tools without leaving the browser.
+ Client side processing using an x86 library,eg crypto purposes.
+ A more advanced version would allow to use old DOS PC software such as
games.



A snippet from 'index' selecting what to load...
======================================
if (test_typed_arrays()) {
    include("cpux86-ta.js");
} else {
    include("cpux86.js");
    document.write('<canvas id="dummy_canvas" width="1"
height="1"></canvas>');
}
======================================


Scott Ferguson wrote on 26/05/11 12:36 PM:
> GNU goodness *in* your web browser :-D
> 
> http://bellard.org/jslinux/ (the QEMU/pi guy)
> 
> The following browsers are officially supported:
> ;Firefox 4.x
> ;Chrome 11
> ;Opera 11.11
> ;Internet Explorer 9
> 
> Cheers
> 


-- 
Steve Jenkin, Info Tech, Systems and Design Specialist.
0412 786 915 (+61 412 786 915)
PO Box 48, Kippax ACT 2615, AUSTRALIA

sjenkin at canb.auug.org.au http://members.tip.net.au/~sjenkin


More information about the linux mailing list