Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boot Windows XP #86

Closed
Creeper20428 opened this issue Feb 29, 2016 · 94 comments
Closed

Boot Windows XP #86

Creeper20428 opened this issue Feb 29, 2016 · 94 comments

Comments

@Creeper20428
Copy link

Windows XP and OS/2 don't boot because of an unhandled double fault exception.

At the page fault handler, I tried doing this:

if(this.page_fault)
    {
        dbg_trace(LOG_CPU);
        //throw this.debug.unimpl("Double fault");
        this.interrupt(6, false, false); // I also fiddled around with these:
/*
this.interrupt(6, false, true);
this.interrupt(6, true, true);
this.interrupt(6, true, false);
*/
    }

but then there were more #GP exceptions and it would have triple-faulted anyways.

It would be really cool to see Windows or OS/2 booting.

@copy
Copy link
Owner

copy commented Feb 29, 2016

Windows XP and OS/2 don't boot because of an unhandled double fault exception.

It's not the double fault exception that causes this. The double fault shouldn't happen in the first place. If you want to see how far Windows XP gets, set ENABLE_ACPI to true here. It's experimental and will cause some other OSes to stop working. After that Windows XP gets stuck on a black screen. The APIC needs some more work.

What version of OS/2 are you testing? If possible, can you upload a disk image?

I have managed to get Windows NT 4.0 to start properly in copy.sh if you want to see a Windows NT-based operating system working in it, you can use NT 4.0. Just letting you know!

That's very cool, I'm also testing a (probably different) version of Windows NT and it doesn't work for me. Did you apply some fixes? Can you upload a disk image somewhere?

@Creeper20428
Copy link
Author

I'm guessing that the ACPI interpreter is failing (it's very strict, according to what I heard).
According to osdev.org, the ACPI tables seem to be very complex.
Couldn't we just copy the tables from an emulator like Bochs and insert it into the memory? Something like this:
if(ENABLE_ACPI){ cpu.memory.u8.set([ 1, 2, 3, 4, cpu.something | someValue, ...], 0x1234567]); }
These are tables, after all. How hard could it be to copy tables?

BTW I am using OS/2 Warp 4.52 (I think). I created the disk image in QEMU and I'll try to upload it somewhere. There used to be a 16-bit iret problem but now it's gone, thanks to a recent commit. :)

@Creeper20428
Copy link
Author

I think I figured out why some OSes don't work when ACPI is enabled. It's not the emulator's fault (although it might be -- you never know). Early OSes have no support for ACPI at all (see https://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface#Operating_systems). When an OS, such as DOS sees random AML bytecode in spots where x86 code is supposed to be, then things go south....

@copy
Copy link
Owner

copy commented Mar 1, 2016

These are tables, after all. How hard could it be to copy tables?

This isn't necessary, the bios sets up ACPI tables: https://github.com/KevinOConnor/seabios/blob/master/src/fw/acpi.c

Early OSes have no support for ACPI at all

That's good to know, this will need to be a runtime option then.

@Creeper20428
Copy link
Author

Then what's the problem? Is there an I/O port that's mis-reading/writing?

And BTW, how do you debug things like this?

@copy
Copy link
Owner

copy commented Mar 3, 2016

Then what's the problem? Is there an I/O port that's mis-reading/writing?

The APIC implementation is quite incomplete, so there are just many parts missing (or wrong).

And BTW, how do you debug things like this?

Run the emulator in debug.html. You'll see a rather verbose log in the JavaScript console, XP produces this: https://gist.github.com/copy/c4de5225317922d035d3

You can see what is being used. There are some unimplemented IO ports. Then Windows goes to sleep waiting for something to happen, probably an interrupt. Could also be related to that RTC register.

@Creeper20428
Copy link
Author

Is it ACPI or APIC?

In the code, I saw "APIC" in acpi.js.

@copy
Copy link
Owner

copy commented Mar 4, 2016

Is it ACPI or APIC?

ACPI needs to be enabled for it to work at all. APIC implementation is incomplete.

In the code, I saw "APIC" in acpi.js.

Do you have the latest version?

@Creeper20428
Copy link
Author

I have one from a while ago -- it still has traces of the dynamic translator in it.

So, let me get these things straight:
Windows XP doesn't boot because of incomplete ACPI ports and an incomplete APIC implementation.
OS/2 Warp 4.52 doesn't boot because of... I don't know. I'm uploading to Dropbox right now.

@Creeper20428
Copy link
Author

https://www.dropbox.com/s/k970phbvyk6erdy/os2.img.vmdk?dl=0

That's the file (I made it in QEMU)

@copy
Copy link
Owner

copy commented Mar 5, 2016

Thanks for the disk image. After a bit of fixing small things, I found that OS/2 uses far call gates, which aren't implemented yet.

Windows XP doesn't boot because of incomplete ACPI ports and an incomplete APIC implementation.

Probably the latter, yes.

@Creeper20428
Copy link
Author

So Win XP doesn't boot because of APIC problems and OS/2 doesn't boot because of far call gates.

@Creeper20428
Copy link
Author

Sounds fun!

@Creeper20428 Creeper20428 changed the title Double Fault Boot Windows XP and OS/2 Mar 12, 2016
@Creeper20428
Copy link
Author

I did some research yesterday and I discovered this:
https://lifehacker.com/5827222/jpc-2-lets-your-run-windows-xp-and-ubuntu-in-your-web-browser

I just thought it was interesting.
Unfortunately, it's not up anymore :(

@Creeper20428
Copy link
Author

Actually, from what I saw, it worked more like the Windows 98 demo: https://copy.sh/v86?profile=windows98

I looked a bit more and apparently, it emulates the code, but loads the hard disk over the Internet.
It would have been really neat to see it in action and see the source code, but it's down now -- and all traces of the jar file are gone!

@Creeper20428
Copy link
Author

I dug some more and it's by a company named "eMediaTrack" in Great Britan (because they say "optimised" instead of "optimized"). I went to eMediaTrack.net and saw their demos -- it's called "Proteus" or something. Then, I looked up "Proteus" online and came up with proteuscc.sourceforge.net. I found out that they compiled Bochs to Java. Somehow.

Then, I went back to archive.org and looked at the page source. The main class is com.emt.proteus.vmimpl.?. I decompiled the demos and found out that there was no "vmimpl" class there...

Finally, I looked backwards in time and found something new! Apparently, they compiled Bochs to Java with their "Proteus-S" product.

The company got liquidated in October 2015. I saw this in the British "Companies' House" web site. They owed a bunch of money to other companies. Maybe the file is owned by one of them now..?

@Creeper20428
Copy link
Author

Oh, BTW a site called ww45.jpc2.com was up in 2014 but now it's down.

@Creeper20428
Copy link
Author

Just discovered this (https://sandpile.org/x86/cpuid.htm#level_0000_0001h)

The (fixed) default APIC ID is encoded in bits 31...24.

Maybe the lack of this is causing the double faults.

@Creeper20428
Copy link
Author

jsbochs is Bochs compiled to JavaScript via Emscripten.
JPC-2 is basically JPC but with more features (according to their web site).

In unrelated news, Windows XP launched for retail sale on October 25, 2001. It would be cool to have it work in the browser as a "15th anniversary" thing.

@Creeper20428
Copy link
Author

Creeper20428 commented Jun 11, 2016

There's a difference between regular Windows XP and the "small variants". For example, I tried a PEBuilder ISO and it faults with a BSOD (after taking like 50 minutes to boot). However, Windows XP SP3 (It's a 1.5 GB image, so I can't post it online like my OS/2 one) just stops in the middle[1]. The IPS counter just goes down to 0. That's because a "double fault" exception is being thrown (AKA no ACPI/APIC support).

[1] It's been a while since I checked, so who knows? :D

I could probably implement ACPI in a few days, but I'm busy at the moment (and I don't know a lot about hardware stuff)

PEBuilder web site

@Creeper20428
Copy link
Author

I had an interesting idea: I saved an instance of Windows XP on Bochs when I had a little too much free time on my hands. So, it would be relatively easy to convert the Bochs format (which is like JSON but with equal signs) into the v86 format, because I believe that ACPI tables are only parsed on startup and aren't used unless you want to shut down the computer or mess around with the power options.

On the other hand, implementing ACPI/APIC can make some more operating systems work and I personally think that this is a bit like cheating.

@Creeper20428
Copy link
Author

That's true...
Anyways, it is possible to install Win XP without ACPI and APIC. But it takes XP a LOOOOOOOOOOOONG time to install (3 hrs. for me in QEMU).
Anyways, I'll try to implement ACPI/APIC soon.
Speed is not an issue. Windows XP can run on 8 MHz, and I'm sure the speed here is more than 10 MHz... I hope.

@Creeper20428
Copy link
Author

Imagine Vista at 8 MHz! >:-)
Sometimes, the computer gets the clock speed wrong.

XP said the computer was a 5 MHz Pentium IV. I can't see the entire IPS counter in the UI, though. But that's pretty fast compared to a Pentium 60 (but people say the Pentium IV was slow, though...)

By the way, did anybody have any success implementing ACPI yet?

@copy
Copy link
Owner

copy commented Jun 13, 2016

I'm not actually sure if the copy.sh CPU is at 8 MHz, but I checked four different operating systems

They're just measuring the TSC, which runs at a constant speed, defined here.

By the way, did anybody have any success implementing ACPI yet?

There's not much to do as far as I know, most work is done by the bios: https://github.com/coreboot/seabios/blob/master/src/fw/acpi.c

@Creeper20428
Copy link
Author

Creeper20428 commented Jun 14, 2016

Oops I meant APIC.

@Creeper20428
Copy link
Author

Creeper20428 commented Jun 14, 2016

I think the original Windows XP should work, since it booted in safe mode in JDosbox[1]. When I tried SP3 on it, it double faulted. A closer inspection of the project revealed that there was no ACPI or APIC. A forum thread[2] didn't say anything about ACPI or APIC.

But, I can't find any original (non "service pack"ed) ISOs out there.

[1] https://jdosbox.sourceforge.net/
[2] https://www.vogons.org/viewtopic.php?t=27467

PS: There is a cool OS on the last page that you should try: https://ftp.unixdev.net/pub/iso/QNX/qnxnc621.iso
But its 237 MB.

@Creeper20428
Copy link
Author

Sure! That would be great! Can you post it online somewhere so that I can test it/install it?
I think the disk is about 200 MB, won't take me that long to download.
But it installs to a 1 GB hard disk.
Which leads me to wonder: how does it make 5 times more data than there was on the CD-ROM itself?

There's a way to disable APIC during install, but I couldn't find it. And people are typing in ACPI instead of APIC and vice versa. Driving me crazy.

copy added a commit that referenced this issue Oct 15, 2016
@socketpair
Copy link

Well, after all that, what is the status of Windows XP support ?

@hello-smile6
Copy link
Contributor

hello-smile6 commented May 28, 2022

Could you give a save state or disk image of it? I want to do this but don't have enough storage space or RAM.

You only need 4 GB of storage, but okay. I'll see if I can get it small enough.
Wait, I don't think I can share it because Windows is activated. @copy Can I?

@hello-smile6
Copy link
Contributor

I think you can, a huge company like Microsoft will not care. Plus, it's pretty old and unsupported, no one would pay for an old OS like this one anyways when there are other newer ones.

If @copy says I can, I'll share it. It's only about 500 MB with NTFS compression, so I would probably be able to put it on the Internet Archive. Still, I don't want to risk it. (Remember who owns GitHub? )

@hello-smile6
Copy link
Contributor

Yes, but would they care? Not really, as it's pretty old and mostly only used for playing around. There is not much risk either. I don't think Copy would really care either. Plus, you pretty much did what you didn't want to do: pirate. You already have a copy of it so it won't matter anyways.

I'm not going to risk it.

@hello-smile6
Copy link
Contributor

Windows the year is 1600 has some strange side affects. For example, it made shutdown /r say it was going to shut down in over 68 years.

@hello-smile6
Copy link
Contributor

After the first boot of XP in v86, it takes XP:

  • 35 seconds to get a graphical boot logo
  • 5 minutes before it complains about the date
  • 6 minutes until it gives the welcome screen
  • 9 minutes to get to the desktop background
  • 9 minutes 22 seconds for the taskbar
  • 9 minutes 40 seconds for desktop icons
  • 10 minutes 55 seconds until the cursor on the taskbar is not the loading cursor (the system is fully interactive then)
  • 11 minutes 37 seconds until the new hardware wizard shows up
  • 11 minutes 47 seconds until Windows complains about not having an antivirus

Just for reference.

@hello-smile6
Copy link
Contributor

the date is supposedly January 1, 1601

To fix this:

  1. Get your VM (in v86) onto a network.
  2. Set the time so it's somewhere in the 2000s. (2022 worked for me, increase this if you read this in a different year)
  3. Sync your VM with a NTP server using the "Internet Time" tab of the Date and Time Properties control panel.

@hello-smile6
Copy link
Contributor

Yes, but would they care? Not really, as it's pretty old and mostly only used for playing around. There is not much risk either. I don't think Copy would really care either. Plus, you pretty much did what you didn't want to do: pirate. You already have a copy of it so it won't matter anyways.

I'm not going to risk it.

What risk?

/ignore Unzor

@hello-smile6
Copy link
Contributor

IRC.

@OfficialGH98
Copy link

@hello-smile6 I got a question, since you got Windows XP working on v86, which application did you use to create an .img file?

@hello-smile6
Copy link
Contributor

@hello-smile6 I got a question, since you got Windows XP working on v86, which application did you use to create an .img file?

Used QEMU to install.

@hello-smile6
Copy link
Contributor

I'm checking my email with Windows XP right now. It works well, you just have to use ncat on Arch to allow accessing email without SSL from the XP VM.

ncat -l -k 0.0.0.0 995 -c "ncat --ssl youremail.com 995"

Not the best, but it works!

@ethanaobrien
Copy link

ethanaobrien commented May 29, 2022 via email

@hello-smile6
Copy link
Contributor

Try using browservice (https://github.com/ttalvitie/browservice). Its supports as far back as windows 95 and runs on windows and Linux (to do modern web stuff

96 megabytes? I'd either need a floppy with it or a non-throttled WebSocket proxy, neither of which I have. It seems like the floppy driver might not work anyway.

@ethanaobrien
Copy link

ethanaobrien commented May 29, 2022 via email

@hello-smile6
Copy link
Contributor

It’s to host on the host os, not on the guest.

Oh. But that doesn't help with email. I'm using email, not a web browser. Anyway, I could probably use the Internet Archive for browsing.

@ethanaobrien
Copy link

ethanaobrien commented May 29, 2022 via email

@hello-smile6
Copy link
Contributor

I don’t think you quite understand what it does. Why don’t you take a look at the project, read through the readme. If I’m correct it would even allow you to upload a YouTube video

surprisingly usable if the network connection between the proxy server and the client is fast (such as 100 Mbit/s Ethernet LAN).

relay.widgetry.org is anything but fast, and I don't know of an alternative.

@ethanaobrien
Copy link

It probably wouldn’t be too hard to write one. I’ve thought about doing it but haven’t ever gotten around to it

@hello-smile6
Copy link
Contributor

It probably wouldn’t be too hard to write one. I’ve thought about doing it but haven’t ever gotten around to it

One of what? A network relay? Can't you just use docker run?

@ethanaobrien
Copy link

Yeah. I’m not familiar with docker so i wouldn’t know. You could try it

@hello-smile6
Copy link
Contributor

Yeah. I’m not familiar with docker so i wouldn’t know. You could try it

I couldn't, because I don't have a server to run it on. If there was a way to not need direct network access (similar to QEMU with -net user), I'd already have my own network relay!

@hello-smile6
Copy link
Contributor

@Unzor It's possible to create a bootable hard disk image from a Docker container, I wonder if someone could do that with the websockproxy Docker container. If so, it could be run with QEMU and -net user.

@hello-smile6
Copy link
Contributor

@hello-smile6
Copy link
Contributor

It seems like you just have to open it and run docker run --rm --privileged -p 8080:80 --name jor1k-relay bennottelling/websockproxy:latest to start a server.

@CaptainCrumb999RobloxYT
Copy link

@copy XP without ACPI should work if select "Standard PC" HAL when hit F5 on install screen

This also works if you:

  1. Install XP in QEMU (Don't bother with disabling ACPI)
  2. Open Device Management
  3. Select "Computer" > right-click > "Update Driver"
  4. Select "Search for a driver"
  5. Select "Choose from a list"
  6. Select "Standard PC"
  7. Reboot your VM when prompted.
  8. Shut down your VM and use it in v86.

I did this with my VM, and it's booting perfectly. 9 minutes after booting in v86, the date is supposedly January 1, 1601 and all is right with Windows. I even have a network connection! Screenshot

Windows XP Works!!!

@breadcrumbsgames
Copy link

@hello-smile6 Can you please release that image file for Windows XP for us?

@hello-smile6
Copy link
Contributor

@hello-smile6 Can you please release that image file for Windows XP for us?

It's been a few years, so I might not have it anymore.

@breadcrumbsgames
Copy link

@hello-smile6 Can you create it with QEMU again please? I tried to install QEMU on Arch but it is being weird.

@spetterman66
Copy link
Contributor

Why is this issue still open? Heck, we even got Windows 8 (tho, build 8133) support now

@copy copy closed this as completed May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests