Skip to content

Commit b855cc5

Browse files
ubizjakIngo Molnar
authored andcommitted
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 <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 41c14f1 commit b855cc5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

arch/x86/boot/main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,8 @@ static void init_heap(void)
119119
char *stack_end;
120120

121121
if (boot_params.hdr.loadflags & CAN_USE_HEAP) {
122-
asm("leal %n1(%%esp),%0"
123-
: "=r" (stack_end) : "i" (STACK_SIZE));
124-
122+
stack_end = (char *)
123+
(current_stack_pointer - STACK_SIZE);
125124
heap_end = (char *)
126125
((size_t)boot_params.hdr.heap_end_ptr + 0x200);
127126
if (heap_end > stack_end)

0 commit comments

Comments
 (0)