lkml.org 
[lkml]   [2021]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[RFC][PATCH 15/22] x86,vmx: Remove .fixup usage
    In the vmread exceptin path, use the, thus far, unused output register
    to push the @fault argument onto the stack. This, in turn, enables the
    exception handler to not do pushes and only modify that register when
    an exception does occur.

    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    ---
    arch/x86/kvm/vmx/vmx_ops.h | 14 ++++++--------
    1 file changed, 6 insertions(+), 8 deletions(-)

    --- a/arch/x86/kvm/vmx/vmx_ops.h
    +++ b/arch/x86/kvm/vmx/vmx_ops.h
    @@ -80,9 +80,11 @@ static __always_inline unsigned long __v
    * @field, and bounce through the trampoline to preserve
    * volatile registers.
    */
    - "push $0\n\t"
    + "xorl %k1, %k1\n\t"
    + "2:\n\t"
    + "push %1\n\t"
    "push %2\n\t"
    - "2:call vmread_error_trampoline\n\t"
    + "call vmread_error_trampoline\n\t"

    /*
    * Unwind the stack. Note, the trampoline zeros out the
    @@ -93,12 +95,8 @@ static __always_inline unsigned long __v
    "3:\n\t"

    /* VMREAD faulted. As above, except push '1' for @fault. */
    - ".pushsection .fixup, \"ax\"\n\t"
    - "4: push $1\n\t"
    - "push %2\n\t"
    - "jmp 2b\n\t"
    - ".popsection\n\t"
    - _ASM_EXTABLE(1b, 4b)
    + _ASM_EXTABLE_TYPE_REG(1b, 2b, EX_TYPE_ONE_REG, %1)
    +
    : ASM_CALL_CONSTRAINT, "=r"(value) : "r"(field) : "cc");
    return value;
    }

    \
     
     \ /
      Last update: 2021-11-04 18:02    [W:3.561 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site