Skip to content

fix: guard breakpoint() with x86 check for ARM64 Windows support#674

Merged
NotRequiem merged 2 commits intokernelwernel:mainfrom
Dreaming-Codes:fix/breakpoint-arm64-guard
Apr 7, 2026
Merged

fix: guard breakpoint() with x86 check for ARM64 Windows support#674
NotRequiem merged 2 commits intokernelwernel:mainfrom
Dreaming-Codes:fix/breakpoint-arm64-guard

Conversation

@Dreaming-Codes
Copy link
Copy Markdown
Contributor

@Dreaming-Codes Dreaming-Codes commented Apr 7, 2026

Summary

The msr(), kvm_interception(), and breakpoint() functions use x86-specific intrinsics and registers that don't exist on ARM64 Windows, causing compilation to fail when targeting aarch64-pc-windows-msvc:

vmaware.hpp(11807): error C3861: '__readmsr': identifier not found
vmaware.hpp(12020): error C3861: '__stosb': identifier not found
vmaware.hpp(12047): error C2039: 'Dr0': is not a member of '_CONTEXT'
vmaware.hpp(12053): error C2039: 'Dr7': is not a member of '_CONTEXT'
vmaware.hpp(12057): error C3861: '__movsb': identifier not found

Root cause

These functions already had #if (!x86) return false; #endif guards, but that pattern only inserts an early return. The compiler still compiles the code after #endif. On MSVC ARM64, this fails because x86-specific intrinsics (__readmsr, __stosb, __movsb) and x86 debug registers (Dr0, Dr7 from CONTEXT) don't exist.

Fix

Changed all three functions to use #if (!x86) return false; #else ... #endif so the x86-specific code is completely excluded from compilation on non-x86 targets.

The breakpoint() function uses x86-specific intrinsics (__stosb, __movsb)
and x86 debug registers (Dr0, Dr7 from CONTEXT) that don't exist on ARM64
Windows. This causes compilation to fail when targeting aarch64-pc-windows-msvc.

Added the same #if (!x86) return false; #endif guard that msr() already uses.
…ption(), and breakpoint()

The previous pattern (#if (!x86) return false; #endif) inserts an early
return but the compiler still compiles the code below. MSVC on ARM64
fails because x86-specific intrinsics (__readmsr, __stosb, __movsb) and
x86 debug registers (Dr0, Dr7) don't exist on that platform.

Changed all three functions to use #if (!x86) return false; #else ... #endif
so the x86-specific code is completely excluded from compilation on non-x86
targets.
@NotRequiem NotRequiem merged commit 0151892 into kernelwernel:main Apr 7, 2026
3 checks passed
@NotRequiem
Copy link
Copy Markdown
Collaborator

ty :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants