The Glade 4.0
https://gladerebooted.net/

Linux in JavaScript
https://gladerebooted.net/viewtopic.php?f=5&t=6330
Page 1 of 1

Author:  Lex Luthor [ Fri May 20, 2011 9:38 am ]
Post subject:  Linux in JavaScript

Quote:
We often use emulators like Qemu, Virtualbox, VMWare to virtualize another Operating systems on a different platform.

Qemu is popular and open source emulator that lets you virtualize nearly any OS on any other OS. Qemu has now been ported to a new platform: Browsers. Most modern browsers like Chrome 11 and Firefox 4 can run this javascript based Emulator making it possible to run an actual Linux in your browser.

Since javascript is slower than native code, one would expect slower boot times for the Linux, but it boots amazingly fast. With a very minimal download and couple of seconds, your browser window boots into an actual Linux based on commandline. Ofcourse CLI-only makes the OS snappy for executing all your shell commands.

If you aren’t excited so far, read this again: “A PC emulator written in javascript, and running solely in browser“.

This PC emulator is written entirely in Javascript. The emulated hardware is:

a 32 bit x86 compatible CPU
a 8259 Programmble Interrupt Controller
a 8254 Programmble Interrupt Timer
a 16450 UART.
The code is written in pure Javascript using Typed Arrays which are available in recent browsers. It was tested with Firefox 4 and Google Chrome 11 on Linux, Window and Mac. It doesn’t work with Opera.

CPU Emulation

The code is inspired from my x86 dynamic translator present in QEMU, but there are important differences because here it is an interpreter. The exact restrictions of the emulated CPU are:

No FPU/MMX/SSE
No segment limit and right checks when accessing memory (Linux does not rely on them for memory protection, so it is not an issue. The x86 emulator of QEMU has the same restriction).
No CS/DS/ES/SS segment overrides. FS/GS overrides are implemented because they are needed for Thread Local Storage in Linux.
A few seldom used instructions are missing (BCD operations, BOUND, …).
No single-stepping
No real mode
No 16 bit protected mode (although most 16 bit instructions are present because they are needed to run 32 bit programs).
Most of these restrictions are easy to remove.

Linux distro & kernel

It runs 2.6.20 Linux kernel with configuration available here.

The disk image is just a ram disk image loaded at boot time. It contains a filesystem generated with Buildroot containing BusyBox. I added my toy C compiler TinyCC and my unfinished but usable emacs clone QEmacs.

Javascript Performance

PC emulator is about 2 times slower using V8 than Jaeger Monkey on 32bit desktops.

I still have to try this on mobile browsers, let me know if that works for you.


http://bellard.org/jslinux/

So cool. I'm going to play around with this.

Author:  Stathol [ Fri May 20, 2011 11:14 am ]
Post subject: 

Haha. This is technically impressive, but seriously WTF.

Author:  Rorinthas [ Fri May 20, 2011 9:22 pm ]
Post subject: 

Why? Because you can is not a valid answer.

Author:  shuyung [ Fri May 20, 2011 11:09 pm ]
Post subject: 

History would tend to disagree with you.

Author:  Lex Luthor [ Sat May 21, 2011 2:58 am ]
Post subject:  Re:

Rorinthas wrote:
Why? Because you can is not a valid answer.


Well for one it could be a good way to give a class an introduction on Linux without installing anything on their computers.

Author:  Nevandal [ Sat May 21, 2011 3:47 am ]
Post subject:  Re: Re:

Lex Luthor wrote:
Rorinthas wrote:
Why? Because you can is not a valid answer.


Well for one it could be a good way to give a class an introduction on Linux without installing anything on their computers.


that's what putty is for

Author:  Lex Luthor [ Sat May 21, 2011 11:36 am ]
Post subject:  Re: Re:

Nevandal wrote:
Lex Luthor wrote:
Rorinthas wrote:
Why? Because you can is not a valid answer.


Well for one it could be a good way to give a class an introduction on Linux without installing anything on their computers.


that's what putty is for


Don't you have to download it? And that's not an OS... everything about your post is wrong.

Author:  Nevandal [ Sat May 21, 2011 2:59 pm ]
Post subject: 

I suddenly feel like I'm on an episode of The Big Bang Theory.

Yes, you have to download PuTTY. It's an SSH client.

In my *nix introduction class we used PuTTY to SSH into the Linux server. The class was called "Introduction to *nix" It worked well for this purpose.

Facts:
1. You also have to download Linux in Javascript in order to use it
2. It's not an OS either.
3. everything about your face is wrong.

Author:  Lex Luthor [ Sun May 22, 2011 1:00 pm ]
Post subject:  Re:

Nevandal wrote:
Facts:
1. You also have to download Linux in Javascript in order to use it
2. It's not an OS either.
3. everything about your face is wrong.


1. No you don't, it runs in your browser. If by "download" you mean download the HTML and script files that your browser automatically handles, then you by the same meaning you have to "download" my post to read it. It's a trivial operation.
2. It's an emulated OS.
3. With PuTTY, the students don't get root privileges.

Page 1 of 1 All times are UTC - 6 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/