1 /* SPDX-License-Identifier: GPL-2.0 */
4 * Trampoline.S Derived from Setup.S by Linus Torvalds
6 * 4 Jan 1997 Michael Chastain: changed to gnu as.
8 * This is only used for booting secondary CPUs in SMP machine
10 * Entry: CS:IP point to the start of our code, we are
11 * in real mode with no stack, but the rest of the
12 * trampoline page to make our stack and everything else
15 * We jump into arch/x86/kernel/head_32.S.
17 * On entry to trampoline_start, the processor is in real mode
18 * with 16-bit addressing and 16-bit data. CS has some value
19 * and IP is zero. Thus, we load CS to the physical segment
20 * of the real mode code before doing anything further.
23 #include <linux/linkage.h>
24 #include <asm/segment.h>
25 #include <asm/page_types.h>
32 ENTRY(trampoline_start)
33 wbinvd # Needed for NUMA-Q should be harmless for others
37 mov %cs, %ax # Code and data in the same place
40 cli # We should be safe anyway
42 movl tr_start, %eax # where we need to go
44 movl $0xA5A5A5A5, trampoline_status
45 # write marker for master knows we're running
48 * GDT tables in non default location kernel can be beyond 16MB and
49 * lgdt will not be able to load the address as in real mode default
50 * operand size is 16bit. Use lgdtl instead to force operand size
53 lidtl tr_idt # load idt with 0, 0
54 lgdtl tr_gdt # load gdt with whatever is appropriate
56 movw $1, %dx # protected mode (PE) bit
57 lmsw %dx # into protected mode
59 ljmpl $__BOOT_CS, $pa_startup_32
61 .section ".text32","ax"
63 ENTRY(startup_32) # note: also used from wakeup_asm.S
68 GLOBAL(trampoline_header)
72 END(trampoline_header)
74 #include "trampoline_common.S"