aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/head.S
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/kernel/head.S')
-rw-r--r--arch/i386/kernel/head.S31
1 files changed, 27 insertions, 4 deletions
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
index 4a83384c5a61..5b14e95ac8b9 100644
--- a/arch/i386/kernel/head.S
+++ b/arch/i386/kernel/head.S
@@ -302,6 +302,7 @@ is386: movl $2,%ecx # set MP
302 movl %eax,%cr0 302 movl %eax,%cr0
303 303
304 call check_x87 304 call check_x87
305 call setup_pda
305 lgdt cpu_gdt_descr 306 lgdt cpu_gdt_descr
306 lidt idt_descr 307 lidt idt_descr
307 ljmp $(__KERNEL_CS),$1f 308 ljmp $(__KERNEL_CS),$1f
@@ -312,10 +313,13 @@ is386: movl $2,%ecx # set MP
312 movl %eax,%ds 313 movl %eax,%ds
313 movl %eax,%es 314 movl %eax,%es
314 315
315 xorl %eax,%eax # Clear FS/GS and LDT 316 xorl %eax,%eax # Clear FS and LDT
316 movl %eax,%fs 317 movl %eax,%fs
317 movl %eax,%gs
318 lldt %ax 318 lldt %ax
319
320 movl $(__KERNEL_PDA),%eax
321 mov %eax,%gs
322
319 cld # gcc2 wants the direction flag cleared at all times 323 cld # gcc2 wants the direction flag cleared at all times
320 pushl $0 # fake return address for unwinder 324 pushl $0 # fake return address for unwinder
321#ifdef CONFIG_SMP 325#ifdef CONFIG_SMP
@@ -346,6 +350,23 @@ check_x87:
346 ret 350 ret
347 351
348/* 352/*
353 * Point the GDT at this CPU's PDA. On boot this will be
354 * cpu_gdt_table and boot_pda; for secondary CPUs, these will be
355 * that CPU's GDT and PDA.
356 */
357setup_pda:
358 /* get the PDA pointer */
359 movl start_pda, %eax
360
361 /* slot the PDA address into the GDT */
362 mov cpu_gdt_descr+2, %ecx
363 mov %ax, (__KERNEL_PDA+0+2)(%ecx) /* base & 0x0000ffff */
364 shr $16, %eax
365 mov %al, (__KERNEL_PDA+4+0)(%ecx) /* base & 0x00ff0000 */
366 mov %ah, (__KERNEL_PDA+4+3)(%ecx) /* base & 0xff000000 */
367 ret
368
369/*
349 * setup_idt 370 * setup_idt
350 * 371 *
351 * sets up a idt with 256 entries pointing to 372 * sets up a idt with 256 entries pointing to
@@ -484,6 +505,8 @@ ENTRY(empty_zero_page)
484 * This starts the data section. 505 * This starts the data section.
485 */ 506 */
486.data 507.data
508ENTRY(start_pda)
509 .long boot_pda
487 510
488ENTRY(stack_start) 511ENTRY(stack_start)
489 .long init_thread_union+THREAD_SIZE 512 .long init_thread_union+THREAD_SIZE
@@ -525,7 +548,7 @@ idt_descr:
525 548
526# boot GDT descriptor (later on used by CPU#0): 549# boot GDT descriptor (later on used by CPU#0):
527 .word 0 # 32 bit align gdt_desc.address 550 .word 0 # 32 bit align gdt_desc.address
528cpu_gdt_descr: 551ENTRY(cpu_gdt_descr)
529 .word GDT_ENTRIES*8-1 552 .word GDT_ENTRIES*8-1
530 .long cpu_gdt_table 553 .long cpu_gdt_table
531 554
@@ -585,7 +608,7 @@ ENTRY(cpu_gdt_table)
585 .quad 0x004092000000ffff /* 0xc8 APM DS data */ 608 .quad 0x004092000000ffff /* 0xc8 APM DS data */
586 609
587 .quad 0x00c0920000000000 /* 0xd0 - ESPFIX SS */ 610 .quad 0x00c0920000000000 /* 0xd0 - ESPFIX SS */
588 .quad 0x0000000000000000 /* 0xd8 - PDA */ 611 .quad 0x00cf92000000ffff /* 0xd8 - PDA */
589 .quad 0x0000000000000000 /* 0xe0 - unused */ 612 .quad 0x0000000000000000 /* 0xe0 - unused */
590 .quad 0x0000000000000000 /* 0xe8 - unused */ 613 .quad 0x0000000000000000 /* 0xe8 - unused */
591 .quad 0x0000000000000000 /* 0xf0 - unused */ 614 .quad 0x0000000000000000 /* 0xf0 - unused */