public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* Re: kvm: how big is type?
       [not found] <1209323919.14173.73.camel@brick>
@ 2008-04-28 11:44 ` Avi Kivity
  2008-04-28 15:23   ` Izik Eidus
  0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2008-04-28 11:44 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: kvm-devel, LKML

Harvey Harrison wrote:
> arch/x86/kvm/x86.c:3484:25: warning: cast truncates bits from constant value (100 becomes 0)
> arch/x86/kvm/x86.c:3510:24: warning: cast truncates bits from constant value (100 becomes 0)
>
> The problem:
> 		cseg_desc.type &= ~(1 << 8); //clear the B flag
> 		nseg_desc.type |= (1 << 8);
>
> type is a 4-bit bitfield on x86....please look into this.
>
>   

I think it ought to be (1 << 1), not (1 << 8), as it refers to the 
"busy" bit of the task type.  Izik?


-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: kvm: how big is type?
  2008-04-28 11:44 ` kvm: how big is type? Avi Kivity
@ 2008-04-28 15:23   ` Izik Eidus
  2008-04-28 16:10     ` Avi Kivity
  0 siblings, 1 reply; 3+ messages in thread
From: Izik Eidus @ 2008-04-28 15:23 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Harvey Harrison, LKML, kvm-devel

Avi Kivity wrote:
> Harvey Harrison wrote:
>> arch/x86/kvm/x86.c:3484:25: warning: cast truncates bits from constant
>> value (100 becomes 0)
>> arch/x86/kvm/x86.c:3510:24: warning: cast truncates bits from constant
>> value (100 becomes 0)
>>
>> The problem:
>>         cseg_desc.type &= ~(1 << 8); //clear the B flag
>>         nseg_desc.type |= (1 << 8);
>>
>> type is a 4-bit bitfield on x86....please look into this.
>>
>>   
> 
> I think it ought to be (1 << 1), not (1 << 8), as it refers to the
> "busy" bit of the task type.  Izik?
> 
> 
>From cf6e76c69a38a983df0c84a3dcc2336042eb3436 Mon Sep 17 00:00:00 2001
From: Izik Eidus <izike@qumranet.com>
Date: Mon, 28 Apr 2008 18:16:08 +0300
Subject: [PATCH] KVM: x86: task switch: fix wrong bit setting for the busy flag.
 the busy bit is in offset of 1 inside type and not in 8.

Signed-off-by: Izik Eidus <izike@qumranet.com>
---
 arch/x86/kvm/x86.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 0ce5563..5c360bb 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3481,7 +3481,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason)
 	}
 
 	if (reason == TASK_SWITCH_IRET || reason == TASK_SWITCH_JMP) {
-		cseg_desc.type &= ~(1 << 8); //clear the B flag
+		cseg_desc.type &= ~(1 << 1); //clear the B flag
 		save_guest_segment_descriptor(vcpu, tr_seg.selector,
 					      &cseg_desc);
 	}
@@ -3507,7 +3507,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason)
 	}
 
 	if (reason != TASK_SWITCH_IRET) {
-		nseg_desc.type |= (1 << 8);
+		nseg_desc.type |= (1 << 1);
 		save_guest_segment_descriptor(vcpu, tss_selector,
 					      &nseg_desc);
 	}
-- 
1.5.3.6


-- 
woof.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: kvm: how big is type?
  2008-04-28 15:23   ` Izik Eidus
@ 2008-04-28 16:10     ` Avi Kivity
  0 siblings, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2008-04-28 16:10 UTC (permalink / raw)
  To: Izik Eidus; +Cc: Harvey Harrison, LKML, kvm-devel

Izik Eidus wrote:
> Avi Kivity wrote:
>   
>> Harvey Harrison wrote:
>>     
>>> arch/x86/kvm/x86.c:3484:25: warning: cast truncates bits from constant
>>> value (100 becomes 0)
>>> arch/x86/kvm/x86.c:3510:24: warning: cast truncates bits from constant
>>> value (100 becomes 0)
>>>
>>> The problem:
>>>         cseg_desc.type &= ~(1 << 8); //clear the B flag
>>>         nseg_desc.type |= (1 << 8);
>>>
>>> type is a 4-bit bitfield on x86....please look into this.
>>>
>>>   
>>>       
>> I think it ought to be (1 << 1), not (1 << 8), as it refers to the
>> "busy" bit of the task type.  Izik?
>>
>>
>>     
> From cf6e76c69a38a983df0c84a3dcc2336042eb3436 Mon Sep 17 00:00:00 2001
> From: Izik Eidus <izike@qumranet.com>
> Date: Mon, 28 Apr 2008 18:16:08 +0300
> Subject: [PATCH] KVM: x86: task switch: fix wrong bit setting for the busy flag.
>  the busy bit is in offset of 1 inside type and not in 8.
>   

Applied, thanks.


-- 
error compiling committee.c: too many arguments to function

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-28 16:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1209323919.14173.73.camel@brick>
2008-04-28 11:44 ` kvm: how big is type? Avi Kivity
2008-04-28 15:23   ` Izik Eidus
2008-04-28 16:10     ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox