]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - arch/x86/kernel/trampoline.c
x86: Use find_e820() instead of hard coded trampoline address
[net-next-2.6.git] / arch / x86 / kernel / trampoline.c
index cd022121cab611629ec9b04de51677e44bef3567..c652ef62742df62340d03465231e88885c8d5329 100644 (file)
 #endif
 
 /* ready for x86_64 and x86 */
-unsigned char *__trampinitdata trampoline_base = __va(TRAMPOLINE_BASE);
+unsigned char *__trampinitdata 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
+       unsigned long mem;
+
        /* Has to be in very low memory so we can execute real-mode AP code. */
-       reserve_early(TRAMPOLINE_BASE, TRAMPOLINE_BASE + TRAMPOLINE_SIZE,
-                       "TRAMPOLINE");
+       mem = find_e820_area(0, 1<<20, TRAMPOLINE_SIZE, PAGE_SIZE);
+       if (mem == -1L)
+               panic("Cannot allocate trampoline\n");
+
+       trampoline_base = __va(mem);
+       reserve_early(mem, mem + TRAMPOLINE_SIZE, "TRAMPOLINE");
 }
 
 /*