From 7f00001fd1943ffb81d234ef5ffb4cb9c34a4a40 Mon Sep 17 00:00:00 2001 From: WangRunji Date: Tue, 18 Sep 2018 17:04:55 +0800 Subject: [PATCH] Move to higher half --- kernel/src/arch/x86_64/linker.ld | 33 ++++++++++++++++++++++++++++++++ kernel/x86_64-blog_os.json | 5 +++++ 2 files changed, 38 insertions(+) create mode 100644 kernel/src/arch/x86_64/linker.ld diff --git a/kernel/src/arch/x86_64/linker.ld b/kernel/src/arch/x86_64/linker.ld new file mode 100644 index 0000000..a84b37d --- /dev/null +++ b/kernel/src/arch/x86_64/linker.ld @@ -0,0 +1,33 @@ +ENTRY(_start) + +KERNEL_BEGIN = 0xffffff0000000000; + +SECTIONS { + + . = KERNEL_BEGIN; + + .rodata ALIGN(4K): + { + *(.rodata .rodata.*) + } + + .text ALIGN(4K): + { + *(.text .text.*) + } + + .data ALIGN(4K): + { + *(.data .data.*) + } + + .got ALIGN(4K): + { + *(.got .got.*) + } + + .bss ALIGN(4K): + { + *(.bss .bss.*) + } +} diff --git a/kernel/x86_64-blog_os.json b/kernel/x86_64-blog_os.json index 8643d15..b035897 100644 --- a/kernel/x86_64-blog_os.json +++ b/kernel/x86_64-blog_os.json @@ -9,6 +9,11 @@ "os": "none", "executables": true, "linker": "rust-lld", + "pre-link-args": { + "ld.lld": [ + "-Tsrc/arch/x86_64/linker.ld" + ] + }, "disable-redzone": true, "features": "-mmx,-sse,+soft-float", "panic-strategy": "abort"