changeset 57:450ee0f18709

add kernel-cmake.ld
author anatofu
date Thu, 06 Jun 2019 19:50:24 +0900
parents a5ca5cc4661c
children f1b965f53d3b
files src/kernel-cmake.ld
diffstat 1 files changed, 78 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/kernel-cmake.ld	Thu Jun 06 19:50:24 2019 +0900
@@ -0,0 +1,78 @@
+OUTPUT_FORMAT("elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+
+ENTRY_SVC_STACK_SIZE = 0x1000;
+
+SECTIONS
+{
+  /* the entry point, before enabling paging. The code to enable paing
+   needs to have the same virtual/physical address. entry.S and start.c
+   run in this initial setting.*/
+  . = 0x10000;
+  .start_sec : {
+    CMakeFiles/kernel.dir/entry.S.o(.text)
+    CMakeFiles/kernel.dir/start.c.o(.text .text.*)
+
+    CMakeFiles/kernel.dir/entry.S.o(.rodata .rodata.*)
+    CMakeFiles/kernel.dir/start.c.o(.rodata .rodata.*)
+
+    CMakeFiles/kernel.dir/entry.S.o(.data .data.*)
+    CMakeFiles/kernel.dir/start.c.o(.data .data.*)
+
+    PROVIDE(edata_entry = .);
+
+    CMakeFiles/kernel.dir/entry.S.o(.bss .bss.* COMMON)
+    CMakeFiles/kernel.dir/start.c.o(.bss .bss.* COMMON)
+
+    /*define a stack for the entry*/
+    . = ALIGN(0x1000);
+    . += ENTRY_SVC_STACK_SIZE;
+
+    PROVIDE (svc_stktop = .);
+
+    /* define the kernel page table, must be 16K and 16K-aligned*/
+    . = ALIGN(0x4000);
+    PROVIDE (_kernel_pgtbl = .);
+    . += 0x4000;
+
+    /* we also need a user page table*/
+    PROVIDE (_user_pgtbl = .);
+    . += 0x1000;
+
+    PROVIDE(end_entry = .);
+  }
+
+  /*the kernel executes at the higher 2GB address space, but loaded
+   at the lower memory (0x20000)*/
+  . = 0x80020000;
+
+  .text : AT(0x20000){
+    *(.text .text.* .gnu.linkonce.t.*)
+  }
+
+  PROVIDE(etext = .);	/* Define the 'etext' symbol to this value */
+
+  .rodata : {
+    *(.rodata .rodata.* .gnu.linkonce.r.*)
+  }
+
+  /* aligned the data to a (4K) page, so it can be assigned
+   different protection than the code*/
+  . = ALIGN(0x1000);
+
+  PROVIDE (data_start = .);
+
+  .data : {
+    *(.data .data.*)
+  }
+
+  PROVIDE (edata = .);
+
+  .bss : {
+    *(.bss .bss.* COMMON)
+  }
+
+  . = ALIGN(0x1000);
+  PROVIDE (end = .);
+}