[XEN] Fix early-unshadow detection for 3- or 4-level guest pagetables.

Early-unshadow will unshadow whenever 2 zero values are written
to the same page; for PAE, one PTE takes 2 writes.  Only check
for the early unshadow when writing the low half of the PTE.
This commit is contained in:
George Dunlap committed 2007-01-16 14:04:12 -05:00
1 parent 236c16423b
commit a086d29d0e
2 files changed
+7 -2

No files matched your search

+2 -2
View File
@@ -3944,7 +3944,7 @@ sh_x86_emulate_write(struct vcpu *v, unsigned long vaddr, void *src,
if ( !skip ) sh_validate_guest_pt_write(v, mfn, addr, bytes);
/* If we are writing zeros to this page, might want to unshadow */
if ( likely(bytes >= 4) && (*(u32 *)addr == 0) )
if ( likely(bytes >= 4) && (*(u32 *)addr == 0) && is_lo_pte(vaddr) )
check_for_early_unshadow(v, mfn);
sh_unmap_domain_page(addr);
@@ -3996,7 +3996,7 @@ sh_x86_emulate_cmpxchg(struct vcpu *v, unsigned long vaddr,
vaddr, prev, old, new, *(unsigned long *)addr, bytes);
/* If we are writing zeros to this page, might want to unshadow */
if ( likely(bytes >= 4) && (*(u32 *)addr == 0) )
if ( likely(bytes >= 4) && (*(u32 *)addr == 0) && is_lo_pte(vaddr) )
check_for_early_unshadow(v, mfn);
sh_unmap_domain_page(addr);
+5
View File
@@ -427,6 +427,11 @@ extern int sh_remove_write_access(struct vcpu *v, mfn_t readonly_mfn,
#undef mfn_valid
#define mfn_valid(_mfn) (mfn_x(_mfn) < max_page)
#if GUEST_PAGING_LEVELS >= 3
# define is_lo_pte(_vaddr) (((_vaddr)&0x4)==0)
#else
# define is_lo_pte(_vaddr) (1)
#endif
static inline int
sh_mfn_is_a_page_table(mfn_t gmfn)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.