]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
x86/hyperv: Use current_stack_pointer to avoid asm() in hv_hvcrash_ctxt_save()
authorUros Bizjak <ubizjak@gmail.com>
Wed, 11 Mar 2026 10:25:59 +0000 (11:25 +0100)
committerWei Liu <wei.liu@kernel.org>
Thu, 12 Mar 2026 04:25:19 +0000 (04:25 +0000)
Use current_stack_pointer to avoid asm() when saving %rsp to the
crash context memory in hv_hvcrash_ctxt_save(). The new code is
more readable and results in exactly the same object file.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Long Li <longli@microsoft.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
arch/x86/hyperv/hv_crash.c

index 2c7ea7e70854925f8f2296f5937c5e4bbd8c8559..d0f95a278fdb3ea7cda4170b881e604c6604cfb0 100644 (file)
@@ -199,7 +199,7 @@ static void hv_hvcrash_ctxt_save(void)
 {
        struct hv_crash_ctxt *ctxt = &hv_crash_ctxt;
 
-       asm volatile("movq %%rsp,%0" : "=m"(ctxt->rsp));
+       ctxt->rsp = current_stack_pointer;
 
        ctxt->cr0 = native_read_cr0();
        ctxt->cr4 = native_read_cr4();