trampoline.c 958 Bytes
Newer Older
Ingo Molnar's avatar
Ingo Molnar committed
1
2
3
#include <linux/io.h>

#include <asm/trampoline.h>
4
#include <asm/e820.h>
Ingo Molnar's avatar
Ingo Molnar committed
5

6
/* ready for x86_64 and x86 */
7
unsigned char *__cpuinitdata trampoline_base = __va(TRAMPOLINE_BASE);
Ingo Molnar's avatar
Ingo Molnar committed
8

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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");
}

Ingo Molnar's avatar
Ingo Molnar committed
24
25
26
27
28
/*
 * Currently trivial. Write the real->protected mode
 * bootstrap into the page concerned. The caller
 * has made sure it's suitably aligned.
 */
29
unsigned long __cpuinit setup_trampoline(void)
Ingo Molnar's avatar
Ingo Molnar committed
30
{
31
	memcpy(trampoline_base, trampoline_data, TRAMPOLINE_SIZE);
Ingo Molnar's avatar
Ingo Molnar committed
32
33
	return virt_to_phys(trampoline_base);
}