Commit | Line | Data |
---|---|---|
48927bbb JS |
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 | * This is only used for booting secondary CPUs in SMP machine | |
8 | * | |
9 | * Entry: CS:IP point to the start of our code, we are | |
10 | * in real mode with no stack, but the rest of the | |
11 | * trampoline page to make our stack and everything else | |
12 | * is a mystery. | |
13 | * | |
14 | * We jump into arch/x86/kernel/head_32.S. | |
15 | * | |
f37240f1 | 16 | * On entry to trampoline_start, the processor is in real mode |
48927bbb JS |
17 | * with 16-bit addressing and 16-bit data. CS has some value |
18 | * and IP is zero. Thus, we load CS to the physical segment | |
19 | * of the real mode code before doing anything further. | |
48927bbb JS |
20 | */ |
21 | ||
22 | #include <linux/linkage.h> | |
48927bbb JS |
23 | #include <asm/segment.h> |
24 | #include <asm/page_types.h> | |
e5684ec4 | 25 | #include "realmode.h" |
48927bbb JS |
26 | |
27 | .text | |
28 | .code16 | |
48927bbb | 29 | |
8e029fcd | 30 | .balign PAGE_SIZE |
f37240f1 | 31 | ENTRY(trampoline_start) |
48927bbb JS |
32 | wbinvd # Needed for NUMA-Q should be harmless for others |
33 | ||
e5684ec4 | 34 | LJMPW_RM(1f) |
48927bbb JS |
35 | 1: |
36 | mov %cs, %ax # Code and data in the same place | |
37 | mov %ax, %ds | |
38 | ||
39 | cli # We should be safe anyway | |
40 | ||
f37240f1 | 41 | movl tr_start, %eax # where we need to go |
968ff9ee | 42 | |
48927bbb JS |
43 | movl $0xA5A5A5A5, trampoline_status |
44 | # write marker for master knows we're running | |
45 | ||
968ff9ee PA |
46 | /* |
47 | * GDT tables in non default location kernel can be beyond 16MB and | |
48927bbb JS |
48 | * lgdt will not be able to load the address as in real mode default |
49 | * operand size is 16bit. Use lgdtl instead to force operand size | |
50 | * to 32 bit. | |
51 | */ | |
f37240f1 JS |
52 | lidtl tr_idt # load idt with 0, 0 |
53 | lgdtl tr_gdt # load gdt with whatever is appropriate | |
48927bbb | 54 | |
968ff9ee PA |
55 | movw $1, %dx # protected mode (PE) bit |
56 | lmsw %dx # into protected mode | |
48927bbb | 57 | |
968ff9ee PA |
58 | ljmpl $__BOOT_CS, $pa_startup_32 |
59 | ||
60 | .section ".text32","ax" | |
61 | .code32 | |
62 | ENTRY(startup_32) # note: also used from wakeup_asm.S | |
63 | jmp *%eax | |
48927bbb | 64 | |
51edbe6a PA |
65 | .bss |
66 | .balign 8 | |
67 | GLOBAL(trampoline_header) | |
68 | tr_start: .space 4 | |
69 | tr_gdt_pad: .space 2 | |
70 | tr_gdt: .space 6 | |
71 | END(trampoline_header) | |
72 | ||
f37240f1 | 73 | #include "trampoline_common.S" |