Skip to content

Commit afeb96c

Browse files
ubizjakliuw
authored andcommitted
x86/hyperv: Use any general-purpose register when saving %cr2 and %cr8
hv_hvcrash_ctxt_save() in arch/x86/hyperv/hv_crash.c currently saves %cr2 and %cr8 using %eax ("=a"). This unnecessarily forces a specific register. Update the inline assembly to use a general-purpose register ("=r") for both %cr2 and %cr8. This makes the code more flexible for the compiler while producing the same saved context contents. No functional changes. Signed-off-by: Uros Bizjak <[email protected]> Cc: K. Y. Srinivasan <[email protected]> Cc: Haiyang Zhang <[email protected]> Cc: Wei Liu <[email protected]> Cc: Dexuan Cui <[email protected]> Cc: Long Li <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: H. Peter Anvin <[email protected]> Signed-off-by: Wei Liu <[email protected]>
1 parent 2536091 commit afeb96c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

arch/x86/hyperv/hv_crash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ static void hv_hvcrash_ctxt_save(void)
204204
ctxt->cr0 = native_read_cr0();
205205
ctxt->cr4 = native_read_cr4();
206206

207-
asm volatile("movq %%cr2, %0" : "=a"(ctxt->cr2));
208-
asm volatile("movq %%cr8, %0" : "=a"(ctxt->cr8));
207+
asm volatile("movq %%cr2, %0" : "=r"(ctxt->cr2));
208+
asm volatile("movq %%cr8, %0" : "=r"(ctxt->cr8));
209209

210210
asm volatile("movw %%cs, %0" : "=m"(ctxt->cs));
211211
asm volatile("movw %%ss, %0" : "=m"(ctxt->ss));

0 commit comments

Comments
 (0)