USB: cp210x: call generic open last in open
[zen-stable.git] / arch / x86 / kernel / trampoline.c
bloba73b61055ad6358adf8e93c107680d66b5f6b2e3
1 #include <linux/io.h>
2 #include <linux/memblock.h>
4 #include <asm/trampoline.h>
5 #include <asm/cacheflush.h>
6 #include <asm/pgtable.h>
8 unsigned char *x86_trampoline_base;
10 void __init setup_trampolines(void)
12 phys_addr_t mem;
13 size_t size = PAGE_ALIGN(x86_trampoline_end - x86_trampoline_start);
15 /* Has to be in very low memory so we can execute real-mode AP code. */
16 mem = memblock_find_in_range(0, 1<<20, size, PAGE_SIZE);
17 if (!mem)
18 panic("Cannot allocate trampoline\n");
20 x86_trampoline_base = __va(mem);
21 memblock_reserve(mem, size);
23 printk(KERN_DEBUG "Base memory trampoline at [%p] %llx size %zu\n",
24 x86_trampoline_base, (unsigned long long)mem, size);
26 memcpy(x86_trampoline_base, x86_trampoline_start, size);
30 * setup_trampolines() gets called very early, to guarantee the
31 * availability of low memory. This is before the proper kernel page
32 * tables are set up, so we cannot set page permissions in that
33 * function. Thus, we use an arch_initcall instead.
35 static int __init configure_trampolines(void)
37 size_t size = PAGE_ALIGN(x86_trampoline_end - x86_trampoline_start);
39 set_memory_x((unsigned long)x86_trampoline_base, size >> PAGE_SHIFT);
40 return 0;
42 arch_initcall(configure_trampolines);