1/* 2 * 3 * Trampoline.S Derived from Setup.S by Linus Torvalds 4 * 5 * 4 Jan 1997 Michael Chastain: changed to gnu as. 6 * 7 * Entry: CS:IP point to the start of our code, we are 8 * in real mode with no stack, but the rest of the 9 * trampoline page to make our stack and everything else 10 * is a mystery. 11 * 12 * In fact we don't actually need a stack so we don't 13 * set one up. 14 * 15 * We jump into the boot/compressed/head.S code. So you'd 16 * better be running a compressed kernel image or you 17 * won't get very far. 18 * 19 * On entry to trampoline_data, the processor is in real mode 20 * with 16-bit addressing and 16-bit data. CS has some value 21 * and IP is zero. Thus, data addresses need to be absolute 22 * (no relocation) and are taken with regard to r_base. 23 * 24 * If you work on this file, check the object module with objdump 25 * --full-contents --reloc to make sure there are no relocation 26 * entries except for the gdt one.. 27 */ 28 29#include <linux/linkage.h> 30#include <asm/segment.h> 31#include <asm/page.h> 32 33.data 34 35.code16 36 37ENTRY(trampoline_data) 38r_base = . 39 wbinvd # Needed for NUMA-Q should be harmless for others 40 mov %cs, %ax # Code and data in the same place 41 mov %ax, %ds 42 43 mov $1, %bx # Flag an SMP trampoline 44 cli # We should be safe anyway 45 46 movl $0xA5A5A5A5, trampoline_data - r_base 47 # write marker for master knows we're running 48 49 lidt idt_48 - r_base # load idt with 0, 0 50 lgdt gdt_48 - r_base # load gdt with whatever is appropriate 51 52 xor %ax, %ax 53 inc %ax # protected mode (PE) bit 54 lmsw %ax # into protected mode 55 jmp flush_instr 56flush_instr: 57 ljmpl $__KERNEL_CS, $0x00100000 58 # jump to startup_32 in arch/i386/kernel/head.S 59 60idt_48: 61 .word 0 # idt limit = 0 62 .word 0, 0 # idt base = 0L 63 64gdt_48: 65 .word 0x0800 # gdt limit = 2048, 256 GDT entries 66 .long gdt_table-__PAGE_OFFSET # gdt base = gdt (first SMP CPU) 67 68.globl SYMBOL_NAME(trampoline_end) 69SYMBOL_NAME_LABEL(trampoline_end) 70