- Add new cvs code to cvs
[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
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         /* Set the stack pointer, and flag that we are done */
40         xorl    %eax, %eax
41         movl    secondary_stack, %esp
42         movl    %eax, secondary_stack
43
44         call    secondary_cpu_init
45 1:      hlt
46         jmp     1b
47
48 gdtaddr:
49         .word   gdt_limit       /* the table limit */
50         .long   gdt             /* we know the offset */
51
52
53 .code32