Skip to content

Instantly share code, notes, and snippets.

@Vogtinator
Vogtinator / README.md
Last active June 16, 2024 00:50
Run Win11 on ARM in QEMU

When following this guide on a host not capable of native arm64 KVM, replace -M virt -cpu host -accel kvm with -M virt,virtualization=on -cpu max.

The reason for virtualization=on is that the Windows bootloader does an smc #0 PSCI call, but without EL2, QEMU's TCG does not handle those because PSCI is in HVC mode and such that instruction is treated as undefined. With KVM enabled, smc #0 is handled properly.

Workaround in QEMU for using TCG without virtualization=on:

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index b871350856..de11ff51d1 100644
--- a/hw/arm/virt.c
void setValue(int v);
extern int value;
int main()
{
setValue(42);
return value;
}
diff --git a/main.cpp b/main.cpp
index 6256b51..e5f23e9 100644
--- a/main.cpp
+++ b/main.cpp
@@ -50,7 +50,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <KService/KMimeTypeTrader>
#include <KWindowSystem/KWindowSystem>
-//#define DEBUG_KDE
+#define DEBUG_KDE