issue 51 and 52: set mtrr for ap before stop it, and _RAMBASE above 1M
[coreboot.git] / src / cpu / x86 / lapic / secondary.S
1 #include <arch/asm.h>
2 #include <arch/intel.h>
3 #include <cpu/x86/mtrr.h>
4 #include <cpu/x86/lapic_def.h>
5         .text
6         .globl _secondary_start, _secondary_start_end
7         .balign 4096
8 _secondary_start:
9         .code16
10         cli
11         xorl    %eax, %eax
12         movl    %eax, %cr3    /* Invalidate TLB*/
13
14         /* On hyper threaded cpus, invalidating the cache here is
15          * very very bad.  Don't.
16          */
17
18         /* setup the data segment */
19         movw    %cs, %ax
20         movw    %ax, %ds
21
22         data32  lgdt    gdtaddr  - _secondary_start
23
24         movl    %cr0, %eax
25         andl    $0x7FFAFFD1, %eax /* PG,AM,WP,NE,TS,EM,MP = 0 */
26         orl     $0x60000001, %eax /* CD, NW, PE = 1 */
27         movl    %eax, %cr0
28
29         ljmpl   $0x10, $1f
30 1:      
31         .code32
32         movw    $0x18, %ax
33         movw    %ax, %ds
34         movw    %ax, %es
35         movw    %ax, %ss
36         movw    %ax, %fs
37         movw    %ax, %gs
38
39         /* Load the Interrupt descriptor table */
40         lidt    idtarg
41
42         /* Set the stack pointer, and flag that we are done */
43         xorl    %eax, %eax
44         movl    secondary_stack, %esp
45         movl    %eax, secondary_stack
46
47         call    secondary_cpu_init
48 1:      hlt
49         jmp     1b
50
51         gdtaddr:
52         .word   gdt_limit       /* the table limit */
53         .long   gdt             /* we know the offset */
54
55 _secondary_start_end:
56 .code32