[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] why xen use x86_emulat ion() in page_fault
On Tue, Oct 11, 2011 at 11:12 AM, cc Luit <universalbillow@xxxxxxxxx> wrote: > Yeah, I've seen this comments, I understand what it says in the before part, > but not the last sentence, what does it mean by "non-user write"? As you know, pagetables have a write-protect bit, such that writes to that virtual address will cause a fault. But there's an option in CR0 that can make the WP bit only work in user mode, and not kernel mode. So if the guest has CR0.WP clear, and the guest PTE is read-only, the guest needs to see this: 1. In user mode, writes cause a page fault 2. In kernel mode, writes do not cause a page fault But Xen needs to protect pagetables to detect changes to them. So what Xen needs is this: 1. In user mode, writes cause a page fault to be delivered to the guest 2. In kernel mode, writes to non-PTs do not cause a page fault to be delivered to the guest 3. In kernel mode, writes to PTs cause a trap to xen, but do not cause a page fault to be delivered to the guest Unfortunately, there's no way to cause traps to xen in the case of #3 without also causing traps to Xen in case #2. So the if statement is designed to handle case #2. > another question is that if for some reasons I want to design that the Guest > PTE is not read-only, which means in the page_fault situation I don't want > xen to emulate, is there any functionability or feasibility problems? The basic problem is that in shadow mode, changes to the guest's pagetables need to be propagated into the shadow pagetables. If you can figure out how to make that happen without trapping to Xen and emulating, all the better. :-) > thanks for your answer:) bu ke qi! ;-) -George _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |