Commit f8657e1b authored by Vivek Goyal's avatar Vivek Goyal Committed by Andi Kleen

[PATCH] i386: move startup_32() in text.head section

o Entry startup_32 was in .text section but it was accessing some init
  data too and it prompts MODPOST to generate compilation warnings.

WARNING: vmlinux - Section mismatch: reference to .init.data:boot_params from
.text between '_text' (at offset 0xc0100029) and 'startup_32_smp'
WARNING: vmlinux - Section mismatch: reference to .init.data:boot_params from
.text between '_text' (at offset 0xc0100037) and 'startup_32_smp'
WARNING: vmlinux - Section mismatch: reference to
.init.data:init_pg_tables_end from .text between '_text' (at offset
0xc0100099) and 'startup_32_smp'

o Can't move startup_32 to .init.text as this entry point has to be at the
  start of bzImage. Hence moved startup_32 to a new section .text.head and
  instructed MODPOST to not to generate warnings if init data is being
  accessed from .text.head section. This code has been audited.

o SMP boot up code (startup_32_smp) can go into .init.text if CPU hotplug
  is not supported. Otherwise it generates more warnings

WARNING: vmlinux - Section mismatch: reference to .init.data:new_cpu_data from
.text between 'checkCPUtype' (at offset 0xc0100126) and 'is486'
WARNING: vmlinux - Section mismatch: reference to .init.data:new_cpu_data from
.text between 'checkCPUtype' (at offset 0xc0100130) and 'is486'
Signed-off-by: default avatarVivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
parent 7c0b49f9
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
* any particular GDT layout, because we load our own as soon as we * any particular GDT layout, because we load our own as soon as we
* can. * can.
*/ */
.section .text.head,"ax",@progbits
ENTRY(startup_32) ENTRY(startup_32)
#ifdef CONFIG_PARAVIRT #ifdef CONFIG_PARAVIRT
...@@ -141,16 +142,25 @@ page_pde_offset = (__PAGE_OFFSET >> 20); ...@@ -141,16 +142,25 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
jb 10b jb 10b
movl %edi,(init_pg_tables_end - __PAGE_OFFSET) movl %edi,(init_pg_tables_end - __PAGE_OFFSET)
#ifdef CONFIG_SMP
xorl %ebx,%ebx /* This is the boot CPU (BSP) */ xorl %ebx,%ebx /* This is the boot CPU (BSP) */
jmp 3f jmp 3f
/* /*
* Non-boot CPU entry point; entered from trampoline.S * Non-boot CPU entry point; entered from trampoline.S
* We can't lgdt here, because lgdt itself uses a data segment, but * We can't lgdt here, because lgdt itself uses a data segment, but
* we know the trampoline has already loaded the boot_gdt_table GDT * we know the trampoline has already loaded the boot_gdt_table GDT
* for us. * for us.
*
* If cpu hotplug is not supported then this code can go in init section
* which will be freed later
*/ */
#ifdef CONFIG_HOTPLUG_CPU
.section .text,"ax",@progbits
#else
.section .init.text,"ax",@progbits
#endif
#ifdef CONFIG_SMP
ENTRY(startup_32_smp) ENTRY(startup_32_smp)
cld cld
movl $(__BOOT_DS),%eax movl $(__BOOT_DS),%eax
...@@ -208,8 +218,8 @@ ENTRY(startup_32_smp) ...@@ -208,8 +218,8 @@ ENTRY(startup_32_smp)
xorl %ebx,%ebx xorl %ebx,%ebx
incl %ebx incl %ebx
3:
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
3:
/* /*
* Enable paging * Enable paging
...@@ -492,6 +502,7 @@ ignore_int: ...@@ -492,6 +502,7 @@ ignore_int:
#endif #endif
iret iret
.section .text
#ifdef CONFIG_PARAVIRT #ifdef CONFIG_PARAVIRT
startup_paravirt: startup_paravirt:
cld cld
......
...@@ -37,9 +37,14 @@ SECTIONS ...@@ -37,9 +37,14 @@ SECTIONS
{ {
. = LOAD_OFFSET + LOAD_PHYSICAL_ADDR; . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR;
phys_startup_32 = startup_32 - LOAD_OFFSET; phys_startup_32 = startup_32 - LOAD_OFFSET;
.text.head : AT(ADDR(.text.head) - LOAD_OFFSET) {
_text = .; /* Text and read-only data */
*(.text.head)
} :text = 0x9090
/* read-only */ /* read-only */
.text : AT(ADDR(.text) - LOAD_OFFSET) { .text : AT(ADDR(.text) - LOAD_OFFSET) {
_text = .; /* Text and read-only data */
*(.text) *(.text)
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
......
...@@ -641,12 +641,20 @@ static int secref_whitelist(const char *modname, const char *tosec, ...@@ -641,12 +641,20 @@ static int secref_whitelist(const char *modname, const char *tosec,
if (f1 && f2) if (f1 && f2)
return 1; return 1;
/* Whitelist all references from .pci_fixup section if vmlinux */ /* Whitelist all references from .pci_fixup section if vmlinux
* Whitelist all refereces from .text.head to .init.data if vmlinux
* Whitelist all refereces from .text.head to .init.text if vmlinux
*/
if (is_vmlinux(modname)) { if (is_vmlinux(modname)) {
if ((strcmp(fromsec, ".pci_fixup") == 0) && if ((strcmp(fromsec, ".pci_fixup") == 0) &&
(strcmp(tosec, ".init.text") == 0)) (strcmp(tosec, ".init.text") == 0))
return 1; return 1;
if ((strcmp(fromsec, ".text.head") == 0) &&
((strcmp(tosec, ".init.data") == 0) ||
(strcmp(tosec, ".init.text") == 0)))
return 1;
/* Check for pattern 3 */ /* Check for pattern 3 */
for (s = pat3refsym; *s; s++) for (s = pat3refsym; *s; s++)
if (strcmp(refsymname, *s) == 0) if (strcmp(refsymname, *s) == 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment