Avi Kivity wrote on 2013-02-20: > On Wed, Feb 20, 2013 at 3:10 PM, Zhang, Yang Z <yang.z.zhang@xxxxxxxxx> > wrote: >>>>> >>>>> push %%cs >>>> "push %%cs" is invalid in x86_64. >>> >>> Oops. 'push[lq] $__KERNEL_CS' then. >> Is this right? Just copy it from other file. >> >> #define __STR(X) #X >> #define STR(X) __STR(X) >> >> #ifdef CONFIG_X86_64 >> "pushq $"STR(__KERNEL_CS)" \n\t" #else "pushl >> $"STR(__KERNEL_CS)" \n\t" >> #endif >> >> #undef STR >> #undef __STR >> > > Use __ASM_SIZE and an immediate operand for __KERNEL_CS: > > asm ( ... : : [cs]"i"(__KERNEL_CS) ); > and the code will be cleaner. Thanks. Here is code after changing, please review it: asm( "mov %0, %%" _ASM_DX " \n\t" #ifdef CONFIG_X86_64 "mov %%" _ASM_SP ", %%" _ASM_BX " \n\t" "and $0xfffffffffffffff0, %%" _ASM_SP " \n\t" "mov %%ss, %%" _ASM_AX " \n\t" "push %%" _ASM_AX " \n\t" "push %%" _ASM_BX " \n\t" #endif "pushf \n\t" "orl $0x200, (%%" _ASM_SP ") \n\t" __ASM_SIZE(push) " %c[cs] \n\t" "call *%% " _ASM_DX " \n\t" : : "m"(entry), [cs]"i"(__KERNEL_CS) : #ifdef CONFIG_X86_64 "rax", "rbx", "rdx" #else "edx" #endif ); Best regards, Yang -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html