wbenny / hvpp

hvpp is a lightweight Intel x64/VT-x hypervisor written in C++ focused primarily on virtualization of already running operating system
MIT License
1.12k stars 221 forks source link

Add safe handling memory read/write instead of naive CR3 switch #9

Open wbenny opened 6 years ago

hzqst commented 5 years ago

https://github.com/intel/haxm/blob/d29c7cdabb2797cd41f590e52c435eabfcd432d2/core/vtlb.c#L1115 is your friend. note that GPA to HVA mapping is a hard job for vmm host since you are not able to use MmMapIoSpace or MmGetVirtualForPhysical or some other kernel apis to do those mapping stuffs. espicially on Windows 10 RS4.

wbenny commented 5 years ago

Thanks for the link. FWIW, some time ago I've already added this: https://github.com/wbenny/hvpp/blob/master/src/hvpp/hvpp/ia32/memory.cpp#L85, which behaves similarly to MmMapIoSpace (with the benefit of mapping even non-IO space). It's just currently not used for anything.