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 <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20240520083011.135342-1-ubizjak@gmail.com
This commit is contained in:
Uros Bizjak
2024-05-20 10:29:55 +02:00
committed by Ingo Molnar
parent 41c14f1ac8
commit b855cc58fc

View 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)