summaryrefslogtreecommitdiff
path: root/Kernel/Prekernel
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2021-09-26 21:33:21 -0400
committerLinus Groh <mail@linusgroh.de>2021-09-27 10:17:52 +0200
commit4c876e88e0638035676fbbeba39a7b71cbce53a9 (patch)
treed10ee5aea45f8cda69222fd0b11dda9103ccf376 /Kernel/Prekernel
parentcbdf4b575d83ddd24e71f7e896ed03883fba18e8 (diff)
downloadserenity-4c876e88e0638035676fbbeba39a7b71cbce53a9.zip
Kernel: Adjust aarch64 linker script
- .text now starts at 0x80000, where an actual (non-qemu) RPi expects - use magic section name ".text.first" to make sure the linker script puts the kernel entry point at the start of the .text section - remove a few things from the x86 linker script that aren't needed for aarch64 (yet?)
Diffstat (limited to 'Kernel/Prekernel')
-rw-r--r--Kernel/Prekernel/Arch/aarch64/boot.S3
-rw-r--r--Kernel/Prekernel/Arch/aarch64/linker.ld17
-rw-r--r--Kernel/Prekernel/CMakeLists.txt8
3 files changed, 5 insertions, 23 deletions
diff --git a/Kernel/Prekernel/Arch/aarch64/boot.S b/Kernel/Prekernel/Arch/aarch64/boot.S
index 264f800ad4..f522debef6 100644
--- a/Kernel/Prekernel/Arch/aarch64/boot.S
+++ b/Kernel/Prekernel/Arch/aarch64/boot.S
@@ -4,7 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-.text
+// In a specially-named text section so that the linker script can put it first in .text.
+.section ".text.first"
.global start
.type start, @function
diff --git a/Kernel/Prekernel/Arch/aarch64/linker.ld b/Kernel/Prekernel/Arch/aarch64/linker.ld
index 1204520540..9a89f1d4d9 100644
--- a/Kernel/Prekernel/Arch/aarch64/linker.ld
+++ b/Kernel/Prekernel/Arch/aarch64/linker.ld
@@ -2,7 +2,6 @@ ENTRY(start)
PHDRS
{
- boot_text PT_LOAD ;
text PT_LOAD ;
data PT_LOAD ;
bss PT_LOAD ;
@@ -10,18 +9,11 @@ PHDRS
SECTIONS
{
- . = 0x00100000;
-
- start_of_prekernel_image = .;
-
- .boot_text ALIGN(4K) : AT (ADDR(.boot_text))
- {
- KEEP(*(.multiboot))
- } :boot_text
+ . = 0x00080000;
.text ALIGN(4K) : AT (ADDR(.text))
{
- start_of_prekernel_text = .;
+ *(.text.first)
*(.text*)
} :text
@@ -37,11 +29,6 @@ SECTIONS
.bss ALIGN(4K) (NOLOAD) : AT (ADDR(.bss))
{
- *(COMMON)
*(.bss)
- *(.stack)
- *(.page_tables)
} :bss
-
- end_of_prekernel_image = .;
}
diff --git a/Kernel/Prekernel/CMakeLists.txt b/Kernel/Prekernel/CMakeLists.txt
index df638c5b06..66167e6a14 100644
--- a/Kernel/Prekernel/CMakeLists.txt
+++ b/Kernel/Prekernel/CMakeLists.txt
@@ -4,19 +4,13 @@ set(SOURCES
)
if ("${SERENITY_ARCH}" STREQUAL "aarch64")
set(SOURCES
- # This has to be first, so that the entry point is at the start of the image.
- # Needed because:
- # - execution starts at the start of the image
- # - the stack pointer currently starts before the start symbol, so if the start symbol isn't the first symbol, the stack will clobber arbitrary code
- # FIXME: Use an aarch64-specific linker script instead.
- Arch/aarch64/boot.S
-
${SOURCES}
Arch/aarch64/GPIO.cpp
Arch/aarch64/Mailbox.cpp
Arch/aarch64/MainIdRegister.cpp
Arch/aarch64/MMIO.cpp
Arch/aarch64/UART.cpp
+ Arch/aarch64/boot.S
Arch/aarch64/init.cpp
)
else()