Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

Commit

Permalink
x86/boot/compressed/64: Use stack from trampoline memory
Browse files Browse the repository at this point in the history
As the first step on using trampoline memory, let's make 32-bit code use
stack there.

Separate stack is required to return back from trampoline and we cannot
user stack from 64-bit mode as it may be above 4G.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/20180312100246.89175-3-kirill.shutemov@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
kiryl authored and Ingo Molnar committed Mar 12, 2018
1 parent 7beebac commit f7ff53e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/x86/boot/compressed/head_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <asm/processor-flags.h>
#include <asm/asm-offsets.h>
#include <asm/bootparam.h>
#include "pgtable.h"

/*
* Locally defined symbols should be marked hidden:
Expand Down Expand Up @@ -359,6 +360,8 @@ ENTRY(startup_64)
pushq %rax
lretq
lvl5:
/* Restore the stack, the 32-bit trampoline uses its own stack */
leaq boot_stack_end(%rbx), %rsp

/*
* cleanup_trampoline() would restore trampoline memory.
Expand Down Expand Up @@ -513,6 +516,9 @@ compatible_mode:
movl %eax, %ds
movl %eax, %ss

/* Set up new stack */
leal TRAMPOLINE_32BIT_STACK_END(%ecx), %esp

/* Disable paging */
movl %cr0, %eax
btrl $X86_CR0_PG_BIT, %eax
Expand Down

0 comments on commit f7ff53e

Please sign in to comment.