windows - Where is guest ring-3 code run in VM environment? -
according white paper vmware has published, binary translation techinology used in kernel (ring 0 codes), ring 3 code "directly executed" on cpu hardware.
as observed, no matter how many processes run in guest os, there 1 process in host os. assume guest ring 3 code run in single host process context. (for vmware, it's vmware-vmx.exe).
so question here is, how execute many ring 3 code natively in single process? considering of windows exe file don't contain relocation information, cannot executed somewhere else, , binary translation not used in ring3 code.
thanks.
let's talk vmx
, intel vt-x
's design.
intel vt-x
introduces 2 new modes solve problem: vmx root mode
, vmx non-root mode
, host , guest respectively. both modes have ring 0~3, means host , guest not share same ring level.
a hypervisor running in ring 3 of vmx root mode
, when decides transfer cpu control guest, hypervisor lanuch vmlaunch
instruction, allows transfer vmx non-root mode
vmx root mode
. guest ring 3 code able automatically executing in vmx non-root mode
. of supported intel vt-x
. no binary translation or instruction emulation needed running guest.
of course ring 3 of vmx non-root mode
has less privilege , power. example, when guest ring 3 code encounters somthing cannot handle, such physical device access request, cpu automatically detect kind of restriction , transfer hypervisor in vmx root-mode
. after hypervisor finish task, trigger vmlaunch
again running guest.
Comments
Post a Comment