Giter VIP home page Giter VIP logo

v86's Introduction

Join the chat at https://gitter.im/copy/v86 or #v86 on irc.libera.chat

v86 emulates an x86-compatible CPU and hardware. Machine code is translated to WebAssembly modules at runtime in order to achieve decent performance. Here's a list of emulated hardware:

  • An x86-compatible CPU. The instruction set is around Pentium 4 level, including full SSE3 support. Some features are missing, in particular:
    • Task gates, far calls in protected mode
    • Some 16 bit protected mode features
    • Single stepping (trap flag, debug registers)
    • Some exceptions, especially floating point and SSE
    • Multicore
    • 64-bit extensions
  • A floating point unit (FPU). Calculations are done using the Berkeley SoftFloat library and therefore should be precise (but slow). Trigonometric and log functions are emulated using 64-bit floats and may be less precise. Not all FPU exceptions are supported.
  • A floppy disk controller (8272A).
  • An 8042 Keyboard Controller, PS2. With mouse support.
  • An 8254 Programmable Interval Timer (PIT).
  • An 8259 Programmable Interrupt Controller (PIC).
  • Partial APIC support.
  • A CMOS Real Time Clock (RTC).
  • A generic VGA card with SVGA support and Bochs VBE Extensions.
  • A PCI bus. This one is partly incomplete and not used by every device.
  • An IDE disk controller.
  • An NE2000 (RTL8390) PCI network card.
  • A VirtIO filesystem.
  • A SoundBlaster 16 sound card.

Demos

9frontArch LinuxAndroid-x86 1.6-r2Android-x86 4.4-r2BasicLinuxBuildroot LinuxDamn Small LinuxELKSFreeDOSFreeBSDFiwixOSHaikuSkiffOSReactOSWindows 2000Windows 98Windows 95Windows 1.01MS-DOS 6.22OpenBSDOberonKolibriOSSkiftOSQNX

Documentation

How it worksNetworkingArch Linux guest setupWindows 2000/XP guest setup9p filesystemLinux rootfs on 9pProfilingCPU Idling

Compatibility

Here's an overview of the operating systems supported in v86:

  • Linux works pretty well. 64-bit kernels are not supported.
    • Damn Small Linux (2.4.31 kernel) works.
    • Fedora 30 works.
    • All tested versions of TinyCore work.
    • Buildroot can be used to build a minimal image. humphd/browser-vm and darin755/browser-buildroot have some useful scripts for building one.
    • SkiffOS (based on Buildroot) can cross-compile a custom image.
    • Archlinux works. See archlinux.md for building an image.
    • Debian works. An image can be built from a Dockerfile, see tools/docker/debian/.
    • Ubuntu works up to the latest version that supported i386 (16.04 LTS or 18.04 LTS for some variants).
    • Alpine Linux works.
  • ReactOS works.
  • FreeDOS, Windows 1.01 and MS-DOS run very well.
  • KolibriOS works.
  • Haiku works.
  • Android-x86 has been tested up to 4.4-r2.
  • Windows 1, 3.x, 95, 98, ME, NT and 2000 work reasonably well.
    • In Windows 2000 and higher the PC type has to be changed from ACPI PC to Standard PC
    • There are some known boot issues (#250, #433, #507, #555, #620, #645)
  • Windows XP, Vista and 8 work under certain conditions (see #86, #208)
  • Many hobby operating systems work.
  • 9front works.
  • Plan 9 doesn't work.
  • QNX works.
  • OS/2 doesn't work.
  • FreeBSD works.
  • OpenBSD works with a specific boot configuration. At the boot> prompt type boot -c, then at the UKC> prompt disable mpbios and exit.
  • NetBSD works only with a custom kernel, see #350.
  • SerenityOS works.
  • SkiftOS works.

You can get some information on the disk images here: https://github.com/copy/images.

How to build, run and embed?

You need:

  • make
  • Rust with the wasm32-unknown-unknown target
  • A version of clang compatible with Rust
  • java (for Closure Compiler, not necessary when using debug.html)
  • nodejs (a recent version is required, v16.11.1 is known to be working)
  • To run tests: nasm, gdb, qemu-system, gcc, libc-i386 and rustfmt

See tools/docker/test-image/Dockerfile for a full setup on Debian or WSL.

  • Run make to build the debug build (at debug.html).
  • Run make all to build the optimized build (at index.html).
  • ROM and disk images are loaded via XHR, so if you want to try out index.html locally, make sure to serve it from a local webserver. You can use make run to serve the files using Python's http module.
  • If you only want to embed v86 in a webpage you can use libv86.js. For usage, check out the examples. You can download it from the release section.

Alternatively, to build using docker

  • If you have docker installed, you can run the whole system inside a container.
  • See tools/docker/exec to find Dockerfile required for this.
  • You can run docker build -f tools/docker/exec/Dockerfile -t v86:alpine-3.19 . from the root directory to generate docker image.
  • Then you can simply run docker run -it -p 8000:8000 v86:alpine-3.19 to start the server.
  • Check localhost:8000 for hosted server.

Running via Devcontainer

  • If you are using an IDE that supports Devcontainers, such as Github Codespaces, VSCode Remote Container extension, or possibly others such as Jetbrains IDEA, you can setup the development environment in a Dev container.
  • Follow the instructions from your development environment to setup the container.
  • Run the Task "Fetch images" in order to download images for testing.

Testing

The disk images for testing are not included in this repository. You can download them directly from the website using:

wget -P images/ https://k.copy.sh/{linux3.iso,linux.iso,linux4.iso,buildroot-bzimage.bin,openbsd-floppy.img,kolibri.img,windows101.img,os8.img,freedos722.img}

Run integration tests: make tests

Run all tests: make jshint rustfmt kvm-unit-test nasmtests nasmtests-force-jit expect-tests jitpagingtests qemutests rust-test tests

See tests/Readme.md for more information.

API examples

Using v86 for your own purposes is as easy as:

var emulator = new V86({
    screen_container: document.getElementById("screen_container"),
    bios: {
        url: "../../bios/seabios.bin",
    },
    vga_bios: {
        url: "../../bios/vgabios.bin",
    },
    cdrom: {
        url: "../../images/linux.iso",
    },
    autostart: true,
});

See starter.js.

License

v86 is distributed under the terms of the Simplified BSD License, see LICENSE. The following third-party dependencies are included in the repository under their own licenses:

Credits

More questions?

Shoot me an email to [email protected]. Please report bugs on GitHub.

Author

Fabian Hemmer (https://copy.sh/, [email protected])

v86's People

Contributors

amaanc avatar awalgarg avatar basicer avatar bellenottelling avatar cognitivegears avatar copy avatar cshung avatar davidbullado avatar ernwong avatar filips123 avatar h8liu avatar hello-smile6 avatar ikreymer avatar invernizzi avatar jmezzacappa avatar joeosborn avatar marcinlistkowski avatar nwtgck avatar orklann avatar overdueweevil2 avatar pixelsuft avatar robertaboukhalil avatar russor avatar shuozheli avatar skadisch avatar spetterman66 avatar supermaxusa avatar vdloo avatar viorelcanja avatar ysangkok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

v86's Issues

Running a QBasic program freezes my cursor

The QBasic editor works fine, but if I want to start a program (Shift+F5) it is hanging and also freeze my browser one time. (Has to be a bug in Chrome.) Also not working in IE.

If you want to try it yourself, remove ".jpg" from the attached Floppy disk image and rename it to qbasic.img e.g.

qbasic img

Python 3 fails

Python 3 currently doesn't work in the Archlinux image. It fails with the following exception:

Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 29] Illegal seek

There's a debug build and gdb in the VM, in case someone wants to look into this.

duplicated HDD

When using one hdd image, I get both sda and sdb referencing to the same disk

[    2.175070] sd 0:0:0:0: [sda] 30720 512-byte logical blocks: (15.7 MB/15.0 MiB)
[    2.195071] sd 0:0:1:0: [sdb] 30720 512-byte logical blocks: (15.7 MB/15.0 MiB)

Network support

Network support would be a nice feature. The jor1k project is already running this successfully.

The emulated hardware could be ported from jsmodem (which is based on a UART, which we already have) or written from scratch. In the latter case, a network card that is supported by KolibriOS should be emulated.

Some feature ideas:

  • Internet connection using websockets
  • Local connection between two VM instances
  • Connect on demand (i.e., start the websocket as soon as it's needed, not on boot)
  • Rate limit the connection

Starting of the provided test images fail

Hi,

I cloned the repository, compiled and downloaded the test images from the demo website and put them into the folder images/

The emulator starts but within one seconds the kIPS counter stops with zero and nothing happens. There is no error message. The image seems to be loaded according to Firefox and Chrome. The same happens when you select the file.

My console output in Firefox (debug.html) looks as follows:

Expected declaration but found '/'. Skipped to next declaration. @ http://localhost:8080/v86/v86.css:28
Expected declaration but found '/'. Skipped to next declaration. @ http://localhost:8080/v86/v86.css:29
Expected declaration but found '/'. Skipped to next declaration. @ http://localhost:8080/v86/v86.css:31
Expected declaration but found '/'. Skipped to next declaration. @ http://localhost:8080/v86/v86.css:32
Expected declaration but found '/'. Skipped to next declaration. @ http://localhost:8080/v86/v86.css:33
"[PCI ] PCI: enabled=1 bdf=38 addr=0 80003800"
"[PCI ] PCI: enabled=1 bdf=40 addr=0 80004000"
"[PCI ] PCI: enabled=1 bdf=48 addr=0 80004800"
"[PCI ] PCI: enabled=1 bdf=50 addr=0 80005000"
"[PCI ] PCI: enabled=1 bdf=58 addr=0 80005800"
"[PCI ] PCI: enabled=1 bdf=60 addr=0 80006000"
"[PCI ] PCI: enabled=1 bdf=68 addr=0 80006800"
"[PCI ] PCI: enabled=1 bdf=70 addr=0 80007000"
"[PCI ] PCI: enabled=1 bdf=78 addr=0 80007800"
"[PCI ] PCI: enabled=1 bdf=80 addr=0 80008000"
"[PCI ] PCI: enabled=1 bdf=88 addr=0 80008800"
"[PCI ] PCI: enabled=1 bdf=90 addr=0 80009000"
"[PCI ] PCI: enabled=1 bdf=98 addr=0 80009800"
"[PCI ] PCI: enabled=1 bdf=A0 addr=0 8000A000"
"[PCI ] PCI: enabled=1 bdf=A8 addr=0 8000A800"
"[PCI ] PCI: enabled=1 bdf=B0 addr=0 8000B000"
"[PCI ] PCI: enabled=1 bdf=B8 addr=0 8000B800"
"[PCI ] PCI: enabled=1 bdf=C0 addr=0 8000C000"
"[PCI ] PCI: enabled=1 bdf=C8 addr=0 8000C800"
"[PCI ] PCI: enabled=1 bdf=D0 addr=0 8000D000"
"[PCI ] PCI: enabled=1 bdf=D8 addr=0 8000D800"
"[PCI ] PCI: enabled=1 bdf=E0 addr=0 8000E000"
"[PCI ] PCI: enabled=1 bdf=E8 addr=0 8000E800"
"[PCI ] PCI: enabled=1 bdf=F0 addr=0 8000F000"
"[PCI ] PCI: enabled=1 bdf=F8 addr=0 8000F800"
"[BIOS] Unable to unlock ram - bridge not found"
"[PCI ] PCI: enabled=1 bdf=0 addr=0 80000000"
"[BIOS] Ram Size=0x04000000 (0x0000000000000000 high)"
"[BIOS] malloc preinit"
"[BIOS] Relocating init from 0x000e2d21 to 0x03fe37a0 (size 51092)"
"[BIOS] malloc init"
"[IO ] write port #510 <- 00 (PORT_QEMU_CFG_CTL)"
"[IO ] write port #511 <- 00 (PORT_QEMU_CFG_DATA)"
"[IO ] read port #511 (PORT_QEMU_CFG_DATA)"
"[BIOS] init ivt"
"[RTC ] cmos write index F: 0"
"[BIOS] init bda"
"[BIOS] init bios32"
"[BIOS] init PMM"
"[BIOS] init keyboard"
"[BIOS] init mouse"
"[IO ] write port #00D <- 00 (PORT_DMA1_MASTER_CLEAR)"
"[IO ] write port #0DA <- 00 (PORT_DMA2_MASTER_CLEAR)"
"[IO ] write port #0D6 <- C0 (PORT_DMA2_MODE_REG)"
"[IO ] write port #0D4 <- 00 (PORT_DMA2_MASK_REG)"
"[BIOS] init pic"
"[PIC ] icw1 = 11"
"[PIC ] interrupts are mapped to 8 (master)"
"[PIC ] interrupts are mapped to 70 (slave)"
"[PIC ] icw3: 4"
"[PIC ] icw3: 2"
"[PIC ] icw4: 1"
"[BIOS] math cp init"
"[IO ] write port #61 <- 11 (PORT_PS2_CTRLB)"
"[PIT ] Control: mode=0 ctr=2 read_mode=3 bcd=0"
"[PIT ] counter2 reload=800 tick=1.7164192656729511ms"
"[IO ] write port #61 <- 10 (PORT_PS2_CTRLB)"
"[BIOS] CPU Mhz=9"
"[BIOS] init timer"
"[PIT ] Control: mode=2 ctr=0 read_mode=3 bcd=0"
"[PIT ] counter0 reload=FFFF tick=54.92457840618987ms"
"[RTC ] Periodic interrupt, a=26 t=0.9765625"
"[RTC ] cmos write index D: 2"
"[RTC ] cmos read from index D"
"[BIOS] pci setup"
"[BIOS] === PCI bus & bridge init ==="
"[PCI ] PCI: enabled=1 bdf=0 addr=0 80000000"
"[BIOS] PCI: pci_bios_init_bus_rec bus = 0x0"
"[PCI ] PCI: enabled=1 bdf=0 addr=0 80000000"
"[PCI ] PCI: enabled=1 bdf=8 addr=0 80000800"
"[PCI ] PCI: enabled=1 bdf=10 addr=0 80001000"
"[PCI ] PCI: enabled=1 bdf=18 addr=0 80001800"
"[PCI ] PCI: enabled=1 bdf=20 addr=0 80002000"
"[PCI ] PCI: enabled=1 bdf=28 addr=0 80002800"
"[PCI ] PCI: enabled=1 bdf=30 addr=0 80003000"
"[PCI ] PCI: enabled=1 bdf=38 addr=0 80003800"
"[PCI ] PCI: enabled=1 bdf=40 addr=0 80004000"
"[PCI ] PCI: enabled=1 bdf=48 addr=0 80004800"
"[PCI ] PCI: enabled=1 bdf=50 addr=0 80005000"
"[PCI ] PCI: enabled=1 bdf=58 addr=0 80005800"
"[PCI ] PCI: enabled=1 bdf=60 addr=0 80006000"
"[PCI ] PCI: enabled=1 bdf=68 addr=0 80006800"
"[PCI ] PCI: enabled=1 bdf=70 addr=0 80007000"
"[PCI ] PCI: enabled=1 bdf=78 addr=0 80007800"
"[PCI ] PCI: enabled=1 bdf=80 addr=0 80008000"
"[PCI ] PCI: enabled=1 bdf=88 addr=0 80008800"
"[PCI ] PCI: enabled=1 bdf=90 addr=0 80009000"
"[PCI ] PCI: enabled=1 bdf=98 addr=0 80009800"
"[PCI ] PCI: enabled=1 bdf=A0 addr=0 8000A000"
"[PCI ] PCI: enabled=1 bdf=A8 addr=0 8000A800"
"[PCI ] PCI: enabled=1 bdf=B0 addr=0 8000B000"
"[PCI ] PCI: enabled=1 bdf=B8 addr=0 8000B800"
"[PCI ] PCI: enabled=1 bdf=C0 addr=0 8000C000"
"[PCI ] PCI: enabled=1 bdf=C8 addr=0 8000C800"
"[PCI ] PCI: enabled=1 bdf=D0 addr=0 8000D000"
"[PCI ] PCI: enabled=1 bdf=D8 addr=0 8000D800"
"[PCI ] PCI: enabled=1 bdf=E0 addr=0 8000E000"
"[PCI ] PCI: enabled=1 bdf=E8 addr=0 8000E800"
"[PCI ] PCI: enabled=1 bdf=F0 addr=0 8000F000"
"[PCI ] PCI: enabled=1 bdf=F8 addr=0 8000F800"
"[PCI ] PCI: enabled=1 bdf=0 addr=0 80000000"
"[PCI ] PCI: enabled=1 bdf=8 addr=0 80000800"
"[PCI ] PCI: enabled=1 bdf=10 addr=0 80001000"
"[PCI ] PCI: enabled=1 bdf=18 addr=0 80001800"
"[PCI ] PCI: enabled=1 bdf=20 addr=0 80002000"
"[PCI ] PCI: enabled=1 bdf=28 addr=0 80002800"
"[PCI ] PCI: enabled=1 bdf=30 addr=0 80003000"
"[PCI ] PCI: enabled=1 bdf=38 addr=0 80003800"
"[PCI ] PCI: enabled=1 bdf=40 addr=0 80004000"
"[PCI ] PCI: enabled=1 bdf=48 addr=0 80004800"
"[PCI ] PCI: enabled=1 bdf=50 addr=0 80005000"
"[PCI ] PCI: enabled=1 bdf=58 addr=0 80005800"
"[PCI ] PCI: enabled=1 bdf=60 addr=0 80006000"
"[PCI ] PCI: enabled=1 bdf=68 addr=0 80006800"
"[PCI ] PCI: enabled=1 bdf=70 addr=0 80007000"
"[PCI ] PCI: enabled=1 bdf=78 addr=0 80007800"
"[PCI ] PCI: enabled=1 bdf=80 addr=0 80008000"
"[PCI ] PCI: enabled=1 bdf=88 addr=0 80008800"
"[PCI ] PCI: enabled=1 bdf=90 addr=0 80009000"
"[PCI ] PCI: enabled=1 bdf=98 addr=0 80009800"
"[PCI ] PCI: enabled=1 bdf=A0 addr=0 8000A000"
"[PCI ] PCI: enabled=1 bdf=A8 addr=0 8000A800"
"[PCI ] PCI: enabled=1 bdf=B0 addr=0 8000B000"
"[PCI ] PCI: enabled=1 bdf=B8 addr=0 8000B800"
"[PCI ] PCI: enabled=1 bdf=C0 addr=0 8000C000"
"[PCI ] PCI: enabled=1 bdf=C8 addr=0 8000C800"
"[PCI ] PCI: enabled=1 bdf=D0 addr=0 8000D000"
"[PCI ] PCI: enabled=1 bdf=D8 addr=0 8000D800"
"[PCI ] PCI: enabled=1 bdf=E0 addr=0 8000E000"
"[PCI ] PCI: enabled=1 bdf=E8 addr=0 8000E800"
"[PCI ] PCI: enabled=1 bdf=F0 addr=0 8000F000"
"[PCI ] PCI: enabled=1 bdf=F8 addr=0 8000F800"
"[BIOS] === PCI device probing ==="
"[BIOS] PCI probe"
"[PCI ] PCI: enabled=1 bdf=0 addr=0 80000000"
"[PCI ] PCI: enabled=1 bdf=8 addr=0 80000800"
"[PCI ] PCI: enabled=1 bdf=10 addr=0 80001000"
"[PCI ] PCI: enabled=1 bdf=18 addr=0 80001800"
"[PCI ] PCI: enabled=1 bdf=20 addr=0 80002000"
"[PCI ] PCI: enabled=1 bdf=28 addr=0 80002800"
"[PCI ] PCI: enabled=1 bdf=30 addr=0 80003000"
"[PCI ] PCI: enabled=1 bdf=38 addr=0 80003800"
"[PCI ] PCI: enabled=1 bdf=40 addr=0 80004000"
"[PCI ] PCI: enabled=1 bdf=48 addr=0 80004800"
"[PCI ] PCI: enabled=1 bdf=50 addr=0 80005000"
"[PCI ] PCI: enabled=1 bdf=58 addr=0 80005800"
"[PCI ] PCI: enabled=1 bdf=60 addr=0 80006000"
"[PCI ] PCI: enabled=1 bdf=68 addr=0 80006800"
"[PCI ] PCI: enabled=1 bdf=70 addr=0 80007000"
"[PCI ] PCI: enabled=1 bdf=78 addr=0 80007800"
"[PCI ] PCI: enabled=1 bdf=80 addr=0 80008000"
"[PCI ] PCI: enabled=1 bdf=88 addr=0 80008800"
"[PCI ] PCI: enabled=1 bdf=90 addr=0 80009000"
"[PCI ] PCI: enabled=1 bdf=98 addr=0 80009800"
"[PCI ] PCI: enabled=1 bdf=A0 addr=0 8000A000"
"[PCI ] PCI: enabled=1 bdf=A8 addr=0 8000A800"
"[PCI ] PCI: enabled=1 bdf=B0 addr=0 8000B000"
"[PCI ] PCI: enabled=1 bdf=B8 addr=0 8000B800"
"[PCI ] PCI: enabled=1 bdf=C0 addr=0 8000C000"
"[PCI ] PCI: enabled=1 bdf=C8 addr=0 8000C800"
"[PCI ] PCI: enabled=1 bdf=D0 addr=0 8000D000"
"[PCI ] PCI: enabled=1 bdf=D8 addr=0 8000D800"
"[PCI ] PCI: enabled=1 bdf=E0 addr=0 8000E000"
"[PCI ] PCI: enabled=1 bdf=E8 addr=0 8000E800"
"[PCI ] PCI: enabled=1 bdf=F0 addr=0 8000F000"
"[PCI ] PCI: enabled=1 bdf=F8 addr=0 8000F800"
"[BIOS] Found 0 PCI devices (max PCI bus is 00)"
"[BIOS] === PCI new allocation pass #1 ==="
"[BIOS] PCI: check devices"
"[BIOS] === PCI new allocation pass #2 ==="
"[BIOS] PCI: No VGA devices found"
"[BIOS] No apic - only the main cpu is present."
"[BIOS] init ACPI tables"
"[BIOS] Scan for VGA option rom"
"[BIOS] Running option rom at c000:0003"
"[BIOS] Start SeaVGABIOS (version rel-1.7.3-74-g3061815-dirty-20131005_235930-eevee)"
"[PCI ] PCI: enabled=1 bdf=0 addr=0 80000000"
"[BIOS] VBE DISPI: lfb_addr=e0000000, size 8 MB"
"[BIOS] Removing mode 11c"
"[BIOS] Removing mode 11d"
"[BIOS] Removing mode 11e"
"[BIOS] Removing mode 11f"
"[BIOS] Removing mode 147"
"[BIOS] Removing mode 17e"
"[BIOS] Removing mode 17f"
"[BIOS] Removing mode 180"
"[BIOS] Removing mode 181"
"[BIOS] Removing mode 182"
"[BIOS] Removing mode 183"
"[BIOS] Removing mode 184"
"[BIOS] Removing mode 185"
"[BIOS] Removing mode 186"
"[BIOS] Removing mode 187"
"[BIOS] Removing mode 188"
"[BIOS] Removing mode 189"
"[BIOS] Removing mode 18a"
"[BIOS] Removing mode 18b"
"[BIOS] Removing mode 18c"

Add save/restore state

Saving and restoring the state of the emulator would be a nice feature to have, it could be used to skip long boot times if the memory size isn't too big.

The state could be captured by saving: The memory, the CPU state, and the state of all devices. Before doing so, all transfers between the emulator and the outside world (such as XHRs) need to have finished.

FPU FWAIT instruction

Hello :)

I'm reading this : https://github.com/copy/v86/blob/master/src/fpu.js#L641
And the FWAIT instruction have "TODO".

I don't have a deep understanding of your code and there might be some stuff i don't understand with setTimeout(function() { cpu.main_run(); }, 0); but, to me it seems that FPU instructions are guaranteed to be atomic and uninterruptible (in the emulator, not on real hardware).

So, isn't it just a NOP and there is absolutely nothing to implement ?

Thx :)

Use `performance.now`

Some devices (such as PIT and RTC) would profit from the higher precision provided by performance.now (over Date.now). A shim is already available here.

The TSC register could also be rewritten to use it.

Xorg unable to start in the Archlinux profile under Google Chrome 41

Odd issue in Chrome 41 - startx fails under the arch linux profile. Starting X works fine under firefox. Error log is as follows:

[  1558.254] 
X.Org X Server 1.17.1
Release Date: 2015-02-10
[  1558.301] X Protocol Version 11, Revision 0
[  1558.318] Build Operating System: Linux 3.18.6-1-ARCH i686 
[  1558.360] Current Operating System: Linux nyu 3.18.6-1-ARCH #1 SMP PREEMPT Sat Feb 7 08:59:29 CET 2015 i686
[  1558.378] Kernel command line: BOOT_IMAGE=../vmlinuz-linux apm=off vga=0x343 video=vesafb:ypan,vremap:8 root=host9p rootfstype=9p rootflags=trans=virtio  quiet initrd=../initramfs-linux.img
[  1558.456] Build Date: 14 March 2015  06:47:44PM
[  1558.466]  
[  1558.487] Current version of pixman: 0.32.6
[  1558.546]    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
[  1558.568] Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[  1558.948] (==) Log file: "/var/log/Xorg.0.log", Time: Thu Mar 19 15:13:07 2015
[  1560.793] (==) Using config file: "/etc/X11/xorg.conf"
[  1560.832] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[  1560.990] (==) ServerLayout "X.org Configured"
[  1560.997] (**) |-->Screen "Screen0" (0)
[  1561.005] (**) |   |-->Monitor "Monitor0"
[  1561.057] (**) |   |-->Device "Card0"
[  1561.061] (**) |-->Input Device "Mouse0"
[  1561.063] (**) |-->Input Device "Keyboard0"
[  1561.072] (==) Automatically adding devices
[  1561.074] (==) Automatically enabling devices
[  1561.077] (==) Automatically adding GPU devices
[  1561.254] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/OTF/".
[  1561.260]    Entry deleted from font path.
[  1561.268]    (Run 'mkfontdir' on "/usr/share/fonts/OTF/").
[  1561.294] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/Type1/".
[  1561.302]    Entry deleted from font path.
[  1561.307]    (Run 'mkfontdir' on "/usr/share/fonts/Type1/").
[  1561.356] (**) FontPath set to:
    /usr/share/fonts/misc/,
    /usr/share/fonts/TTF/,
    /usr/share/fonts/100dpi/,
    /usr/share/fonts/75dpi/,
    /usr/share/fonts/misc/,
    /usr/share/fonts/TTF/,
    /usr/share/fonts/100dpi/,
    /usr/share/fonts/75dpi/
[  1561.360] (**) ModulePath set to "/usr/lib/xorg/modules"
[  1561.364] (WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
[  1561.372] (WW) Disabling Mouse0
[  1561.374] (WW) Disabling Keyboard0
[  1561.383] (II) Loader magic: 0x829e700
[  1561.385] (II) Module ABI versions:
[  1561.387]    X.Org ANSI C Emulation: 0.4
[  1561.390]    X.Org Video Driver: 19.0
[  1561.393]    X.Org XInput driver : 21.0
[  1561.394]    X.Org Server Extension : 9.0
[  1563.042] (II) systemd-logind: took control of session /org/freedesktop/login1/session/c1
[  1563.137] (--) PCI:*(0:0:18:0) 10de:0a20:0000:0000 rev 162
[  1563.174] (WW) Open ACPI failed (/var/run/acpid.socket) (No such file or directory)
[  1563.221] (II) "glx" will be loaded. This was enabled by default and also specified in the config file.
[  1563.227] (II) LoadModule: "glx"
[  1563.400] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[  1566.921] (II) Module glx: vendor="X.Org Foundation"
[  1566.927]    compiled for 1.17.1, module version = 1.0.0
[  1566.931]    ABI class: X.Org Server Extension, version 9.0
[  1566.933] (==) AIGLX enabled
[  1566.940] (II) LoadModule: "fbdev"
[  1567.128] (II) Loading /usr/lib/xorg/modules/drivers/fbdev_drv.so
[  1567.263] (II) Module fbdev: vendor="X.Org Foundation"
[  1567.266]    compiled for 1.17.0, module version = 0.4.4
[  1567.269]    Module class: X.Org Video Driver
[  1567.271]    ABI class: X.Org Video Driver, version 19.0
[  1567.277] (II) FBDEV: driver for framebuffer: fbdev
[  1567.282] (++) using VT number 1

[  1567.284] (--) controlling tty is VT number 1, auto-enabling KeepTty
[  1567.291] (II) Loading sub module "fbdevhw"
[  1567.298] (II) LoadModule: "fbdevhw"
[  1567.442] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so
[  1567.570] (II) Module fbdevhw: vendor="X.Org Foundation"
[  1567.576]    compiled for 1.17.1, module version = 0.0.2
[  1567.580]    ABI class: X.Org Video Driver, version 19.0
[  1567.591] (**) FBDEV(0): claimed PCI slot 0@0:18:0
[  1567.599] (II) FBDEV(0): using default device
[  1567.607] (==) FBDEV(0): Depth 24, (==) framebuffer bpp 32
[  1567.611] (==) FBDEV(0): RGB weight 888
[  1567.613] (==) FBDEV(0): Default visual is TrueColor
[  1567.619] (==) FBDEV(0): Using gamma correction (1.0, 1.0, 1.0)
[  1567.622] (II) FBDEV(0): hardware: VESA VGA (video memory: 8192kB)
[  1567.625] (II) FBDEV(0): checking modes against framebuffer device...
[  1567.628] (II) FBDEV(0): checking modes against monitor...
[  1567.631] (--) FBDEV(0): Virtual size is 800x600 (pitch 800)
[  1567.637] (**) FBDEV(0):  Built-in mode "current": 48.0 MHz, 46.9 kHz, 75.1 Hz
[  1567.644] (II) FBDEV(0): Modeline "current"x0.0   48.00  800 832 928 1024  600 604 608 624 -hsync -vsync -csync (46.9 kHz b)
[  1567.649] (==) FBDEV(0): DPI set to (96, 96)
[  1567.651] (II) Loading sub module "fb"
[  1567.653] (II) LoadModule: "fb"
[  1567.813] (II) Loading /usr/lib/xorg/modules/libfb.so
[  1568.323] (II) Module fb: vendor="X.Org Foundation"
[  1568.326]    compiled for 1.17.1, module version = 1.0.0
[  1568.328]    ABI class: X.Org ANSI C Emulation, version 0.4
[  1568.331] (**) FBDEV(0): using shadow framebuffer
[  1568.335] (II) Loading sub module "shadow"
[  1568.338] (II) LoadModule: "shadow"
[  1568.480] (II) Loading /usr/lib/xorg/modules/libshadow.so
[  1568.628] (II) Module shadow: vendor="X.Org Foundation"
[  1568.634]    compiled for 1.17.1, module version = 1.1.0
[  1568.636]    ABI class: X.Org ANSI C Emulation, version 0.4
[  1568.639] (==) Depth 24 pixmap format is 32 bpp
[  1568.651] (EE) FBDEV(0): FBIOBLANK: Invalid argument
[  1568.774] (==) FBDEV(0): Backing store enabled
[  1568.843] (==) FBDEV(0): DPMS enabled
[  1568.860] (==) RandR enabled
[  1572.702] (II) AIGLX: Screen 0 is not DRI2 capable
[  1572.708] (EE) AIGLX: reverting to software rendering
[  1596.285] (II) AIGLX: Loaded and initialized swrast
[  1596.287] (II) GLX: Initialized DRISWRAST GL provider for screen 0
[  1604.800] (EE) 
Fatal server error:
[  1604.806] (EE) could not open default font 'fixed'(EE) 
[  1604.818] (EE) 
Please consult the The X.Org Foundation support 
     at http://wiki.x.org
 for help. 
[  1604.829] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[  1604.835] (EE) 
[  1605.980] (EE) Server terminated with error (1). Closing log file.


Get up-to-date disk images automatically from developer websites

This is only a suggestion (enhancement). For example, in KolibriOS we have an auto-build script that produces a new OS image every time a commit is made to our SVN. Your copy of KolibriOS image is half-year old already - we have fixed and changed a few things since then.

So instead of getting a new image manually once in a while (every few months?), maybe you can update it automatically whenever it's created? Or even better, instead of hosting the image locally on your server, just link to latest image on our server, so that each time a user starts KolibriOS VM, it would be always started with latest version.

Or you can try to load the image from our server as a primary option, and revert to using locally stored image as a fallback option in case our server is not available...

HDD & CDROM

hi everyone,

its not possible to use CDROM and HDD at the same time.

If i select my ISO and my HDD it tries to boot from the hdd.

CPU frequency is reported as 0 when measured using RDTSC

KolibriOS uses RDTSC to calculate CPU frequency. In your emulator, the CPU frequency is reported as 0 (0000 MHz - see attached screenshot). On real machines, the actual CPU frequency is reported. In other emulators (VMware, Oracle VirtualBox, QEMU, BOCHS) the frequency reported might be wrong (since the emulator is not running at the same speed as the host machine), but it's still not 0.

It's very much preferred not to report 0 since it affects some KolibriOS programs (Process Manager reports wrong CPU usage, Ghost Monitor thinks that CPU usage is always 100%, CPUID reports CPU speed as 0 MHz etc.)

screenshot342

VM using 100% CPU on Linux 3+

This doesn't happen using linux.iso. Low CPU usage is very important to me, do you know why this happened? Is the kernel configuration available?

Some functional keys are not passed to the guest systems

Some functional keys are not passed to the guest systems. For example, KolibriOS uses:

  • WIN key to open the "Start Menu". When this key is pressed right now, the "Start Menu" opens in the host system (Windows)
  • F5 key to copy files from one folder to another in the file managers. When this key is pressed right now, browser just reloads the page
  • ALT+TAB to switch between opened windows. When this key is pressed right now, it switches between windows in the host system.
All this happens even in "Full Screen" mode. I suggest that those keys are either passed to guest system (at least in Full Screen" mode it makes sense), or they are added to the buttons above the guest (similar to "Send CTRL+ALT+DEL" that is there now).

Version information in build

It is quite confusing that one never knows which actual version is only on copy.sh... I was thinking maybe the Makefile could be modified so that information about the git hash and whether the tree is dirty could be built into the generated files, like it is with e.g. Linux. What do you think? I could try to implement this if you approve.

Foreign keyboard errors

Host: OS X Yosemite, French (numerical) keyboard, Chrome
Images: tested with Archlinux & Busybox

Letters and numbers work properly, but other characters such as "." or "/" are not mapped correctly, which renders the shell basically unusable. Fixed by switching the Host OS in English input method.

Thanks!

Linux uses PIO instead of DMA

A problem in the IDE controller causes Linux (tested on a 2.4 and a 3.x kernel) to use PIO mode instead of DMA. This is the case both for ATAPI commands (send using ATA_CMD_PACKET) and the standard ATA commands.

DMA could improve disk transfer speed dramatically.

Provide bootable image with 9p support

I want to use the 9p filesystem and inject files into it. To inject files, I need to get the emulator instance. The Arch Linux demo is, AFAIK, the only one that features 9p support, however, it only works with the production build, which uses the closure compiler, which means I cannot get the emulator instance (since I don't know how it was mangled).

I can also build the image myself, maybe you have recommendations on how to do this? I imagine that I only need to build a new kernel, since I can use the userland from ttylinux or the linux26 image.

Fix IDE slave

In ide.js, all requests are handled by the same device, even if the slave bit is set.

The code has to be split up into controller (of which we have one or more) and device (of which we have two per controller).

User interface

The user interface would benefit from a review, I believe.

Any ideas? Opinions?

Why use C macros?

Hi copy,

Why do you use C macros? Or in other words, why not write it just in javascript? Is it for better performance? Or is it just for your own convenience?

Problem with load simple x86 OS

Hi, thank you for such interesting project. Could you please help me?
When I try to load floppy image of my os nothing happens and console show next error:

Uncaught Unimplemented: Unknown floppy size: 4E00 

Thing is image size is smaller then 1.4 Mb but everything works fine on jemul8.

When I try to load full 1.4 image size, then this error occures:

Uncaught RangeError: Maximum call stack size exceeded

You could get image from url.

Thank you.

Add files to filesystem from browser

It would be really nice if there was a way to upload files to the home directory, like in jor1k. I think the same FS API is used, so it shouldn't be too hard. In jor1k, this works:

jor1kgui.message.Send('MergeFile', {
          name: ascii_filename,
          data: Uint8Array_instance
      });

Create libv86.js

We should create a build target for libv86.js, which would allow people to use the emulator without building it.

The build shouldn't include adapters (or code from browser/ or node/), since they are directly related to what the emulator is used for.

Files put in 9p don't appear in Linux

I got 9p working alright, but the files I put there after creation of the filesystem are not visible.

For example, go here:
http://xn--kn-1ia.guru/9pdemo/basic.html

wait for it to boot and do "ls". Now choose a file and do "ls" again. The file is not visible. In jor1k this works. If I do emulator.read_file("/filename.txt", function(err, uint8array) {if (err) console.error(err); console.log(uint8array)}), I get the contents; so I know the uploading is working.

Archlinux seemingly not working locally with current master

Which version is in service on copy.sh/v86? I'm trying to get Archlinux running locally, but I get the error: "Cannot read property 'length' of undefined" on state.js:338, which means that buffer_infos is missing. I suspect this is because the snapshot format changed after the snapshot was made. If I can check out the old version locally, I assume I could get the snapshot to run.

Thank you.

initial_state

How does this work? When I add to the settings

        initial_state: {
            url: "./images/v86state.bin",
        },

I get

Uncaught TypeError: Cannot read property 'za' of undefined
Ge  @   libv86.js:387
Ge  @   libv86.js:387
He  @   libv86.js:391
(anonymous function)    @   libv86.js:420

Change removable media (floppy and cdrom) while running

When using this emulator to run Windows XP, I encounter the program "setup". However, it tells me to insert the next image into drive A. Where's Drive A? Jamming a 1.44MB floppy into my laptop would probably destroy my computer and not help at all. So is there a way?

A possible solution is to upload the images into / (maybe A:) but I haven't had any luck using the filesystem yet...

Thank you in advance.

cpp fail on mac

I don't understand why yet, but when i run make, cpp generate tons of warning and errors and ultimaly fail.

Itworks when i modify the Makefile and force usage of mcpp.

I'll provide more information ASAP. See you soon.

SSE

The following applications currently don't work because of missing support for SSE.

  • Nodejs (older versions work)
  • Golang

Implement VGA Mode X

Hello.
I gived a try with this emulator.
I created many bootabla IMG disks with both, FreeDOS and MS-DOS.
FreeDOS and MS-DOS 3.3/6.x are starting up correctly, when Win 95/98 boot disks are not working.
So, I decided to check out some dos games.
On created before FreeDOS and MS-DOS bootable images I added following games: Ninja, Bruce Lee, Golden Axe, Lotus 3 - all of them are simple and work even on real 286 machine.
When I run every of these games, then screen goes 320x200 graphic mode, shows black screen and nothing more happens.
I am very surprised, because like I said, these are simple games which run on 286 computers, and you mention that this emulator is near Pentium 1 machine.
I wonder if there is something to do with emulated graphic hardware?
Thanks for any reply.

Double granularity

op_DF_mem methods both in fpu.macro.js and cpu.js uses comparison with 0x7FFF FFFF FFFF FFFF and -0x8000 0000 0000 0000. The javascript Number (actually, "double") granularity is not enough to represent such integers. Actually, the biggest "safe" integer in js is 0x0020 0000 0000 0000. As I understand, this could lead to errors.

Report more useful infos in cpuid

Except for some feature bits, the current data reported by cpuid is hardly useful. We need to research, how fields like cache size are used by the OS. Perhaps the result should be configurable.

DynamicTranslator not defined?

Tried to clone this fresh and build it today, using the closure-compiler submodule, and got this error:

cpu.js:2994: ERROR - variable DynamicTranslator is undeclared
        this.translator = new DynamicTranslator(this);

Indeed, it appears to be used, but not defined anywhere in the source:

https://github.com/copy/v86/search?q=DynamicTranslator

I guess the problem is, even though OP_TRANSLATION is false, the closure compiler doesn't know that statically, so it still looks for a definition for DynamicTranslator.

I can work around it by commenting that line out (it compiles OK after that) but obviously it would be nicer to handle this automatically (maybe define a dummy DynamicTranslator class when!OP_TRANSLATION?)

VM using 100% CPU

I wonder how do you avoid 100% CPU (on one core) with Linux, all the Linux images (2.6.x and 3.x) on copy.sh use 100% and my self compiled kernel with CONFIG_NO_HZ_IDLE=y and HZ=50 too, on both firefox and chromium.

9p can't mount twice

If I mount the 9p volume, reboot, and try to mount again, I get "no channels available".

Run the CPU in a web worker

The jor1k guys do this too: Run the CPU and devices code in a web worker, saving the time for rendering. For graphical modes, this requires a significant amount of data to be transferred between the worker and the window, so it might not actually be faster (needs to be researched).

This requires some significant changes in the code, including some sort of abstraction between the code that will run in the worker and the code that will run in the window.

Smarter `hlt_loop`

hlt_loop is ineffective, because it always waits for 4ms after calling the timers. Instead, it should ask the devices when they need their timer function to be called and wait as long as necessary.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.