Use the asm-generic macros where possible.

Signed-off-by: Michael Walle <mich...@walle.cc>
---
 arch/lm32/Kconfig.cpu          |    4 +-
 arch/lm32/kernel/head.S        |    2 +-
 arch/lm32/kernel/vmlinux.lds.S |  225 ++++++----------------------------------
 3 files changed, 36 insertions(+), 195 deletions(-)

diff --git a/arch/lm32/Kconfig.cpu b/arch/lm32/Kconfig.cpu
index 368030b..e127f9b 100644
--- a/arch/lm32/Kconfig.cpu
+++ b/arch/lm32/Kconfig.cpu
@@ -48,8 +48,8 @@ config MEMORY_SIZE
        default "0x08000000" if BOARD_MILKYMIST_ONE
        default "0x04000000" if BOARD_MILKYMIST_SOC
 
-config TEXT_OFFSET
-       hex "Set the text offset in memory"
+config KERNEL_BASE_ADDR
+       hex "Physical address where Linux Kernel is"
        default "0x40000000"
        help
          Define where the kernel will be loaded to and executed from.
diff --git a/arch/lm32/kernel/head.S b/arch/lm32/kernel/head.S
index 17d4778..8aed909 100644
--- a/arch/lm32/kernel/head.S
+++ b/arch/lm32/kernel/head.S
@@ -3,7 +3,7 @@
 #include <asm/thread_info.h>
 
 __INIT
-ENTRY(_stext)
+ENTRY(_start)
        xor     r0, r0, r0      /* clear r0 */
        wcsr    IE, r0          /* disable interrupts */
        wcsr    IM, r0
diff --git a/arch/lm32/kernel/vmlinux.lds.S b/arch/lm32/kernel/vmlinux.lds.S
index 767e0fa..4bb67b5 100644
--- a/arch/lm32/kernel/vmlinux.lds.S
+++ b/arch/lm32/kernel/vmlinux.lds.S
@@ -7,209 +7,50 @@
 #include <asm-generic/vmlinux.lds.h>
 #include <asm/thread_info.h>
 #include <asm/page.h>
-       
-OUTPUT_ARCH(lm32)
-ENTRY(_stext)
 
-#define        TEXT_OFFSET     CONFIG_TEXT_OFFSET
+OUTPUT_FORMAT("elf32-lm32")
+OUTPUT_ARCH("lm32")
+ENTRY(_start)
 
 jiffies = jiffies_64 + 4;
-
 SECTIONS
 {
-#ifdef CONFIG_XIP_KERNEL
-       . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
-#else
-       . = PAGE_OFFSET + TEXT_OFFSET;
-#endif
-
-       .init : {                       /* Init code and data           */
-               _stext = .;
-                       *(.text.head)
-               _sinittext = .;
-                       HEAD_TEXT
-                       INIT_TEXT
-               _einittext = .;
-               __proc_info_begin = .;
-                       *(.proc.info.init)
-               __proc_info_end = .;
-               __arch_info_begin = .;
-                       *(.arch.info.init)
-               __arch_info_end = .;
-               __tagtable_begin = .;
-                       *(.taglist.init)
-               __tagtable_end = .;
-
-               INIT_SETUP(16)
-
-               __early_begin = .;
-                       *(.early_param.init)
-               __early_end = .;
-
-               INIT_CALLS
-               CON_INITCALL
-               SECURITY_INITCALL
-               INIT_RAM_FS
-
-#ifndef CONFIG_XIP_KERNEL
-               __init_begin = _stext;
-               INIT_DATA
-#endif
-       }
-
+       . = CONFIG_KERNEL_BASE_ADDR;
+       __init_begin = .;
+       HEAD_TEXT_SECTION
+       INIT_TEXT_SECTION(PAGE_SIZE)
+       INIT_DATA_SECTION(16)
        PERCPU(PAGE_SIZE)
-
-#ifndef CONFIG_XIP_KERNEL
-       . = ALIGN(PAGE_SIZE);
        __init_end = .;
-#endif
-
-       /*
-        * unwind exit sections must be discarded before the rest of the
-        * unwind sections get included.
-        */
-       /DISCARD/ : {
-#ifndef CONFIG_MMU
-               *(.fixup)
-               *(__ex_table)
-#endif
-       }
-
-       .text : {                       /* Real text segment            */
-               _text = .;              /* Text and read-only data      */
-                       . = ALIGN(256);
-                       __exception_text_start = .;
-                       *(.exception.text)
-                       __exception_text_end = .;
-                       TEXT_TEXT
-                       SCHED_TEXT
-                       LOCK_TEXT
-                       KPROBES_TEXT
-#ifdef CONFIG_MMU
-                       *(.fixup)
-#endif
-                       *(.gnu.warning)
-                       *(.glue_7)
-                       *(.glue_7t)
-               *(.got)                 /* Global offset table          */
-       }
-
-       RO_DATA(PAGE_SIZE)
-
-       _etext = .;                     /* End of text and rodata section */
-
-#ifdef CONFIG_XIP_KERNEL
-       __data_loc = ALIGN(4);          /* location in binary */
-       . = PAGE_OFFSET + TEXT_OFFSET;
-#else
-       . = ALIGN(THREAD_SIZE);
-       __data_loc = .;
-#endif
-
-       .data : AT(__data_loc) {
-               _data = .;              /* address in memory */
-               _sdata = .;
-
-               /*
-                * first, the init task union, aligned
-                * to an 8192 byte boundary.
-                */
-               INIT_TASK_DATA(THREAD_SIZE)
 
-#ifdef CONFIG_XIP_KERNEL
-               . = ALIGN(PAGE_SIZE);
-               __init_begin = .;
-               INIT_DATA
-               . = ALIGN(PAGE_SIZE);
-               __init_end = .;
-#endif
-
-               NOSAVE_DATA
-               CACHELINE_ALIGNED_DATA(32)
-
-               /*
-                * The exception fixup table (might need resorting at runtime)
-                */
-               . = ALIGN(32);
-               __start___ex_table = .;
-#ifdef CONFIG_MMU
-               *(__ex_table)
-#endif
-               __stop___ex_table = .;
-
-               /*
-                * and the usual data section
-                */
-               DATA_DATA
-               CONSTRUCTORS
-
-               _edata = .;
-       }
-       _edata_loc = __data_loc + SIZEOF(.data);
-
-#ifdef CONFIG_HAVE_TCM
-        /*
-        * We align everything to a page boundary so we can
-        * free it after init has commenced and TCM contents have
-        * been copied to its destination.
-        */
-       .tcm_start : {
-               . = ALIGN(PAGE_SIZE);
-               __tcm_start = .;
-               __itcm_start = .;
-       }
-
-       /*
-        * Link these to the ITCM RAM
-        * Put VMA to the TCM address and LMA to the common RAM
-        * and we'll upload the contents from RAM to TCM and free
-        * the used RAM after that.
-        */
-       .text_itcm ITCM_OFFSET : AT(__itcm_start)
-       {
-               __sitcm_text = .;
-               *(.tcm.text)
-               *(.tcm.rodata)
-               . = ALIGN(4);
-               __eitcm_text = .;
-       }
-
-       /*
-        * Reset the dot pointer, this is needed to create the
-        * relative __dtcm_start below (to be used as extern in code).
-        */
-       . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
-
-       .dtcm_start : {
-               __dtcm_start = .;
-       }
-
-       /* TODO: add remainder of ITCM as well, that can be used for data! */
-       .data_dtcm DTCM_OFFSET : AT(__dtcm_start)
-       {
-               . = ALIGN(4);
-               __sdtcm_data = .;
-               *(.tcm.data)
-               . = ALIGN(4);
-               __edtcm_data = .;
-       }
-
-       /* Reset the dot pointer or the linker gets confused */
-       . = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
-
-       /* End marker for freeing TCM copy in linked object */
-       .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
-               . = ALIGN(PAGE_SIZE);
-               __tcm_end = .;
-       }
-#endif
-
-       BSS_SECTION(0, 0, 0)
+       .text : AT(ADDR(.text) - LOAD_OFFSET) {
+               _text = .;
+               _stext = .;
+               . = ALIGN(256);
+               __exception_text_start = .;
+               *(.exception.text)
+               __exception_text_end = .;
+               TEXT_TEXT
+               SCHED_TEXT
+               LOCK_TEXT
+               KPROBES_TEXT
+               IRQENTRY_TEXT
+               _etext = .;
+       }
+
+       _sdata = .;
+       RO_DATA_SECTION(PAGE_SIZE)
+       RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE)
+       _edata = .;
+
+       EXCEPTION_TABLE(256)
+       NOTES
+
+       BSS_SECTION(0, 0 ,0)
        _end = .;
 
        STABS_DEBUG
-       .comment 0 : { *(.comment) }
+       DWARF_DEBUG
 
-       /* Default discards */
        DISCARDS
 }
-- 
1.7.2.3

_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode
Twitter: www.twitter.com/milkymistvj
Ideas? http://milkymist.uservoice.com

Reply via email to