* [PATCH] x86: use kvm_read/write_guest_virt for reading and writing segment descriptors
@ 2009-08-10 17:11 Mikhail Ershov
2009-08-16 12:04 ` Avi Kivity
0 siblings, 1 reply; 4+ messages in thread
From: Mikhail Ershov @ 2009-08-10 17:11 UTC (permalink / raw)
To: kvm
Descriptor table can be placed on two non-contiguous pages.
It is better to read descriptor by linear address.
Signed-off-by: Mikhail Ershov <Mike.Ershov@gmail.com>
---
arch/x86/kvm/x86.c | 10 ++--------
1 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 850cf56..13f39bb 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4017,7 +4017,6 @@ static void get_segment_descriptor_dtable(struct
kvm_vcpu *vcpu,
static int load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
struct desc_struct *seg_desc)
{
- gpa_t gpa;
struct descriptor_table dtable;
u16 index = selector >> 3;
@@ -4027,16 +4026,13 @@ static int
load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
kvm_queue_exception_e(vcpu, GP_VECTOR, selector & 0xfffc);
return 1;
}
- gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, dtable.base);
- gpa += index * 8;
- return kvm_read_guest(vcpu->kvm, gpa, seg_desc, 8);
+ return kvm_read_guest_virt(dtable.base + index*8, seg_desc,
sizeof(*seg_desc), vcpu);
}
/* allowed just for 8 bytes segments */
static int save_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
struct desc_struct *seg_desc)
{
- gpa_t gpa;
struct descriptor_table dtable;
u16 index = selector >> 3;
@@ -4044,9 +4040,7 @@ static int save_guest_segment_descriptor(struct
kvm_vcpu *vcpu, u16 selector,
if (dtable.limit < index * 8 + 7)
return 1;
- gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, dtable.base);
- gpa += index * 8;
- return kvm_write_guest(vcpu->kvm, gpa, seg_desc, 8);
+ return kvm_write_guest_virt(dtable.base + index*8, seg_desc,
sizeof(*seg_desc), vcpu);
}
static u32 get_tss_base_addr(struct kvm_vcpu *vcpu,
--
1.6.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] x86: use kvm_read/write_guest_virt for reading and writing segment descriptors
2009-08-10 17:11 [PATCH] x86: use kvm_read/write_guest_virt for reading and writing segment descriptors Mikhail Ershov
@ 2009-08-16 12:04 ` Avi Kivity
2009-08-19 10:42 ` Mikhail Ershov
0 siblings, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2009-08-16 12:04 UTC (permalink / raw)
To: Mikhail Ershov; +Cc: kvm
On 08/10/2009 08:11 PM, Mikhail Ershov wrote:
> Descriptor table can be placed on two non-contiguous pages.
> It is better to read descriptor by linear address.
>
Patch is good, but is whitespace-corrupted. Please send as an
attachment (or using git-send-email).
Make sure the attachment is plain/text so mail clients can display it
inline.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86: use kvm_read/write_guest_virt for reading and writing segment descriptors
2009-08-16 12:04 ` Avi Kivity
@ 2009-08-19 10:42 ` Mikhail Ershov
2009-08-19 10:45 ` Avi Kivity
0 siblings, 1 reply; 4+ messages in thread
From: Mikhail Ershov @ 2009-08-19 10:42 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm
[-- Attachment #1: Type: text/plain, Size: 560 bytes --]
The patch is in attachment.
2009/8/16 Avi Kivity <avi@redhat.com>:
> On 08/10/2009 08:11 PM, Mikhail Ershov wrote:
>>
>> Descriptor table can be placed on two non-contiguous pages.
>> It is better to read descriptor by linear address.
>>
>
> Patch is good, but is whitespace-corrupted. Please send as an attachment
> (or using git-send-email).
>
> Make sure the attachment is plain/text so mail clients can display it
> inline.
>
> --
> error compiling committee.c: too many arguments to function
>
>
--
Best regards,
Mikhail Ershov
[-- Attachment #2: descriptors-read-write.patch.txt --]
[-- Type: text/plain, Size: 2023 bytes --]
From eb73019762ec299ded618d807f5c14859491adbc Mon Sep 17 00:00:00 2001
From: Mikhail Ershov <Mike.Ershov@gmail.com>
Date: Wed, 19 Aug 2009 14:08:07 +0400
Subject: [PATCH] Using kvm_read/write_guest_virt to read and write segment descriptors.
Segment descriptors tables can be placed on two non-contiguous pages.
This patch makes reading segment descriptors by linear address.
Signed-off-by: Mikhail Ershov <Mike.Ershov@gmail.com>
---
arch/x86/kvm/x86.c | 10 ++--------
1 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 52d5d72..aa2dd12 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4017,7 +4017,6 @@ static void get_segment_descriptor_dtable(struct kvm_vcpu *vcpu,
static int load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
struct desc_struct *seg_desc)
{
- gpa_t gpa;
struct descriptor_table dtable;
u16 index = selector >> 3;
@@ -4027,16 +4026,13 @@ static int load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
kvm_queue_exception_e(vcpu, GP_VECTOR, selector & 0xfffc);
return 1;
}
- gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, dtable.base);
- gpa += index * 8;
- return kvm_read_guest(vcpu->kvm, gpa, seg_desc, 8);
+ return kvm_read_guest_virt(dtable.base + index*8, seg_desc, sizeof(*seg_desc), vcpu);
}
/* allowed just for 8 bytes segments */
static int save_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
struct desc_struct *seg_desc)
{
- gpa_t gpa;
struct descriptor_table dtable;
u16 index = selector >> 3;
@@ -4044,9 +4040,7 @@ static int save_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
if (dtable.limit < index * 8 + 7)
return 1;
- gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, dtable.base);
- gpa += index * 8;
- return kvm_write_guest(vcpu->kvm, gpa, seg_desc, 8);
+ return kvm_write_guest_virt(dtable.base + index*8, seg_desc, sizeof(*seg_desc), vcpu);
}
static u32 get_tss_base_addr(struct kvm_vcpu *vcpu,
--
1.6.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] x86: use kvm_read/write_guest_virt for reading and writing segment descriptors
2009-08-19 10:42 ` Mikhail Ershov
@ 2009-08-19 10:45 ` Avi Kivity
0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2009-08-19 10:45 UTC (permalink / raw)
To: Mikhail Ershov; +Cc: kvm
On 08/19/2009 01:42 PM, Mikhail Ershov wrote:
> The patch is in attachment.
>
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-08-19 10:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-10 17:11 [PATCH] x86: use kvm_read/write_guest_virt for reading and writing segment descriptors Mikhail Ershov
2009-08-16 12:04 ` Avi Kivity
2009-08-19 10:42 ` Mikhail Ershov
2009-08-19 10:45 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).