1 #include <cpu/x86/post_code.h>
17 post_code(0x13) /* post 13 */
24 shrl $2, %ecx /* it is 32 bit aligned, right? */
34 shrl $2, %ecx /* it is 32 bit aligned, right? */
43 /* Push the cpu index and struct cpu */
47 /* push the boot_complete flag */
50 /* Save the stack location */
53 /* Initialize the Interrupt Descriptor table */
56 movl $(0x10 << 16), %eax /* cs selector */
60 movw $0x8E00, %dx /* Interrupt gate - dpl=0, present */
68 /* Load the Interrupt descriptor table */
72 * Now we are finished. Memory is up, data is copied and
73 * bss is cleared. Now we call the main routine and
76 post_code(0xfe) /* post fe */
78 /* Restore the stack location */
81 /* The boot_complete flag has already been pushed */
85 post_code(0xee) /* post ee */
90 pushl $0 /* error code */
94 pushl $0 /* error code */
99 pushl $0 /* error code */
100 pushl $2 /* vector */
104 pushl $0 /* error code */
105 pushl $3 /* vector */
109 pushl $0 /* error code */
110 pushl $4 /* vector */
114 pushl $0 /* error code */
115 pushl $5 /* vector */
119 pushl $0 /* error code */
120 pushl $6 /* vector */
124 pushl $0 /* error code */
125 pushl $7 /* vector */
130 pushl $8 /* vector */
135 pushl $0 /* error code */
136 pushl $9 /* vector */
141 pushl $10 /* vector */
147 pushl $11 /* vector */
153 pushl $12 /* vector */
159 pushl $13 /* vector */
165 pushl $14 /* vector */
170 pushl $0 /* error code */
171 pushl $15 /* vector */
175 pushl $0 /* error code */
176 pushl $16 /* vector */
181 pushl $17 /* vector */
186 pushl $0 /* error code */
187 pushl $18 /* vector */
191 pushl $0 /* error code */
192 pushl $19 /* vector */
196 /* At this point on the stack there is:
206 /* Original stack pointer */
214 pushl %esp /* Pointer to structure on the stack */
216 pop %eax /* Drop the pointer */
222 popl %ebp /* Ignore saved %esp value */
227 addl $8, %esp /* pop of the vector and error code */
231 #if CONFIG_GDB_STUB == 1
233 .globl gdb_stub_breakpoint
235 popl %eax /* Return address */
238 pushl %eax /* Return address */
239 pushl $0 /* No error code */
240 pushl $32 /* vector 32 is user defined */
245 .globl gdt, gdt_end, gdt_limit, idtarg
247 gdt_limit = gdt_end - gdt - 1 /* compute the table limit */
250 .long gdt /* we know the offset */
254 /* This is the gdt for GCC part of coreboot.
255 * It is different from the gdt in ROMCC/ASM part of coreboot
256 * which is defined in entry32.inc
258 * When the machine is initially started, we use a very simple
259 * gdt from rom (that in entry32.inc) which only contains those
260 * entries we need for protected mode.
262 * When we're executing code from RAM, we want to do more complex
263 * stuff, like initializing PCI option roms in real mode, or doing
264 * a resume from a suspend to ram.
267 /* selgdt 0, unused */
268 .word 0x0000, 0x0000 /* dummy */
269 .byte 0x00, 0x00, 0x00, 0x00
271 /* selgdt 8, unused */
272 .word 0x0000, 0x0000 /* dummy */
273 .byte 0x00, 0x00, 0x00, 0x00
275 /* selgdt 0x10, flat code segment */
277 .byte 0x00, 0x9b, 0xcf, 0x00 /* G=1 and 0x0f, So we get 4Gbytes for limit */
279 /* selgdt 0x18, flat data segment */
281 .byte 0x00, 0x93, 0xcf, 0x00
283 /* selgdt 0x20, unused */
284 .word 0x0000, 0x0000 /* dummy */
285 .byte 0x00, 0x00, 0x00, 0x00
287 /* The next two entries are used for executing VGA option ROMs */
289 /* selgdt 0x28 16 bit 64k code at 0x00000000 */
293 /* selgdt 0x30 16 bit 64k data at 0x00000000 */
297 /* The next two entries are used for ACPI S3 RESUME */
299 /* selgdt 0x38, flat data segment 16 bit */
300 .word 0x0000, 0x0000 /* dummy */
301 .byte 0x00, 0x93, 0x8f, 0x00 /* G=1 and 0x0f, So we get 4Gbytes for limit */
303 /* selgdt 0x40, flat code segment 16 bit */
305 .byte 0x00, 0x9b, 0x8f, 0x00 /* G=1 and 0x0f, So we get 4Gbytes for limit */
309 .word _idt_end - _idt - 1 /* limit */
313 .fill 20, 8, 0 # idt is uninitialized