From: Uros Bizjak Date: Mon, 20 May 2024 08:29:55 +0000 (+0200) Subject: x86/boot: Use current_stack_pointer to avoid asm() in init_heap() X-Git-Tag: v6.11-rc1~201^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b855cc58fc93c175fd5bb868d5e3a45cb3e1a42b;p=thirdparty%2Fkernel%2Flinux.git x86/boot: Use current_stack_pointer to avoid asm() in init_heap() Use current_stack_pointer to avoid asm() in the calculation of stack_end in init_heap(). The new code is more readable and results in exactly the same object file. Signed-off-by: Uros Bizjak Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20240520083011.135342-1-ubizjak@gmail.com --- diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c index 9049f390d8347..ac78f8c01908c 100644 --- a/arch/x86/boot/main.c +++ b/arch/x86/boot/main.c @@ -119,9 +119,8 @@ static void init_heap(void) char *stack_end; if (boot_params.hdr.loadflags & CAN_USE_HEAP) { - asm("leal %n1(%%esp),%0" - : "=r" (stack_end) : "i" (STACK_SIZE)); - + stack_end = (char *) + (current_stack_pointer - STACK_SIZE); heap_end = (char *) ((size_t)boot_params.hdr.heap_end_ptr + 0x200); if (heap_end > stack_end)