• Paolo Bonzini's avatar
    KVM: selftests: do not blindly clobber registers in guest asm · 204c91ef
    Paolo Bonzini authored
    The guest_code of sync_regs_test is assuming that the compiler will not
    touch %r11 outside the asm that increments it, which is a bit brittle.
    Instead, we can increment a variable and use a dummy asm to ensure the
    increment is not optimized away.  However, we also need to use a
    callee-save register or the compiler will insert a save/restore around
    the vmexit, breaking the whole idea behind the test.
    
    (Yes, "if it ain't broken...", but I would like the test to be clean
    before it is copied into the upcoming s390 selftests).
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    204c91ef
sync_regs_test.c 7.05 KB