]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/boot: Use current_stack_pointer to avoid asm() in init_heap()
authorUros Bizjak <ubizjak@gmail.com>
Mon, 20 May 2024 08:29:55 +0000 (10:29 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 21 May 2024 11:36:36 +0000 (13:36 +0200)
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 <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20240520083011.135342-1-ubizjak@gmail.com
arch/x86/boot/main.c

index 9049f390d8347f0d5acc848f9be78a4fcb42275a..ac78f8c01908c52a22c3fdde8738f5e82b34c8d8 100644 (file)
@@ -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)