From 2b0da7ae33a6a5fb2223b833799688dbe8700768 Mon Sep 17 00:00:00 2001 From: chyyuu Date: Thu, 20 Sep 2012 15:24:49 +0800 Subject: [PATCH] add a new kernel ld with no paging virt addr mapping --- code/lab2/tools/kernel_nopage.ld | 59 ++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 code/lab2/tools/kernel_nopage.ld diff --git a/code/lab2/tools/kernel_nopage.ld b/code/lab2/tools/kernel_nopage.ld new file mode 100644 index 0000000..3bb6676 --- /dev/null +++ b/code/lab2/tools/kernel_nopage.ld @@ -0,0 +1,59 @@ +/* Simple linker script for the ucore kernel. + See the GNU ld 'info' manual ("info ld") to learn the syntax. */ + +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) +ENTRY(kern_entry) + +SECTIONS { + /* Load the kernel at this address: "." means the current address */ + /* the phy addr of ucore (before ucore enable paging mechanism*/ + . = 0x0100000; + + .text : { + *(.text .stub .text.* .gnu.linkonce.t.*) + } + + PROVIDE(etext = .); /* Define the 'etext' symbol to this value */ + + .rodata : { + *(.rodata .rodata.* .gnu.linkonce.r.*) + } + + /* Include debugging information in kernel memory */ + .stab : { + PROVIDE(__STAB_BEGIN__ = .); + *(.stab); + PROVIDE(__STAB_END__ = .); + BYTE(0) /* Force the linker to allocate space + for this section */ + } + + .stabstr : { + PROVIDE(__STABSTR_BEGIN__ = .); + *(.stabstr); + PROVIDE(__STABSTR_END__ = .); + BYTE(0) /* Force the linker to allocate space + for this section */ + } + + /* Adjust the address for the data segment to the next page */ + . = ALIGN(0x1000); + + /* The data segment */ + .data : { + *(.data) + } + + PROVIDE(edata = .); + + .bss : { + *(.bss) + } + + PROVIDE(end = .); + + /DISCARD/ : { + *(.eh_frame .note.GNU-stack) + } +}