-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x86: change static allocation of trampoline area
Impact: fix trampoline sizing bug, save space While debugging a suspend-to-RAM related issue it occured to me that if the trampoline code had grown past 4 KB, we would have been allocating too little memory for it, since the 4 KB size of the trampoline is hardcoded into arch/x86/kernel/e820.c . Change that by making the kernel compute the trampoline size and allocate as much memory as necessary. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
- Loading branch information
Rafael J. Wysocki
authored and
Ingo Molnar
committed
Dec 8, 2008
1 parent
218d11a
commit 3e1e900
Showing
5 changed files
with
30 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,33 @@ | ||
#include <linux/io.h> | ||
|
||
#include <asm/trampoline.h> | ||
#include <asm/e820.h> | ||
|
||
/* ready for x86_64 and x86 */ | ||
unsigned char *trampoline_base = __va(TRAMPOLINE_BASE); | ||
|
||
void __init reserve_trampoline_memory(void) | ||
{ | ||
#ifdef CONFIG_X86_32 | ||
/* | ||
* But first pinch a few for the stack/trampoline stuff | ||
* FIXME: Don't need the extra page at 4K, but need to fix | ||
* trampoline before removing it. (see the GDT stuff) | ||
*/ | ||
reserve_early(PAGE_SIZE, PAGE_SIZE + PAGE_SIZE, "EX TRAMPOLINE"); | ||
#endif | ||
/* Has to be in very low memory so we can execute real-mode AP code. */ | ||
reserve_early(TRAMPOLINE_BASE, TRAMPOLINE_BASE + TRAMPOLINE_SIZE, | ||
"TRAMPOLINE"); | ||
} | ||
|
||
/* | ||
* Currently trivial. Write the real->protected mode | ||
* bootstrap into the page concerned. The caller | ||
* has made sure it's suitably aligned. | ||
*/ | ||
unsigned long setup_trampoline(void) | ||
{ | ||
memcpy(trampoline_base, trampoline_data, | ||
trampoline_end - trampoline_data); | ||
memcpy(trampoline_base, trampoline_data, TRAMPOLINE_SIZE); | ||
return virt_to_phys(trampoline_base); | ||
} |