Skip to content

[CPU] Added a check for queryprotect result in MMIO #2232

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

guccigang420
Copy link

This call can fail. On Linux it always fails as it is not implemented.

@Margen67 Margen67 added the cpu label Nov 19, 2023
@Triang3l
Copy link
Member

Triang3l commented Jul 31, 2025

As far as I understand, there's no need to query the host protection here at all, as the host protection does not have any authority, it's merely a reflection of the guest protection plus callbacks for internal emulation needs.

If the page is protected on the guest side, an access violation is just an access violation, that should always simply fault without triggering host callbacks.

Otherwise, it's not an action violation, rather just a host-internal callback — guest code execution should continue as normal. If the address is in an MMIO range, the instruction should be parsed, handled, and jumped over — and MMIO ranges are never unmapped/unprotected while the guest process is still running. If it's not an MMIO region, it's just something like GPU memory invalidation, which is mostly safe to perform spuriously — just execute the callback and unprotect (and race conditions aren't important here, as the CPU and the GPU run inherently unsynchronized, only syncing at various kinds of fences)

(I'm disregarding potential load-locked/store-conditional protection cases because I don't know how to nicely implement those instructions, but again that will be just another kind of host-internal callbacks probably.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants