-
virtualized address translation - [康朴塔散思]
2009-10-09
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://damocles.blogbus.com/logs/47970914.html
by Scott Devine
1.There is a miss in the TLB. The hardware will walk the shadow page table to find the mapping.
(TLB 中cache的是从guest virtual address -> host machine address,host的cr3指向的是shadow page table的位置)
2.One of two things can happen:
•The required mapping is found in the page table and placed in the TLB. The instruction is restarted and all proceeds normally. Note that in this case the hardware does all the work.
(在shadow page table中找到entry,放入TLB中)
•The required mapping is not present. An page fault exception is generated by the hardware and trapped into the VMM. The VMM needs to translate the virtual address to a machine address. It starts by walking the guest’s page table to determine the virtual to physical mapping. Note that the layout of the guest page table will be determined by the hardware being virtualized.
(在shadow page table中直接到host machine address的mapping没有找到,trap进入VMM, 通过guest page table找到guest virtual address -> guest physical address)
3.Once the VMM finds the guest mapping one of two things can happen:
•The guest mapping is not present. In this case the guest expects a page fault exception. So the VMM must generate an exception on the virtual cpu state and resume executing on the first instruction of the guest exception handler. This is called a true page fault because the hardware page fault results in a guest visible page fault.
(guest page table中mapping也没有,说明guest期望得到一个page fault, inject page fault在guest中,有guest处理)
•If the guest mapping is present then the VMM must translate the physical page to a machine page. This is called a hidden page fault because the hardware fault is a fault that would not have occurred in non-virtualized system. In order to translate the physical page to machine page the VMM must look in a data structure that maps physical pages to machine pages. This data structure is defined by the VMM, for example PMap. The VMM might have perform further processing if there is no machine page backing the physical page or in other special circumstances.
(查找存储guest physical address -> host machine address的data structure,如果miss了,就添加)
4.The virtual to machine translation is complete. The new translation is put into the shadow page table.
(把这个新的mapping放入shadow page table)
5.The VMM restarts the guest instruction that faulted. Now the hardware TLB refill mechanism will work.
6.The hardware put the new mapping in the TLB and life goes on.
随机文章:
gvim在gnome下启动最大化 2009-04-26pdflatex hyperlink 2009-03-11How to Daemonize in Linux 2009-01-06ctrl-c的实现 2008-08-26
收藏到:Del.icio.us







