News for hackers. Stuff that matters.

g3

Yes, I should write about v86's internals some day. Meanwhile, the code is right here: https://github.com/copy/v86/tree/master/src/rust

It's much faster with recompilation than without, but I agree that it's slower than expected (compared to, for example, qemu-tcg).

There is still room for improvements (e.g. eflags updates, 16-bit instructions, call/ret optimisations, main loop), but part of the problem is limitations of web assembly (no mmap, only structured control flow) and browser engines (memory blow up on large generated wasm modules, related to control flow).

The webvm folks explain the control flow problem quite well, and seem to be doing a better job than v86: https://medium.com/leaningtech/extreme-webassembly-1-pushing...

If you're bored (or your code is still compiling), you can also try:

SerenityOS: http://copy.sh/v86/?profile=serenity (one of their developers contributed PAE support to v86, which is extra cool. I believe it contains their own browser.)

ReactOS: http://copy.sh/v86/?profile=reactos

Haiku: https://copy.sh/v86/?profile=haiku

9front: http://copy.sh/v86/?profile=9front

Android: http://copy.sh/v86/?profile=android

KolibriOS: http://copy.sh/v86/?profile=kolibrios

HelenOS: http://copy.sh/v86/?profile=helenos

Oberon: http://copy.sh/v86/?profile=oberon

QNX: http://copy.sh/v86/?profile=qnx

Windows 95 with IE 3: http://copy.sh/v86/?profile=windows95-boot

Windows 98 with IE 5: http://copy.sh/v86/?profile=windows98 (run networking.bat)

Windows 2000 with IE 6: http://copy.sh/v86/?profile=windows2000 (run networking.bat)

v86 running in v86 (the inner one is running in node): https://copy.sh/v86/?profile=archlinux&c=./v86-in-v86.js

As well as most BSDs and Linuxes, as long as they still have i686 support.

It makes for a cool demo (and it's a reference to the recent "wasm in docker" announcement).
Re:SQLite 3 Fiddle on Thursday May 26, 2022 @11:31AM (#31519591)
Or, if you want to go one level deeper, v86 has a complete Linux environment with both python and sqlite running locally: https://copy.sh/v86/?profile=archlinux&c=python%20-ic%20%27i...
Re:WebVM: Server-less x86 virtual machines in the browser on Tuesday February 01, 2022 @07:14PM (#30171724)
v86 also recompiles machine code to web assembly. The main difference is that v86 is a hobby project (of which I'm the original author, by the way), with much fewer contributors and no (known) commercial users, and is much less sophisticated than this project. On the other hand, v86 is open source, so you could make it sophisticated if you wanted to :-)

I'm not sure what exactly cheerps is used for; v86 is mostly used to demo operating systems (mostly hobby and vintage). We recently got SerenityOS to run: http://copy.sh/v86/?profile=serenity

Re:Windows 2000 Running in WebAssembly on Saturday May 29, 2021 @05:22PM (#27328313)
It's the disk access. In order to open My Computer, Windows reads 6399 disk sectors, which are read using ~150 http requests.
Re:Blake 32 on Sunday March 21, 2021 @02:07AM (#26528449)
Re:Show HN: Simple JavaScript Tetris on Wednesday November 02, 2016 @07:58PM (#12860483)
And here is a concise JavaScript tetris (playable: http://copy.sh/tetris/):

    f=[];p=[1];g=h=2;s=0;t=500;for(i=0;23>i;i++)f[i]=j=-16380;f[23]=-1;onkeydown=e;e(e);function e(b,a){(k=b.which)?k-38?k&-3^37||(g+=a=k^37?-1:1):(z=p,v=p[2],c=p[1],p=[2*v&2|4*c&4,p[3]/2&1|v&2|2*c&4|4*p[0]&8,p[3]/4&1|v/2&2|c&4|2*p[0]&8,v/4&2|c/2&4]):s-j&&setTimeout(e,100+t,h++);m=p[0]<<g;l=p[1]<<g;_=p[2]<<g;o=p[3]<<g;f[h+=32==k]&m|f[1+h]&l|f[2+h]&_|f[3+h]&o?a?g-=a:k^38?(f[h]|=l,f[--h]|=m,f[2+h]|=_,f[3+h]|=o,h?(g=6,x=new Date%7*4,p=[h=0,2908739>>x&15,266758006>>x&15],t*=.97):s+=" Game Over!"):p=z:k^32||e(b);for(y=_=o="";24>++y;o+="\n")for(f[y]+4||(f.splice(y,1),f.unshift(j),s+=++_,o="",y=2),x=14;x;q.textContent=o+s)o+=" X"[(f[y]|p[y-h]<<g)>>x--&1]}
Re:Show HN: Windows 98 in browser on Monday February 22, 2016 @11:29PM (#11156560)
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

Re:Minimal Linux Live on Saturday February 14, 2015 @11:00AM (#9049942)
Re:Show HN: I Wanna Be Thy Copy on Saturday July 05, 2014 @06:04AM (#7991484)
Nope, try harder ;)
Re:Show HN: My x86 emulator written in JavaScript on Saturday October 19, 2013 @05:24PM (#6577903)
Both bugs are fixed now.
Re:Show HN: My x86 emulator written in JavaScript on Saturday October 19, 2013 @05:23PM (#6577899)
Fullscreen is there and yes, it will be open source.
Re:Show HN: My x86 emulator written in JavaScript on Friday October 18, 2013 @09:07PM (#6574907)
The project is made with both browser and nodejs support in mind. There are still some issues to resolve, but I will definitely release a node version this year.
Re:Show HN: My x86 emulator written in JavaScript on Friday October 18, 2013 @07:18AM (#6570764)
Hi s-macke. I've read the source code of your emulator before, good job.

I'm aware of the problem with big integers. I'll look into this more closely, thanks for your help.

Regarding workers: I need some restructuring to get this working. I'll also need to figure out the fastest way to exchange the canvas buffer between the worker and the browser.

Re:Show HN: My x86 emulator written in JavaScript on Friday October 18, 2013 @07:08AM (#6570735)
It should be the US keyboard layout, because that's what the operating systems in the emulator use.
Re:Show HN: My x86 emulator written in JavaScript on Friday October 18, 2013 @05:49AM (#6570527)
I got Freedos working about 2 years ago, but then stopped working on it. I picked it up again earlier this year. Approximately 3 months of full time work.

I'm considering writing some articles, just need to find some free time.

Re:Show HN: My x86 emulator written in JavaScript on Thursday October 17, 2013 @06:40PM (#6568654)
Yes, it's very similar to the jslinux project. However, I added more hardware (it can boot a real bios: seabios). Also, I'll make this open source.
Re:Show HN: My x86 emulator written in JavaScript on Thursday October 17, 2013 @06:18PM (#6568543)
Chromium and Firefox send different key codes for `-` and `=` (see http://unixpapa.com/js/testkey.html).

Regarding GPFs: This is one of the few things that are not completely implemented yet, I'm working on figuring this out.

Re:Show HN: My x86 emulator written in JavaScript on Thursday October 17, 2013 @06:11PM (#6568499)
It expects one of the standard formats (720k, 1440k or 2880k). I'll add switching disks some time in the future.
Re:Show HN: My x86 emulator written in JavaScript on Thursday October 17, 2013 @05:59PM (#6568431)
I've found the bug. For now, try Chromium. I'll fix this tomorrow.
Re:Show HN: My x86 emulator written in JavaScript on Thursday October 17, 2013 @05:49PM (#6568367)
It will be open-source. I don't know how to deal with licensing yet.
Re:Show HN: My x86 emulator written in JavaScript on Thursday October 17, 2013 @05:44PM (#6568335)
I'm testing in Firefox 24. If you could tell me what the error console outputs, I'll try to fix it.
Re:Show HN: My x86 emulator written in JavaScript on Thursday October 17, 2013 @05:35PM (#6568289)
Networking is on the todo list. I couldn't host the traffic, though.
Re:Show HN: My x86 emulator written in JavaScript on Thursday October 17, 2013 @05:32PM (#6568278)
I'll put it online soon. I haven't figured licensing out yet and need to write some technical notes

Older »