MCPcopy Create free account
hub / github.com/HoShiMin/Kernel-Bridge / RdmsrHandler

Function RdmsrHandler

Kernel-Bridge/API/Hypervisor.cpp:2411–2433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2409 _IRQL_requires_same_
2410 _IRQL_requires_min_(DISPATCH_LEVEL)
2411 static VMM_STATUS RdmsrHandler(__inout PRIVATE_VM_DATA* Private, __inout GUEST_CONTEXT* Context, unsigned long long Rip, __inout_opt bool& RepeatInstruction)
2412 {
2413 UNREFERENCED_PARAMETER(Private);
2414 UNREFERENCED_PARAMETER(Rip);
2415 UNREFERENCED_PARAMETER(RepeatInstruction);
2416
2417 unsigned long Msr = static_cast<unsigned long>(Context->Rcx);
2418 if (IsMsrAllowed(Msr))
2419 {
2420 // Allowed MSR:
2421 LARGE_INTEGER Value = {};
2422 Value.QuadPart = __readmsr(Msr);
2423 Context->Rdx = Value.HighPart;
2424 Context->Rax = Value.LowPart;
2425 }
2426 else
2427 {
2428 // It is unknown MSR (not Intel nor Hyper-V), returning 0:
2429 Context->Rdx = 0;
2430 Context->Rax = 0;
2431 }
2432 return VMM_STATUS::VMM_CONTINUE;
2433 }
2434
2435 _IRQL_requires_same_
2436 _IRQL_requires_min_(DISPATCH_LEVEL)

Callers

nothing calls this directly

Calls 1

IsMsrAllowedFunction · 0.85

Tested by

no test coverage detected