600 points · by giuliomagnifico · 4y ago · 260 comments
1) yes, I realize this is going to be way harder than it seems, but I'm actually going to do my best to hopefully get a good user experience out of this and I'm easily preparing for this to be a multi-year effort, but I'm not going to give up right at the gate
2) Custom HALs were actually an option, up until very recently, since as of Windows 10, version 2004, the HAL is now statically linked into the kernel, meaning that if I wanted to use the AIC natively I'd need to write a patch finder that runs before the Windows kernel loads (This is what EfiGuard does for example to disable PatchGuard)
(Yes this is actually more tenable than it may seem, due to some undocumented policy files Windows is able to use, but I have already decided to hold off on this until after I get Windows working under the thin hypervisor)
3) HAL Extensions (for those unaware they are tiny modules that allow you to extend the Windows HAL with functions for non standard hardware) are not tenable at the moment since they're limited in the APIs they use
4) I am well aware that Windows is going to need a lot more help than just purely the interrupt controller, I'm currently trying to bring up the vGIC first since the distributor and redistributors need to be emulated and I need to bring up Project Mu first
5) as for the GPU, I'm way too far away from that being a concern to figure out the approach lol
if you have any feedback btw, please do feel free to comment it i'll try to address it as best as I can
yes I'll update the website theme soon enough, thanks to the commenter who remarked about readability.
Jokes aside, technically I don't disagree on the "dictionary definition" thing there... but it's interesting how the current landscape has shifted and now more control for the developer starts to become a common interest between "hackers".
The original OSS licenses protected users (as in, final users) from predatory devs; nowadays, small devs and hackers talk in their forums about how to preemptively protect themselves against predatory users (as in, not final users, but other bigger devs that leech on other's work)
Companies: If you are working for a company/corporation/profit-generating entity, or otherwise intend to sell or use such code derived from this repository for profit-generating purposes, you shall not be permitted to use any of the source code herein until you email me (author email here) and we can come up with the appropriate terms and conditions for your use case.
Everyone else: Have fun!
Obviously it's missing some necessary edge cases and disclaimers, but yeah.
Edit: Found Polyform! https://polyformproject.org/what-is-polyform/
Not to be 'that guy', but that's an odd use of of the word 'delegated'. 'Relegated' might have been the word for which you were looking.
Edit: I know this will be down voted because I'm critiquing the word usage of OP instead of focusing on how cool their project is. I get that. I'm just pedantic and this sort of thing eats me alive.
Also my tip: if you're providing pedantry, it's much better if you contribute something substantive first.
I haven't heard of those before, and I'm fascinated by them. I go looking for documentation – and I can't find any on Microsoft's website – some documentation which mentions their existence, [0] but no details on the API or how to write them.
Is this something you have to sign an NDA with Microsoft to get access to the headers and docs for it? Or will I find the headers hidden away in the WDK somewhere?
Is there any good public source of info on them? The best I've found is [1] – which includes some important details but isn't comprehensive (not that anyone would expect a slide deck to be).
[0] e.g. https://docs.microsoft.com/en-us/windows-hardware/test/hlk/t...
[1] https://infocon.org/cons/SyScan/SyScan%202012%20Singapore/Sy...
Turns out the header file is included in the Windows 10 SDK, as km/nthalext.h
Not the very latest version, but someone posted it on GitHub here: https://github.com/tpn/winsdk-10/blob/master/Include/10.0.16...
(You can download the multi-gigabyte Windows 10/11/2022 SDKs to get a more recent one, although not sure if anything has changed.)
Still doesn't seem to be any public documentation. The header includes very detailed comments, but (as you'd expect for header file comments) they concentrate on the nitty-gritty and omit the big picture.
Searching "nthalext.h" on GitHub finds source code for a handful of HAL extensions, so at least there is some sample code to look at. Microsoft has even open-sourced a few – see https://github.com/ms-iot/imx-iotcore/tree/public_preview/ha...
Microsoft used to include HAL extension samples in the Windows 10 driver samples – https://github.com/microsoft/Windows-driver-samples/tree/5b8... – but removed them as part of the Anniversary update – https://github.com/microsoft/Windows-driver-samples/tree/96e...
And don't you worry that if you succeed, either Apple or Microsoft will make some small change to kill it?
The thing is, AFAIK, how to talk to the interrupt controller isn't part of the drivers, but part of the kernel. So you can't just "write a driver" for it. So if Windows doesn't support apple's interrupt controllers, I guess a lot of shenanigans will be needed.
As the OP said, all of this is abstracted by the Windows HAL, so it's just a matter of replacing the HAL (a separate binary). The problem is that the HAL is closed source. Outside of simple binary patches, I don't think anyone has come close to writing a new one.
He's planning on a thin hypervisor layer to map GIC to AIC.
“There’s an somewhat obscure feature on M1 (and M1 Pro/Max/Ultra, henceforth referred to as M1 v2) chips where part of the GICv3 can be virtualized to guest OSes to enable faster interrupt handling.”
Seemingly implementing it in a hypervisor?
To illustrate the issue with a silly example, imagine the Windows kernel assumes that every interrupt controller speaks Spanish, but suddenly AIC comes along and speaks Portuguese. The driver is going to have a hard time communicating.
A sibling commenter, gjsman-1000, explains that the idea is apparently to instead have a very lightweight hypervisor that actually presents a GIC to Windows, instead of trying to add an AIC driver, which might also have needed further kernel changes if Windows even has the concept of interrupt controller support being abstracted away enough to support interrupt controller "drivers" in its HAL. (I am not a Windows person at all, I don't know.) Basically not only having someone in between that seamlessly translates between Portuguese and Spanish, but actually pretending to be the interrupt controller itself.
However, they actually address this with the "What makes Windows on M1 hard?" area and talk about using a vGIC to do an extremely lightweight pseudo-hypervisor as a workaround. An interesting theory.
The main issue though is that Windows for ARM isn't for sale and can't be legally purchased outside of buying a WoA device. Microsoft could send a legal letter at any time.
If the author doesn't distribute any Microsoft IP, there's nothing Microsoft can do.
Only in theory. Microsoft could allege DMCA violations, or any number of threats. They might not have merit but they are still scary and could shut down the project regardless.
If I recall (grain of salt then) a while after the first M1 Mac came out one of Apple’s VPs had said something on the record about Apple having tried to get Microsoft to sell retail licenses of a Windows 10 for ARM build, because they didn’t want to deprecate Boot Camp for Windows. But Microsoft said no.
Not quite. The Craig Federighi quote is:
>As for Windows running natively on the machine, “that’s really up to Microsoft,” he said. “We have the core technologies for them to do that, to run their ARM version of Windows, which in turn of course supports x86 user mode applications. But that’s a decision Microsoft has to make, to bring to license that technology for users to run on these Macs. But the Macs are certainly very capable of it.”
https://arstechnica.com/gadgets/2020/11/we-are-giddy-intervi...
The scuttlebutt says that Microsoft is locked into a requirement to only run Windows ARM on Qualcomm chips for an unknown period of time, although I've never seen anything from Microsoft to confirm that.
However, just two weeks ago Microsoft announced their "Project Volterra" Mac mini clone for Windows on ARM development, which makes it seem mighty certain that Windows on ARM for Mac is not coming anytime soon because otherwise why on earth would anyone buy that thing...
On the other hand, if Project Volterra doesn't sell very well and Windows on ARM continues to flounder, maybe Microsoft will finally make Windows on ARM for Mac a real option in the hopes of capturing mindshare and gathering interest from all the people with Macs.
Microsoft does not sell retail licenses of Windows for ARM devices and what Apple proposed isn't the way Microsoft currently does business for ARM hardware.
Yes, Microsoft could change how they do business to accommodate, but so too could Apple.
If Microsoft turn around and ask Apple to license Windows and provide the OS as an option to buyers, or ask Apple to supply Macbook hardware so Microsoft could sell Macbooks with Windows on it, Apple likely would have said no too.
Windows on ARM isn't new. The oldest Windows on ARM was Windows 8 RT (ARM32 only, I believe). Right now it seems Windows 10 and Windows 11 have ARM64 versions, but there was also Windows IoT Core from the Windows IoT OS branch a few years ago.
(Then again, if they are having supply/capacity issues then maybe it's a matter it being on the roadmap but they want their hardware running macOS until that demand is fully met?)
[0]: https://9to5mac.com/2020/11/20/windows-can-run-natively-m1-m... [1]: https://www.xda-developers.com/qualcomm-exclusivity-deal-mic...
Apple is a device maker. I wonder if Apple could buy a license from Microsoft.
I'd like to see either Apple or Microsoft officially support Windows on the M-series machines. Not because I give fig one about Windows. But I'd like to see the chaos that follows.
The operating systems industry could use a bit of a shake up.
There is no OS industry anymore. What's left is OS's that ship telemetry and ads to customers (both Apple and MS do this). Linux-based OS's made a lot of progress, but still they're not ready for mass adoption.
But the Asahi Linux developers say Apple is helping in some measure[1], so it doesn't seem likely that they're hostile to running Windows on these devices.
[1](https://twitter.com/marcan42/status/1471799568807636994)
I used this to run FPGA bitstream-creation software on my Mac Studio. Worked like a dream. I'm generally fine with running on the PC on the bookshelf and serving s/w via MS Remote Desktop, but having it on the machine itself is a bit more useful in terms of screen real-estate (3x 4K monitors on the Mac).
You might not have to pirate Windows to do this, but I feel the rest of your comment is missing the mark.
If you're running an M1 with Parallels in any type of business or money-making environment then you're putting yourself at risk.
[1] Works-ish on Mac, not at all on iPhone.
[2] Collaborative editing on the Mac version works until you point at a file hosted on an on-premise Sharepoint instance, then it's Windows only.
They have about a 3 year lead as I see it on performance/watt.
With Linux they have to reverse-engineer it. Microsoft shouldn't need to...
> "that's really up to Microsoft," [Craig Federighi] said. "We have the core technologies for them to do that, to run their ARM version of Windows, which in turn of course supports x86 user mode applications. But that's a decision Microsoft has to make, to bring to license that technology for users to run on these Macs. But the Macs are certainly very capable of it."
From: https://arstechnica.com/gadgets/2020/11/we-are-giddy-intervi...
Exclusivity deal rumor: https://www.xda-developers.com/qualcomm-exclusivity-deal-mic...
1. Most of the people able to do this sort of thing probably work in Linux/FreeBSD/etc land. 2. You’re really working doubly against the tide here. You have proprietary stuff on the Mac and on the Windows side. 3. (Personal opinion) Dear God that sounds like a lot of work for something that is a fairly unfriendly experience on a few levels.
At least they have Linux/BSD people trailblazing here (they acknowledge as much).
If they can actually pull this off without changing something deeper than a what’s already exposed to kernel driver developers without horrible hacks or inefficiencies, I would be surprised.
Disclaimer: Not really a kernel dev of any sort.
> Should there be a debate whether or not it's theoretically possibly for this to work out logistically? What is the value in that?
Certainly if you're going to work on this you'd like to know if it's just a dead end.
The post you are criticizing is quite obviously not an example of "don't care", nor is your "summary" anywhere close to accurate. Yet you want to remove such posts? Do you want to remove all constructive criticism or debate while you are at it? Only echo chambers allowed?
one of the big reasons I started this project is that I've really been wanting to work on a project that deals with bootloader and kernel level code, and doing Windows bringup on the M1 seemed like a really interesting thing to tackle.
While initial progress might be slow, it is indeed happening, I'm planning to post an update tonight actually, but I realize you're busy so feel free to check the website whenever you have a free moment. (It's basic I know i'm not a web person lol)
IMHO, windows things aside, the NT kernel is an impressive feat of engineering and I'm surprised it's still going after so many years.
It indeed is really an impressive feat of engineering, but really almost all existing OS platforms are essentially from pre-2000s. Even fushcia's magenta (iirc LK was inspired by BeOS, the author worked at Danger prior).
Previous Step: Linux compatibility layer on Windows. https://docs.microsoft.com/en-us/windows/wsl/install
Current Step: Get DirectX to be first-class on Linux. https://www.phoronix.com/scan.php?page=news_item&px=Microsof...
Next Steps: Get the Windows GUI + Win32 APIs + backwards compatibility layer to run on WSL2. Port the best parts of NT to the Linux kernel.
Final Step: Replace NT+WSL2, with the Linux kernel. Use the current devs/tests/etc working on NT for better ROI (from a business customer perspective the NT kernel is no longer a positive differentiation).
1. Desktop/laptop OS based revenue is in decline. There is no reason for it to go up again. Between Chromebooks on the cheap end, MacBooks on the expensive end, and iOS and Android supporting an increasing number of productivity and content creation apps “with a free OS”, there is not much room for new and soon old companies to pay for OS licenses (other than legacy custom code - being “actively” migrated to Azure).
2. Because of Azure competing with AWS and GCP with a Linux distribution, MSFT already has teams with Linux expertise and working on improvements. This can’t get “extinguished” people just migrate Linux workloads elsewhere.
This leaves us with:
> Wonder what would come next
Likely more improvements to the Linux kernel from MSFT. Maybe even a big push of Linux to Rust (with Amazon and Google as partners). A bigger push from MSFT to get hardware manufacturers to build open source drivers into the kernel directly (so MSFT doesn’t need to fund the work for each of them). Maybe even “Windows” over Wayland. Basically windows/linux rather than gnu/linux.
Likely more applications built on DirectX + Linux native (ie without Win32). Maybe even Office without Win32. A Windows compat layer for gtk or qt or Flutter or whatever is good at the time. Even if only for new application creation.
Likely, given the direction of gaming at MSFT, DirectX (or whatever they call it) competes with Unreal for cross platform game stuff. For the next big revenue stream for MSFT from game devs (including their internal studios).
but the more I write about it, the more it’s likely to get read by a Microsoft VP, and the more it’s likely to happen :)
That said, truly it’s a no brainer. For the future of Microsoft, all paths lead to windows/linux (maybe windows/bsd but way way less likely).
I don't get it.
(To leave a bunch of trash around for the next set of people who attempt it?)
The thing I don't get is why a consumer would want this. You want an _extremely expensive_ windows laptop. I guess the hope would be that the battery life is worlds better than anything you'd get in standard windows-land. But in reality battery life optimization requires paying careful to the devices and their drivers -- e.g. when parts of the system shut down because they're not in use. Not easy for a project like this.
So I'd sadly guess you end up with an expensive windows laptop with battery life comparable to a standard windows laptop. But you get that nice minimal Apple industrial design. :shrug:
I kind of doubt it.
Or that there are Windows workflows that just don't work on OSX?
Or want a fanless laptop with good performance?
Also you can always run windows in a VM. Even on an M1.
Microsoft released a touch version of Office for iOS before they had a touch version of Office for their own Surface hardware.
This isn't the Ballmer/Gates era anymore.
But today's laptop market is very different. Apple and Microsoft are still very much competing for dominance in laptops, which is an important source of revenue for both companies. It's a familiar pattern where Apple sells fewer units than many others, but at much higher profit margins. MS gets their tax from all these PC sales at high margin, but it's a small amount compared to Apple's huge hardware margins - and that's the key point why it's a bad idea. A consumer who buys a mac to run windows gives WAY more money to Apple than Microsoft.
The secondary point is that every Mac sold erodes the waning dominance of Windows, bleeding out Microsoft's cash cow. Nadella wants (NEEDS!) you to believe Microsoft is kinder & gentler because he knows the days of Windows' hegemony are behind us and there's no stopping its slow fade to irrelevance. That doesn't mean they want to it to happen. Directing consumer's money into Apple's coffers unquestionably accelerates Microsoft's problems.
Tell me how exactly you think this means Windows is a healthy platform?
Electron "apps" aren't apps. They are glorified webpages.
Besides that, some people actually like Windows, or dislike Macs, though I’m not one of those people. I prefer the Mac. I just see when the Mac is a poor buy compared to Windows.
A lot of low-end hardware will not even run Windows 11, which is probably going to be more and more of a pain to deal with as time goes on.
It's absolutely their job to make Excel less of a P.O.S. on Mac.
This really should be a Microsoft effort. They just announced that they have Visual Studio compiling in ARM64 finally, so it's only a matter of time before the only thing standing in the way is backroom deals that we don't know about. Qualcomm?
I mean, I do want to see Qualcomm ship their M1 competitor, but given the state of the economy and world recession we're about to enter, I am skeptical it would survive fat trimming cuts that are about to sweep the industry. The money for them is in mobile and automotive projects.
Yes, https://asahilinux.org . I think this is coming at about the right stage in the game - the Asahi folks have figured out the baseline needs for booting another OS and have a basic bootstrap loader and hypervisor (m1n1) as mentioned in the M1 Windows writeup.
I think the OP writeup is fairly clear-eyed in terms of what needs doing - bring up the basic interrupt controller setup and IOMMU oddities needed to get UEFI and then the kernel to come up, and then start chipping away driver by driver until the system is usable.
This is basically what Asahi did and it's worked out well for them.
Fun side note I volunteered to help fix up the Apple silicon I2C driver to use interrupts instead of polling, so I'm definitely also trying to get more involved with Asahi too
sorry about that, it looked readable on my end, but remedying this asap
Hopefully Microsoft just hires you and gives you the resources you need to do this properly
I would he surprised if someone at MS didn’t have a build that runs on m1
Usually Microsoft gets the hardware manufacturer to make sure their hardware works with Windows. In this case Apple have probably decided that supporting Windows themselves is not worth the effort either.
Likely neither of them want to get into the support headache that this could turn out to be.
Developing for ARM shouldn't be a nightmare.
But if a small amount of hackers were able to install Windows 11 ARM on a Raspberry Pi 4, then I won't be surprised to see the same to be done for Apple Silicon.
[1]: https://blogs.windows.com/windows-insider/2020/12/10/introdu...
But unoffically, there is a leaked build of Windows 10 15035 for ARM32, and it's possible to sideload it onto an original Windows RT device.
The x86_32 emulator was present in the ARM64 Windows release by this point, but, i don't know if the leaked ARM32 release includes an ARM32 version of the x86_32 emulator.
The problem with x64 on arm64 is no longer if it's possible, but rather the performance penalty. As for whether I'll try to make a Rosetta-like compat layer using the hardware optimizations: not sure yet, I have bigger fish to fry before I get there.
https://twitter.com/never_released/status/153412764108259328...
https://twitter.com/marcan42/status/1534032369166225409
The baseline for translation is qemu-user, but other pure-software emulators like FEX-emu and Box86/Box64 can perform this translation significantly faster. So I think there's just ordinary performance engineering to close the gap.
I think Windows for ARM is still suffering from a previous release several years ago without the equivalent of Rosetta 2, and since then no hardware that actually offers an advantage in terms of battery life in the same way M1 macs did.
I imagine this will be quite achievable. Windows 11 already runs ok in Parallels.
Doing it "properly" native will require Microsoft to make changes to Windows though.
Unfortunately many Windows users and developers are unaware their "Desktop" becomes a VM on Hyper-V installation.
I see it all the time when people start arguing "type-1" vs "type-2" hypervisors.
Usually if they have some experience with Xen comparing it to a Dom0 helps, but understandably people usually first compare it to VirtualBox because the process is opaque.
I work on Electron apps and I've been happy with how it works.
Why not use that?
As for Electron apps - huh? Are you actually suggesting that you can just use Electron apps to accomplish what the OP has set out to accomplish?
Yes, I have. It works very well, what's the problem making it hardly worth the effort?
What I mean is that I develop Electron apps on an M1 Mac, and I use Parallels to spin up Windows so I can test the apps on Windows too.
Not the latter of what you suggested.
> Anything that good hackers would find interesting. That includes more than hacking and startups. If you had to reduce it to a sentence, the answer might be: anything that gratifies one's intellectual curiosity.
Thank you guys.
My entire company will run off this if you can get it working well.
0.4.11 did run a lot of Windows software that I use (including my own) & I was impressed with what they'd achieved, but it regularly corrupted the file system and required a full reformat & reinstall, so not something I could actively use.
The OP wants to boot Windows on an M1. That's why.
Let's assume you didn't read their site though. Why not?
I think booting Windows on a M1 qualifies as "actual utility" for a lot of people. Just because you don't see any value in the project doesn't mean other people agree with you.