Commit b855cc58 authored by Uros Bizjak's avatar Uros Bizjak Committed by Ingo Molnar
Browse files

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: default avatarUros Bizjak <ubizjak@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20240520083011.135342-1-ubizjak@gmail.com
parent 41c14f1a
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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)