[PATCH 4/8] Cleanup setup_pda

From: Rusty Russell
Date: Tue Mar 06 2007 - 07:58:31 EST


The comment above this function has never been true in mainline:
talking to Jeremy it's from previous patch churn. What setup_pda
actually does is to write the segment entry for boot_pda into the
boot_gdt_table. Ideally, this would be a static initialization, but
because the addresses are split over multiple parts in the funk bit
layout of the GDT entry (thanks Intel!) that's not a valid C
initializer.

We in fact call this routine on every CPU bringup, but that's
harmless. Non-boot CPUs switch to their own GDTs immediately in
initialize_secondary.

VMI certainly doesn't need to call it explicitly.

Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>

diff -r 2d9aa53572e2 arch/i386/kernel/head.S
--- a/arch/i386/kernel/head.S Tue Mar 06 19:01:08 2007 +1100
+++ b/arch/i386/kernel/head.S Tue Mar 06 19:01:12 2007 +1100
@@ -365,17 +365,10 @@ 1: movb $1,X86_HARD_MATH
.byte 0xDB,0xE4 /* fsetpm for 287, ignored by 387 */
ret

-/*
- * Point the GDT at this CPU's PDA. On boot this will be
- * cpu_gdt_table and boot_pda; for secondary CPUs, these will be
- * that CPU's GDT and PDA.
- */
-ENTRY(setup_pda)
- /* get the PDA pointer */
- movl start_pda, %eax
-
- /* slot the PDA address into the GDT */
- mov early_gdt_descr+2, %ecx
+/* Initialize the boot_gdt_table's GDT_ENTRY_PDA (can't be done statically) */
+setup_pda:
+ movl $boot_pda, %eax
+ movl $boot_gdt_table, %ecx
mov %ax, (__KERNEL_PDA+0+2)(%ecx) /* base & 0x0000ffff */
shr $16, %eax
mov %al, (__KERNEL_PDA+4+0)(%ecx) /* base & 0x00ff0000 */
@@ -554,9 +547,6 @@ ENTRY(empty_zero_page)
* This starts the data section.
*/
.data
-ENTRY(start_pda)
- .long boot_pda
-
ENTRY(stack_start)
.long init_thread_union+THREAD_SIZE
.long __BOOT_DS
diff -r 2d9aa53572e2 arch/i386/kernel/vmi.c
--- a/arch/i386/kernel/vmi.c Tue Mar 06 19:01:08 2007 +1100
+++ b/arch/i386/kernel/vmi.c Tue Mar 06 19:01:47 2007 +1100
@@ -525,8 +525,6 @@ void vmi_pmd_clear(pmd_t *pmd)
#endif

#ifdef CONFIG_SMP
-extern void setup_pda(void);
-
static void __devinit
vmi_startup_ipi_hook(int phys_apicid, unsigned long start_eip,
unsigned long start_esp)
@@ -555,8 +553,6 @@ vmi_startup_ipi_hook(int phys_apicid, un
ap.gs = 0;

ap.eflags = 0;
-
- setup_pda();

#ifdef CONFIG_X86_PAE
/* efer should match BSP efer. */


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/