parisc: fix kernel memory layout in vmlinux.ld.S
Helge Deller
maintainerPATCH 1/1 parisc: fix kernel memory layout in vmlinux.ld.S
When building a 64bit kernel sometimes functions in the .init section were not able to reach the standard kernel function. Main reason for this problem is, that the linkage tables (.plt, .opd, .dlt) tend to become pretty huge and thus the distance gets too big for short calls.
One option to avoid this is to use the -mlong-calls compiler option, but this increases the binary size and introduces a performance penalty.
Instead, with this patch we just lay out the binary differently. Init code is stored first, followed by text, R/O and finally R/W data. This means, that init and text code is now much closer to each other, which is sufficient to reach each other by short calls.
arch/parisc/kernel/head.S +2 -4
@@ -41,9 +41,7 @@ END(boot_args) .import fault_vector_11,code /* IVA parisc 1.1 32 bit */ .import $global$ /* forward declaration */ #endif /*!CONFIG_64BIT*/ - .export _stext,data /* Kernel want it this way! */ -_stext: -ENTRY(stext) +ENTRY(parisc_kernel_start) .proc .callinfo
@@ -347,7 +345,7 @@ smp_slave_stext: .procend #endif /* CONFIG_SMP */ -ENDPROC(stext) +ENDPROC(parisc_kernel_start) #ifndef CONFIG_64BIT .section .data..read_mostly
arch/parisc/kernel/vmlinux.lds.S +60 -78
184 lines not on this page · raw message
arch/parisc/mm/init.c +16 -3
@@ -32,6 +32,7 @@#include <asm/sections.h> extern int data_start; +extern void parisc_kernel_start (void );/* Kernel entry point in head.S */ #if PT_NLEVELS ==3 /* NOTE: This layout exactly conforms to the hybrid L2/L3 page table layout
@@ -324,8 +325,9 @@ static void __init setup_bootmem(void)reserve_bootmem_node (NODE_DATA (0 ),0UL , (unsigned long )(PAGE0 ->mem_free +PDC_CONSOLE_IO_IODC_SIZE ),BOOTMEM_DEFAULT ); -reserve_bootmem_node (NODE_DATA (0 ),__pa ((unsigned long )_text), - (unsigned long )(_end - _text),BOOTMEM_DEFAULT ); +reserve_bootmem_node (NODE_DATA (0 ),__pa (KERNEL_BINARY_TEXT_START ), + (unsigned long )(_end -KERNEL_BINARY_TEXT_START ), +BOOTMEM_DEFAULT );reserve_bootmem_node (NODE_DATA (0 ), (bootmap_start_pfn <<PAGE_SHIFT ), ((bootmap_pfn - bootmap_start_pfn) <<PAGE_SHIFT ),BOOTMEM_DEFAULT );
@@ -378,6 +380,17 @@ static void __init setup_bootmem(void)request_resource (&sysram_resources[0 ], &pdcdata_resource); } +static int __init parisc_text_address (unsigned long vaddr) +{ +static unsigned long head_ptr__initdata ; + +if (!head_ptr) + head_ptr =PAGE_MASK & (unsigned long ) +dereference_function_descriptor (&parisc_kernel_start); + +return core_kernel_text (vaddr) || vaddr == head_ptr; +} +static void __init map_pages (unsigned long start_vaddr,unsigned long start_paddr,unsigned long size,pgprot_t pgprot,int force)
@@ -466,7 +479,7 @@ static void __init map_pages(unsigned long start_vaddr,*/ if (force) pte =__mk_pte (address, pgprot); -else if (core_kernel_text (vaddr) && +else if (parisc_text_address (vaddr) && address != fv_addr) pte =__mk_pte (address,PAGE_KERNEL_EXEC );else