abb4a97236ff7843c0788f556b00e2b7e66d29e7
[coreboot.git] / src / cpu / x86 / 32bit / entry32.inc
1 /* For starting coreboot in protected mode */
2
3 #include <arch/rom_segs.h>
4
5         .code32
6
7
8         /* This is the GDT for the ROM stage part of coreboot. It 
9          * is different from the RAM stage GDT which is defined in 
10          * c_start.S
11          */
12
13         .align  4
14 .globl gdtptr
15 gdt:
16 gdtptr:
17         .word   gdt_end - gdt -1 /* compute the table limit */
18         .long   gdt              /* we know the offset */
19         .word   0
20
21         /* selgdt 0x08, flat code segment */
22         .word   0xffff, 0x0000
23         .byte   0x00, 0x9b, 0xcf, 0x00 /* G=1 and 0x0f, So we get 4Gbytes for limit */
24
25         /* selgdt 0x10,flat data segment */
26         .word   0xffff, 0x0000
27         .byte   0x00, 0x93, 0xcf, 0x00
28
29 gdt_end:
30
31
32 /*
33  *      When we come here we are in protected mode. We expand
34  *      the stack and copies the data segment from ROM to the
35  *      memory.
36  *
37  *      After that, we call the chipset bootstrap routine that
38  *      does what is left of the chipset initialization.
39  *
40  *      NOTE aligned to 4 so that we are sure that the prefetch
41  *      cache will be reloaded.
42  */
43         .align  4
44 .globl protected_start
45 protected_start:
46
47         lgdt    %cs:gdtptr
48         ljmp    $ROM_CODE_SEG, $__protected_start
49
50 __protected_start:
51         /* Save the BIST value */
52         movl    %eax, %ebp
53
54         post_code(0x10) /* post 10 */
55
56         movw    $ROM_DATA_SEG, %ax
57         movw    %ax, %ds
58         movw    %ax, %es
59         movw    %ax, %ss
60         movw    %ax, %fs
61         movw    %ax, %gs
62
63         /* Restore the BIST value to %eax */
64         movl    %ebp, %eax
65