[PATCH] KVM: Fix asm constraints for segment loads

From: Avi Kivity
Date: Sun Nov 12 2006 - 09:03:35 EST


From: Bernhard Rosenkraenzer <bero@xxxxxxxxxxxx>

"g" is an invalid constraint for a segment register load, since it includes
immediate operands, which are illegal for segment moves.

Fix by specifying register or memory operands.

Signed-off-by: Avi Kivity <avi@xxxxxxxxxxxx>

Index: linux-2.6/drivers/kvm/kvm_main.c
===================================================================
--- linux-2.6.orig/drivers/kvm/kvm_main.c
+++ linux-2.6/drivers/kvm/kvm_main.c
@@ -154,12 +154,12 @@ static u16 read_ldt(void)

static void load_fs(u16 sel)
{
- asm ("mov %0, %%fs" : : "g"(sel));
+ asm ("mov %0, %%fs" : : "rm"(sel));
}

static void load_gs(u16 sel)
{
- asm ("mov %0, %%gs" : : "g"(sel));
+ asm ("mov %0, %%gs" : : "rm"(sel));
}

#ifndef load_ldt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/