/* SPDX-License-Identifier: GPL-2.0 */1/*2*3* Trampoline.S Derived from Setup.S by Linus Torvalds4*5* 4 Jan 1997 Michael Chastain: changed to gnu as.6*7* This is only used for booting secondary CPUs in SMP machine8*9* Entry: CS:IP point to the start of our code, we are10* in real mode with no stack, but the rest of the11* trampoline page to make our stack and everything else12* is a mystery.13*14* We jump into arch/x86/kernel/head_32.S.15*16* On entry to trampoline_start, the processor is in real mode17* with 16-bit addressing and 16-bit data. CS has some value18* and IP is zero. Thus, we load CS to the physical segment19* of the real mode code before doing anything further.20*/2122#include <linux/linkage.h>23#include <asm/segment.h>24#include <asm/page_types.h>25#include "realmode.h"2627.text28.code162930.balign PAGE_SIZE31SYM_CODE_START(trampoline_start)32wbinvd # Needed for NUMA-Q should be harmless for others3334LJMPW_RM(1f)351:36mov %cs, %ax # Code and data in the same place37mov %ax, %ds3839cli # We should be safe anyway4041movl tr_start, %eax # where we need to go4243/*44* GDT tables in non default location kernel can be beyond 16MB and45* lgdt will not be able to load the address as in real mode default46* operand size is 16bit. Use lgdtl instead to force operand size47* to 32 bit.48*/49lidtl tr_idt # load idt with 0, 050lgdtl tr_gdt # load gdt with whatever is appropriate5152movw $1, %dx # protected mode (PE) bit53lmsw %dx # into protected mode5455ljmpl $__BOOT_CS, $pa_startup_3256SYM_CODE_END(trampoline_start)5758.section ".text32","ax"59.code3260SYM_CODE_START(startup_32) # note: also used from wakeup_asm.S61jmp *%eax62SYM_CODE_END(startup_32)6364.bss65.balign 866SYM_DATA_START(trampoline_header)67SYM_DATA_LOCAL(tr_start, .space 4)68SYM_DATA_LOCAL(tr_gdt_pad, .space 2)69SYM_DATA_LOCAL(tr_gdt, .space 6)70SYM_DATA_END(trampoline_header)7172#include "trampoline_common.S"737475