Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80653
b: refs/heads/master
c: e3c5e7e
h: refs/heads/master
i:
  80651: 9e95987
v: v3
  • Loading branch information
Avi Kivity committed Jan 30, 2008
1 parent 6247877 commit 535cedd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4a4c99248713e878e1e2880015d01049aec805f3
refs/heads/master: e3c5e7ec9efe0ebd47fa812cc86f01c51905edf6
5 changes: 5 additions & 0 deletions trunk/drivers/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ static int is_writeble_pte(unsigned long pte)
return pte & PT_WRITABLE_MASK;
}

static int is_dirty_pte(unsigned long pte)
{
return pte & PT_DIRTY_MASK;
}

static int is_io_pte(unsigned long pte)
{
return pte & PT_SHADOW_IO_MARK;
Expand Down
31 changes: 8 additions & 23 deletions trunk/drivers/kvm/paging_tmpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ static int FNAME(walk_addr)(struct guest_walker *walker,
if (walker->level == PT_PAGE_TABLE_LEVEL) {
walker->gfn = (*ptep & PT_BASE_ADDR_MASK)
>> PAGE_SHIFT;
if (write_fault && !is_dirty_pte(*ptep)) {
mark_page_dirty(vcpu->kvm, table_gfn);
*ptep |= PT_DIRTY_MASK;
}
break;
}

Expand All @@ -153,6 +157,10 @@ static int FNAME(walk_addr)(struct guest_walker *walker,
walker->gfn = (*ptep & PT_DIR_BASE_ADDR_MASK)
>> PAGE_SHIFT;
walker->gfn += PT_INDEX(addr, PT_PAGE_TABLE_LEVEL);
if (write_fault && !is_dirty_pte(*ptep)) {
mark_page_dirty(vcpu->kvm, table_gfn);
*ptep |= PT_DIRTY_MASK;
}
break;
}

Expand Down Expand Up @@ -194,12 +202,6 @@ static int FNAME(walk_addr)(struct guest_walker *walker,
return 0;
}

static void FNAME(mark_pagetable_dirty)(struct kvm *kvm,
struct guest_walker *walker)
{
mark_page_dirty(kvm, walker->table_gfn[walker->level - 1]);
}

static void FNAME(set_pte_common)(struct kvm_vcpu *vcpu,
u64 *shadow_pte,
gpa_t gaddr,
Expand All @@ -221,23 +223,6 @@ static void FNAME(set_pte_common)(struct kvm_vcpu *vcpu,
__FUNCTION__, *shadow_pte, (u64)gpte, access_bits,
write_fault, user_fault, gfn);

if (write_fault && !dirty) {
pt_element_t *guest_ent, *tmp = NULL;

if (walker->ptep)
guest_ent = walker->ptep;
else {
tmp = kmap_atomic(walker->page, KM_USER0);
guest_ent = &tmp[walker->index];
}

*guest_ent |= PT_DIRTY_MASK;
if (!walker->ptep)
kunmap_atomic(tmp, KM_USER0);
dirty = 1;
FNAME(mark_pagetable_dirty)(vcpu->kvm, walker);
}

/*
* We don't set the accessed bit, since we sometimes want to see
* whether the guest actually used the pte (in order to detect
Expand Down

0 comments on commit 535cedd

Please sign in to comment.