What does HackerNews think of v86?

x86 virtualization in your browser, recompiling x86 to wasm on the fly

Language: JavaScript

#1 in Emulator
If Ethereum was a website, it would be running an x86 VM (such as [1]), running a custom web browser and database engine, to display mostly static websites and the occasional comments section under a blog post.

As an engineer I'm 10% fascinated and 90% horrified by the sheer complexity.

[1] https://github.com/copy/v86

... there's a VM on here?! (Start menu > Programs > Doom Linux) That got a real belly laugh out of me. Looks like https://github.com/copy/v86?

Awesome work! The whole aesthetic is well done.

One that comes to mind is the WASM port of FFmpeg:

https://github.com/ffmpegwasm/ffmpeg.wasm

Another is the SQLite WASM project:

https://sqlite.org/wasm/doc/trunk/index.md

Also v86 for x86 machine virtualization in the web browser:

https://github.com/copy/v86

A fun project is WASM-4, for building retro-style games:

https://wasm4.org/

Possibly more interesting projects to be found here:

https://github.com/topics/wasm

https://github.com/mbasso/awesome-wasm

I'd love to integrate this into my desktop environment in the browser "OS" (https://github.com/DustinBrett/daedalOS). I already have v86 (https://github.com/copy/v86) for running general x86 iso/bin files and BoxedWine (http://www.boxedwine.org/) for 16/32 bit exe's. It would be cool to be able to drag and drop a Linux binary and just run it. I tried to do this with box86js (https://github.com/raoofha/box86js) but had little luck. Although as a non-Linux user, I am not sure where to get good examples/tests of binaries.
And the whole story seems to be here (available via the Exit button from any of those pages): https://copy.sh/v86/ and https://github.com/copy/v86
Wow - this is crazy timing!

I came across this site sometime ago - but didn't bookmark it.

Just a few hours ago - I found some similar resources and wished I'd bookmarked this list.

And here it is!

Anyway, here's my list on the same theme: Systems running in a browser.

  https://simone.computer/#/webdesktops
  https://github.com/copy/v86
  https://github.com/syxanash/awesome-web-desktops
  https://en.wikipedia.org/wiki/Web_desktop
  https://github.com/zriyansh/awesome-os
  https://github.com/jeffpar/pcjs
  https://github.com/whscullin/apple2js
  https://github.com/felixrieseberg/macintosh.js
  https://github.com/felixrieseberg/windows95/
  https://github.com/1j01/98
Thanks for supplementing my notes stranger!
Someone else linked https://github.com/copy/v86 which seems really neat.

I like making jokes with coworkers about implementing this or that bit of infra with WASM-based tools mostly to get a rise out of them but each time I make the joke I look into some of the tools or projects and the balance of joke to "I'm actually serious" shifts a little bit to the right.

Have you seen https://copy.sh/v86/ ? It doesn't run as fast as jslinux but is BSD Licensed, on Github, and supports resuming the VM from a snapshot.

https://github.com/copy/v86

This is quite impressive. I've never heard of WebVM/CheerpX before. I wonder how it compares to v86[0].

[0]: https://github.com/copy/v86

> How much work was done supporting the VM

All of the heavy lifting here is done by v86: https://github.com/copy/v86

v86 can be used for a number of things besides Postgres - things like Repls or other entire applications are definitely achievable.

Networking between Postgres and the internet was a lot of work, and Mark came up with a neat solution detailed in the blog post. This solution can be used for any other application. If you're looking to run a native application in the browser using v86, the repo & blog post is a good launching pad.

One of the things I love from this post is the collaboration on this kind of OSS projects.

Making Postgres Wasm helped:

- v86[0] to find a new bug

- Providing a great deep-dive article that will trigger new ideas in the future

- Showcase the possibilities of Wasm and how you can overcome the current challenges

I really appreciate these projects are OSS :)

Congratulations for the project!

[0] https://github.com/copy/v86

This is a nice overview on how to achieve just-in-time compilation in Wasm, and the demo is pretty cool. Good work!

We use similar techniques to power Webvm[1], an X86 Virtual Machine that runs linux programs in the browser.

A proper Wasm JIT API in JavaScript would be even better of course, but as the article says, cool things are already possible right now.

I expect to see more projects doing Wasm just-in-time compilation in the future (I believe that V86[2] also already does it)

[1]: https://webvm.io/

[2]: https://github.com/copy/v86

> Windows 98 in a browser

This might be a good start:

https://copy.sh/v86/?profile=windows98

The emulation has load/save state (.bin file), and apparently includes a floppy disk controller.

https://github.com/copy/v86

I'm investigating v86 [1] (x86-compatible CPU and hardware emulator in JS) to get a c compiler in the browser. There's an example with a 5.5 mb Build Root Linux example [2] where you can pass files and commands between the browser and vm. The vm boots within a few seconds in Firefox on my Pixel 2 XL. There's also an example where Lua code is passed from the host, but you have to download the GitHub repo to see it [3]

It likely isn't suited for compiling big c programs, but I think one can get far with preparing a few shared libraries and Tiny C Compiler or similar.

[1] https://github.com/copy/v86

[2] https://copy.sh/v86/?profile=buildroot

[3] https://github.com/copy/v86/blob/master/examples/lua.html

This is quite impressive.

I would love to see if we can have something similar that doesn't require JS at all, so we can execute x86 programs server-side just using Wasm translation (hi Wasmer).

Here's another interesting project I found recently that I think fits as well on the asm2wasm translation mechanism: https://github.com/copy/v86/

This is based on the v86 emulator which is a relatively feature complete emulator based on javascript: https://github.com/copy/v86

Not sure what the mac versions are using though.

This Electron app is based on https://github.com/copy/v86/ ("x86 virtualization in JavaScript, running in your browser and NodeJS")
This is based on the javascript x86 emulator https://github.com/copy/v86/ , which has demos online running many older operations systems like Windows 1.01
Glad to see an Electron application that finally has a decent, native-looking, unsurprising UI :-).

(Edit: sadly, I'm only half-joking. I was thinking about how fun it would be to extend this so as to bridge the host and the guest via e.g. a socket, so that I could get notifications about UI events inside the machine on the host, which would give me Visual Basic 6's UI builder and all the greatness of a 21st century machine, so that I could finally whip up an UI without yelling profanities at the CSS reference and in less than umpteen hours of tinkering with stuff that clearly just wasn't built for this. Thing is, halfway through, I really began thinking this might make sense a little and that depresses me. /done editing)

That being said, if anyone's curious what else can be achieved in this manner, there's a bunch of nice demos here: https://github.com/copy/v86 .

That is a valid point -- I had to get quite used to git rebase while making the initial gitorials =) If all you need to modify is the commit messages, this tool apparently is a nice option:

https://bokub.github.io/git-history-editor/

In the future, I'd like to extend the shell tool to have a nice "edit mode" that runs git rebase underneath. I haven't thought through how to deal with merge conflicts, though.

Being able to run the tutorials online would be ideal, but that will require a full-fledged OS to run the project. That could be done server-side with a sandboxed OS ($$$) or, intriguingly, perhaps it could be done entirely client-side using an in-browser Linux emulator:

https://github.com/copy/v86

Yep, v86 [0] is what you're looking for!

There's even a demo with Linux 3. [1]

[0] https://github.com/copy/v86 [1] https://copy.sh/v86/?profile=linux3

Ah nice. I know of Fabien (copy) from his v86 work which is a very complete x86/PC peripheral emulator written in JS.

https://github.com/copy/v86

It's a fully emulated PC: CPU, memory, hard drive, … The CPU especially took me very long to get right with all the details to run Windows 98.

The code is here: https://github.com/copy/v86

That's sweet, here's one in pure JavaScript and HTML5 for x86 that runs linux (GUI included) and windows http://copy.sh/v86/ , source code here: https://github.com/copy/v86

The CPU code is pretty cool https://github.com/copy/v86/blob/master/src/cpu.js

Depending what you want to do, there is also the OR1K Emulator running Linux - http://jor1k.com and a generic x86 emulator - v86 - https://github.com/copy/v86

you can check a small benchmark here: https://github.com/s-macke/jor1k/wiki/Benchmark-with-other-e...

via https://news.ycombinator.com/item?id=10498305

Author of the repo here. I didn't expect to see this come up again, it was a weekend project done years ago while I was studying x86 internals and emulation.

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!

As the developer of jor1k I agree. You should also mention https://github.com/copy/v86 , which is constantly developed.