aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/head_64.S
diff options
context:
space:
mode:
authorGlauber Costa <gcosta@redhat.com>2008-05-28 19:19:53 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-08 06:48:16 -0400
commita939098afcfa5f81d3474782ec15c6d114e57763 (patch)
tree62c21fb10d6b58dc8247c34e68ab5562e045b8d0 /arch/x86/kernel/head_64.S
parent736f12bff9d9e7b4e895c64f73b190c8383fc2a1 (diff)
x86: move x86_64 gdt closer to i386
i386 and x86_64 used two different schemes for maintaining the gdt. With this patch, x86_64 initial gdt table is defined in a .c file, same way as i386 is now. Also, we call it "gdt_page", and the descriptor, "early_gdt_descr". This way we achieve common naming, which can allow for more code integration. Signed-off-by: Glauber Costa <gcosta@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/head_64.S')
-rw-r--r--arch/x86/kernel/head_64.S48
1 files changed, 5 insertions, 43 deletions
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 918a2711aff6..32f5a114d1a2 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -203,7 +203,7 @@ ENTRY(secondary_startup_64)
203 * addresses where we're currently running on. We have to do that here 203 * addresses where we're currently running on. We have to do that here
204 * because in 32bit we couldn't load a 64bit linear address. 204 * because in 32bit we couldn't load a 64bit linear address.
205 */ 205 */
206 lgdt cpu_gdt_descr(%rip) 206 lgdt early_gdt_descr(%rip)
207 207
208 /* set up data segments. actually 0 would do too */ 208 /* set up data segments. actually 0 would do too */
209 movl $__KERNEL_DS,%eax 209 movl $__KERNEL_DS,%eax
@@ -391,54 +391,16 @@ NEXT_PAGE(level2_spare_pgt)
391 391
392 .data 392 .data
393 .align 16 393 .align 16
394 .globl cpu_gdt_descr 394 .globl early_gdt_descr
395cpu_gdt_descr: 395early_gdt_descr:
396 .word gdt_end-cpu_gdt_table-1 396 .word GDT_ENTRIES*8-1
397gdt: 397 .quad per_cpu__gdt_page
398 .quad cpu_gdt_table
399#ifdef CONFIG_SMP
400 .rept NR_CPUS-1
401 .word 0
402 .quad 0
403 .endr
404#endif
405 398
406ENTRY(phys_base) 399ENTRY(phys_base)
407 /* This must match the first entry in level2_kernel_pgt */ 400 /* This must match the first entry in level2_kernel_pgt */
408 .quad 0x0000000000000000 401 .quad 0x0000000000000000
409 402
410/* We need valid kernel segments for data and code in long mode too
411 * IRET will check the segment types kkeil 2000/10/28
412 * Also sysret mandates a special GDT layout
413 */
414
415 .section .data.page_aligned, "aw"
416 .align PAGE_SIZE
417
418/* The TLS descriptors are currently at a different place compared to i386.
419 Hopefully nobody expects them at a fixed place (Wine?) */
420 403
421ENTRY(cpu_gdt_table)
422 .quad 0x0000000000000000 /* NULL descriptor */
423 .quad 0x00cf9b000000ffff /* __KERNEL32_CS */
424 .quad 0x00af9b000000ffff /* __KERNEL_CS */
425 .quad 0x00cf93000000ffff /* __KERNEL_DS */
426 .quad 0x00cffb000000ffff /* __USER32_CS */
427 .quad 0x00cff3000000ffff /* __USER_DS, __USER32_DS */
428 .quad 0x00affb000000ffff /* __USER_CS */
429 .quad 0x0 /* unused */
430 .quad 0,0 /* TSS */
431 .quad 0,0 /* LDT */
432 .quad 0,0,0 /* three TLS descriptors */
433 .quad 0x0000f40000000000 /* node/CPU stored in limit */
434gdt_end:
435 /* asm/segment.h:GDT_ENTRIES must match this */
436 /* This should be a multiple of the cache line size */
437 /* GDTs of other CPUs are now dynamically allocated */
438
439 /* zero the remaining page */
440 .fill PAGE_SIZE / 8 - GDT_ENTRIES,8,0
441
442 .section .bss, "aw", @nobits 404 .section .bss, "aw", @nobits
443 .align L1_CACHE_BYTES 405 .align L1_CACHE_BYTES
444ENTRY(idt_table) 406ENTRY(idt_table)