nepx / halfix

x86 PC emulator that runs both natively and in the browser, via WebAssembly
https://nepx.github.io/halfix-demo/
GNU General Public License v3.0
669 stars 86 forks source link

Exploring halfix with emulation of web browsers #16

Open ikreymer opened 3 years ago

ikreymer commented 3 years ago

This is more a question / inquiry about using halfix.

I've just released an updated version of https://oldweb.today (https://github.com/oldweb-today/oldweb-today), which runs several browsers in JS-based emulators to run old browsers, connected to web archives. The system connects to a custom network stack, also running in the browser. Currently, I'm using v86 and basilisk emulators, and it would be neat to also add halfix, eventually.

I'd in trying out Halfix, if it can support more recent browsers, especially ones that can run Flash, probably a later version of Firefox. So far, I haven't been able to get it to load a Win98 image, though it did load WinXP. To make this performant, would also need to have save state / load state working..

I'm curious what combinations of browsers have been tested and do work well..

nepx commented 3 years ago

Hi,

I haven't tried many browsers yet due to the lack of Internet connectivity in the emulator, but I have been able to run a few:

Likely more can run, but again, they haven't been my focus.

Savestate support was implemented from the beginning, although it was mostly for debugging purposes (didn't want to wait hours for Windows 7 to boot to reproduce one tiny bug) and it works extremely well if you use it correctly. One nice thing is that it only downloads the device state and the RAM images on startup and the disk chunks are only loaded as needed. That's definitely something that I want to look at in the future.

The part about not being able to boot Win98 is strange -- my installation runs quite well. If you used the disk image from v86, you might have to enable PCI VGA, which is disabled by default because it slows down VGA BIOS performance (most OSes do fine with it off). You could also try using SeaBIOS/SeaVGABIOS, again with PCI VGA on. I haven't tested this, though.

ikreymer commented 3 years ago

Thanks for sharing the examples!

Unfortunately, I haven't been able to run any Win98 image that I have so far, either with the bochs or the seagate bios. It goes to an empty screen followed by 'Windows Protection Error' message. This is both in emscripten and native builds. I enabled the Plug-and-Play BIOS to 'PCI Bus', which was necessary to get the network card to work in QEMU and v86.. Perhaps that is the issue? Happy to share an image that repros the issue.

nepx commented 3 years ago

Where did you get the image? I have an older image that I used to test it (installed fresh on Bochs), and it works. It might be the hardware (PnP or network card), actually -- the network card hasn't been tested yet. 98 has historically been difficult to work with, especially with regards to hardware: https://github.com/nepx/halfix/commit/44480fc60d17e4058e2db332bebec8d2f94540e1

ikreymer commented 3 years ago

Where did you get the image?

I built it from Win98 SE ISO in QEMU.

Re: networking, it looks like ne2000.c is not actually part of the build in hardware_files.json, and ne2000_init is not called anywhere. Though, netdrv.c in core-files.json, but is not in the repo.. Is NE2000 disabled for now, or just an oversight in committing it? (I tried adding it manually and it did show up in Win2K, though appear to be PCI conflicts so far, and hitting an assertion in pci_write)

ikreymer commented 3 years ago

Just a quick update, I've made significant progress on getting ne2k working in Win2k. It's being detected and is able to exchange IP packets, and (sometimes) get DHCP assignment. TCP doesn't appear to be working, yet. The work (+misc fixes to build on osx) can be found here: https://github.com/ikreymer/halfix/blob/ne2k-work/src/hardware/ne2000.c

I'm hoping that it's pretty close to fully working, mostly have been comparing to the QEMU and v86 implementation and filling in what's missing

ikreymer commented 3 years ago

An update on network driver. After much debugging, I was able to make more progress on both the BasicLinux example, and Win2k!

I can clean up my changes and make a PR if you'd like..

vackyton commented 3 years ago

whaats the online link