diff options
author | Xiao Guangrong <xiaoguangrong.eric@gmail.com> | 2011-11-24 19:04:35 +0800 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-12-27 11:17:39 +0200 |
commit | 28a37544fb0223eb9805d2567b88f7360edec52a (patch) | |
tree | 83afb64f8448303f9486eb6c87980695611275ab /arch/x86/kvm/vmx.c | |
parent | be6ba0f0962a39091c52eb9167ddea201fe80716 (diff) | |
download | lwn-28a37544fb0223eb9805d2567b88f7360edec52a.tar.gz lwn-28a37544fb0223eb9805d2567b88f7360edec52a.zip |
KVM: introduce id_to_memslot function
Introduce id_to_memslot to get memslot by slot id
Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index ba24022f4575..8f19d91ec3e7 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2711,11 +2711,13 @@ static gva_t rmode_tss_base(struct kvm *kvm) { if (!kvm->arch.tss_addr) { struct kvm_memslots *slots; + struct kvm_memory_slot *slot; gfn_t base_gfn; slots = kvm_memslots(kvm); - base_gfn = slots->memslots[0].base_gfn + - kvm->memslots->memslots[0].npages - 3; + slot = id_to_memslot(slots, 0); + base_gfn = slot->base_gfn + slot->npages - 3; + return base_gfn << PAGE_SHIFT; } return kvm->arch.tss_addr; |