]> Pileus Git - ~andy/linux/commitdiff
x86, paravirt: Replace GET_CR2_INTO_RCX with GET_CR2_INTO_RAX
authorH. Peter Anvin <hpa@zytor.com>
Thu, 19 Apr 2012 00:16:48 +0000 (17:16 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Thu, 19 Apr 2012 22:07:56 +0000 (15:07 -0700)
GET_CR2_INTO_RCX is asinine: it is only used in one place, the actual
paravirt call returns the value in %rax, not %rcx; and the one place
that wants it wants the result in %r9.  We actually generate as a
result of this call:

       call ...
       movq %rax, %rcx
       xorq %rax, %rax /* this value isn't even used... */
       movq %rcx, %r9

At least make the macro do what the paravirt call does, which is put
the value into %rax.

Nevermind the fact that the macro clobbers all the volatile registers.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Link: http://lkml.kernel.org/r/1334794610-5546-4-git-send-email-hpa@zytor.com
Cc: Glauber de Oliveira Costa <glommer@parallels.com>
arch/x86/include/asm/paravirt.h
arch/x86/kernel/head_64.S

index aa0f913083676a5b618ad733a36f9471176dcb88..6cbbabf52707f9d492a3e3d6687c37b24369cdfb 100644 (file)
@@ -1023,10 +1023,8 @@ extern void default_banner(void);
                  call PARA_INDIRECT(pv_cpu_ops+PV_CPU_swapgs)          \
                 )
 
-#define GET_CR2_INTO_RCX                               \
-       call PARA_INDIRECT(pv_mmu_ops+PV_MMU_read_cr2); \
-       movq %rax, %rcx;                                \
-       xorq %rax, %rax;
+#define GET_CR2_INTO_RAX                               \
+       call PARA_INDIRECT(pv_mmu_ops+PV_MMU_read_cr2)
 
 #define PARAVIRT_ADJUST_EXCEPTION_FRAME                                        \
        PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_adjust_exception_frame), \
index adf52e85d551abed3de356b9acde7e2e4c7e3643..d1e112c8b57727fc055fce99942884465826c82f 100644 (file)
@@ -23,8 +23,9 @@
 #ifdef CONFIG_PARAVIRT
 #include <asm/asm-offsets.h>
 #include <asm/paravirt.h>
+#define GET_CR2_INTO(reg) GET_CR2_INTO_RAX ; movq %rax, reg
 #else
-#define GET_CR2_INTO_RCX movq %cr2, %rcx
+#define GET_CR2_INTO(reg) movq %cr2, reg
 #endif
 
 /* we are not able to switch in one step to the final KERNEL ADDRESS SPACE
@@ -286,8 +287,7 @@ ENTRY(early_idt_handler)
        cmpl $2,early_recursion_flag(%rip)
        jz  1f
        incl early_recursion_flag(%rip)
-       GET_CR2_INTO_RCX
-       movq %rcx,%r9
+       GET_CR2_INTO(%r9)
        xorl %r8d,%r8d          # zero for error code
        movl %esi,%ecx          # get vector number
        # Test %ecx against mask of vectors that push error code.