summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub V. Flasar <38976370+Kubiisek@users.noreply.github.com>2022-03-08 18:21:40 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2022-03-12 14:54:12 -0800
commit6d2c298b66a9dedbb0c32623e2aef187edce77b3 (patch)
treede441af6769da016638632af14d472568e210915
parentf94293f1216f4843dcba87c8809f17cb619e154f (diff)
downloadserenity-6d2c298b66a9dedbb0c32623e2aef187edce77b3.zip
Kernel: Move aarch64 Prekernel into Kernel
As there is no need for a Prekernel on aarch64, the Prekernel code was moved into Kernel itself. The functionality remains the same. SERENITY_KERNEL_AND_INITRD in run.sh specifies a kernel and an inital ramdisk to be used by the emulator. This is needed because aarch64 does not need a Prekernel and the other ones do.
-rw-r--r--Kernel/Arch/aarch64/Aarch64_asm_utils.S (renamed from Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.S)0
-rw-r--r--Kernel/Arch/aarch64/Aarch64_asm_utils.h (renamed from Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h)0
-rw-r--r--Kernel/Arch/aarch64/BootPPMParser.cpp (renamed from Kernel/Prekernel/Arch/aarch64/BootPPMParser.cpp)0
-rw-r--r--Kernel/Arch/aarch64/BootPPMParser.h (renamed from Kernel/Prekernel/Arch/aarch64/BootPPMParser.h)0
-rw-r--r--Kernel/Arch/aarch64/Framebuffer.cpp (renamed from Kernel/Prekernel/Arch/aarch64/Framebuffer.cpp)6
-rw-r--r--Kernel/Arch/aarch64/Framebuffer.h (renamed from Kernel/Prekernel/Arch/aarch64/Framebuffer.h)0
-rw-r--r--Kernel/Arch/aarch64/FramebufferMailboxMessages.h (renamed from Kernel/Prekernel/Arch/aarch64/FramebufferMailboxMessages.h)2
-rw-r--r--Kernel/Arch/aarch64/GPIO.cpp (renamed from Kernel/Prekernel/Arch/aarch64/GPIO.cpp)4
-rw-r--r--Kernel/Arch/aarch64/GPIO.h (renamed from Kernel/Prekernel/Arch/aarch64/GPIO.h)0
-rw-r--r--Kernel/Arch/aarch64/MMIO.cpp (renamed from Kernel/Prekernel/Arch/aarch64/MMIO.cpp)4
-rw-r--r--Kernel/Arch/aarch64/MMIO.h (renamed from Kernel/Prekernel/Arch/aarch64/MMIO.h)0
-rw-r--r--Kernel/Arch/aarch64/Mailbox.cpp (renamed from Kernel/Prekernel/Arch/aarch64/Mailbox.cpp)4
-rw-r--r--Kernel/Arch/aarch64/Mailbox.h (renamed from Kernel/Prekernel/Arch/aarch64/Mailbox.h)0
-rw-r--r--Kernel/Arch/aarch64/MainIdRegister.cpp (renamed from Kernel/Prekernel/Arch/aarch64/MainIdRegister.cpp)2
-rw-r--r--Kernel/Arch/aarch64/MainIdRegister.h (renamed from Kernel/Prekernel/Arch/aarch64/MainIdRegister.h)0
-rw-r--r--Kernel/Arch/aarch64/Prekernel.h (renamed from Kernel/Prekernel/Arch/aarch64/Prekernel.h)0
-rw-r--r--Kernel/Arch/aarch64/PrekernelCommon.cpp (renamed from Kernel/Prekernel/Arch/aarch64/PrekernelCommon.cpp)4
-rw-r--r--Kernel/Arch/aarch64/PrekernelExceptions.cpp (renamed from Kernel/Prekernel/Arch/aarch64/PrekernelExceptions.cpp)4
-rw-r--r--Kernel/Arch/aarch64/PrekernelMMU.cpp (renamed from Kernel/Prekernel/Arch/aarch64/PrekernelMMU.cpp)6
-rw-r--r--Kernel/Arch/aarch64/SerenityLogoRGB.ppm (renamed from Kernel/Prekernel/Arch/aarch64/SerenityLogoRGB.ppm)bin274351 -> 274351 bytes
-rw-r--r--Kernel/Arch/aarch64/Timer.cpp (renamed from Kernel/Prekernel/Arch/aarch64/Timer.cpp)8
-rw-r--r--Kernel/Arch/aarch64/Timer.h (renamed from Kernel/Prekernel/Arch/aarch64/Timer.h)0
-rw-r--r--Kernel/Arch/aarch64/UART.cpp (renamed from Kernel/Prekernel/Arch/aarch64/UART.cpp)8
-rw-r--r--Kernel/Arch/aarch64/UART.h (renamed from Kernel/Prekernel/Arch/aarch64/UART.h)0
-rw-r--r--Kernel/Arch/aarch64/Utils.cpp (renamed from Kernel/Prekernel/Arch/aarch64/Utils.cpp)4
-rw-r--r--Kernel/Arch/aarch64/Utils.h (renamed from Kernel/Prekernel/Arch/aarch64/Utils.h)0
-rw-r--r--Kernel/Arch/aarch64/boot.S (renamed from Kernel/Prekernel/Arch/aarch64/boot.S)0
-rw-r--r--Kernel/Arch/aarch64/init.cpp (renamed from Kernel/Prekernel/Arch/aarch64/init.cpp)16
-rw-r--r--Kernel/Arch/aarch64/linker.ld (renamed from Kernel/Prekernel/Arch/aarch64/linker.ld)0
-rw-r--r--Kernel/Arch/aarch64/vector_table.S (renamed from Kernel/Prekernel/Arch/aarch64/vector_table.S)0
-rw-r--r--Kernel/Arch/x86/linker.ld (renamed from Kernel/linker.ld)0
-rw-r--r--Kernel/CMakeLists.txt83
-rw-r--r--Kernel/Prekernel/CMakeLists.txt73
-rw-r--r--Kernel/Prekernel/boot.S (renamed from Kernel/Prekernel/Arch/x86/boot.S)0
-rw-r--r--Kernel/Prekernel/linker.ld (renamed from Kernel/Prekernel/Arch/x86/linker.ld)0
-rw-r--r--Kernel/Prekernel/multiboot.S (renamed from Kernel/Prekernel/Arch/x86/multiboot.S)0
-rwxr-xr-xMeta/run.sh31
37 files changed, 126 insertions, 133 deletions
diff --git a/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.S b/Kernel/Arch/aarch64/Aarch64_asm_utils.S
index 33f2d4de7f..33f2d4de7f 100644
--- a/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.S
+++ b/Kernel/Arch/aarch64/Aarch64_asm_utils.S
diff --git a/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h b/Kernel/Arch/aarch64/Aarch64_asm_utils.h
index 5536904b2b..5536904b2b 100644
--- a/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h
+++ b/Kernel/Arch/aarch64/Aarch64_asm_utils.h
diff --git a/Kernel/Prekernel/Arch/aarch64/BootPPMParser.cpp b/Kernel/Arch/aarch64/BootPPMParser.cpp
index 6061e1c427..6061e1c427 100644
--- a/Kernel/Prekernel/Arch/aarch64/BootPPMParser.cpp
+++ b/Kernel/Arch/aarch64/BootPPMParser.cpp
diff --git a/Kernel/Prekernel/Arch/aarch64/BootPPMParser.h b/Kernel/Arch/aarch64/BootPPMParser.h
index a311a50a7a..a311a50a7a 100644
--- a/Kernel/Prekernel/Arch/aarch64/BootPPMParser.h
+++ b/Kernel/Arch/aarch64/BootPPMParser.h
diff --git a/Kernel/Prekernel/Arch/aarch64/Framebuffer.cpp b/Kernel/Arch/aarch64/Framebuffer.cpp
index acc74a35ec..fb99de9adf 100644
--- a/Kernel/Prekernel/Arch/aarch64/Framebuffer.cpp
+++ b/Kernel/Arch/aarch64/Framebuffer.cpp
@@ -4,9 +4,9 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/Prekernel/Arch/aarch64/Framebuffer.h>
-#include <Kernel/Prekernel/Arch/aarch64/FramebufferMailboxMessages.h>
-#include <Kernel/Prekernel/Arch/aarch64/Utils.h>
+#include <Kernel/Arch/aarch64/Framebuffer.h>
+#include <Kernel/Arch/aarch64/FramebufferMailboxMessages.h>
+#include <Kernel/Arch/aarch64/Utils.h>
namespace Prekernel {
diff --git a/Kernel/Prekernel/Arch/aarch64/Framebuffer.h b/Kernel/Arch/aarch64/Framebuffer.h
index 2cde37dfdb..2cde37dfdb 100644
--- a/Kernel/Prekernel/Arch/aarch64/Framebuffer.h
+++ b/Kernel/Arch/aarch64/Framebuffer.h
diff --git a/Kernel/Prekernel/Arch/aarch64/FramebufferMailboxMessages.h b/Kernel/Arch/aarch64/FramebufferMailboxMessages.h
index 672857ac31..7dab801b73 100644
--- a/Kernel/Prekernel/Arch/aarch64/FramebufferMailboxMessages.h
+++ b/Kernel/Arch/aarch64/FramebufferMailboxMessages.h
@@ -6,7 +6,7 @@
#pragma once
-#include <Kernel/Prekernel/Arch/aarch64/Mailbox.h>
+#include <Kernel/Arch/aarch64/Mailbox.h>
namespace Prekernel {
diff --git a/Kernel/Prekernel/Arch/aarch64/GPIO.cpp b/Kernel/Arch/aarch64/GPIO.cpp
index 3a0b8b40c7..bffba6bade 100644
--- a/Kernel/Prekernel/Arch/aarch64/GPIO.cpp
+++ b/Kernel/Arch/aarch64/GPIO.cpp
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/Prekernel/Arch/aarch64/GPIO.h>
-#include <Kernel/Prekernel/Arch/aarch64/MMIO.h>
+#include <Kernel/Arch/aarch64/GPIO.h>
+#include <Kernel/Arch/aarch64/MMIO.h>
extern "C" void wait_cycles(int n);
diff --git a/Kernel/Prekernel/Arch/aarch64/GPIO.h b/Kernel/Arch/aarch64/GPIO.h
index 4f38f9c376..4f38f9c376 100644
--- a/Kernel/Prekernel/Arch/aarch64/GPIO.h
+++ b/Kernel/Arch/aarch64/GPIO.h
diff --git a/Kernel/Prekernel/Arch/aarch64/MMIO.cpp b/Kernel/Arch/aarch64/MMIO.cpp
index 2cfdec17fc..a6b270a17d 100644
--- a/Kernel/Prekernel/Arch/aarch64/MMIO.cpp
+++ b/Kernel/Arch/aarch64/MMIO.cpp
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/Prekernel/Arch/aarch64/MMIO.h>
-#include <Kernel/Prekernel/Arch/aarch64/MainIdRegister.h>
+#include <Kernel/Arch/aarch64/MMIO.h>
+#include <Kernel/Arch/aarch64/MainIdRegister.h>
namespace Prekernel {
diff --git a/Kernel/Prekernel/Arch/aarch64/MMIO.h b/Kernel/Arch/aarch64/MMIO.h
index 895319d869..895319d869 100644
--- a/Kernel/Prekernel/Arch/aarch64/MMIO.h
+++ b/Kernel/Arch/aarch64/MMIO.h
diff --git a/Kernel/Prekernel/Arch/aarch64/Mailbox.cpp b/Kernel/Arch/aarch64/Mailbox.cpp
index 3f52002adc..d36a5305b4 100644
--- a/Kernel/Prekernel/Arch/aarch64/Mailbox.cpp
+++ b/Kernel/Arch/aarch64/Mailbox.cpp
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/Prekernel/Arch/aarch64/MMIO.h>
-#include <Kernel/Prekernel/Arch/aarch64/Mailbox.h>
+#include <Kernel/Arch/aarch64/MMIO.h>
+#include <Kernel/Arch/aarch64/Mailbox.h>
namespace Prekernel {
diff --git a/Kernel/Prekernel/Arch/aarch64/Mailbox.h b/Kernel/Arch/aarch64/Mailbox.h
index f54eea7c99..f54eea7c99 100644
--- a/Kernel/Prekernel/Arch/aarch64/Mailbox.h
+++ b/Kernel/Arch/aarch64/Mailbox.h
diff --git a/Kernel/Prekernel/Arch/aarch64/MainIdRegister.cpp b/Kernel/Arch/aarch64/MainIdRegister.cpp
index 377d5c8e27..9b363a72b9 100644
--- a/Kernel/Prekernel/Arch/aarch64/MainIdRegister.cpp
+++ b/Kernel/Arch/aarch64/MainIdRegister.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/Prekernel/Arch/aarch64/MainIdRegister.h>
+#include <Kernel/Arch/aarch64/MainIdRegister.h>
namespace Prekernel {
diff --git a/Kernel/Prekernel/Arch/aarch64/MainIdRegister.h b/Kernel/Arch/aarch64/MainIdRegister.h
index 5f8d775acb..5f8d775acb 100644
--- a/Kernel/Prekernel/Arch/aarch64/MainIdRegister.h
+++ b/Kernel/Arch/aarch64/MainIdRegister.h
diff --git a/Kernel/Prekernel/Arch/aarch64/Prekernel.h b/Kernel/Arch/aarch64/Prekernel.h
index 4bb284f7cd..4bb284f7cd 100644
--- a/Kernel/Prekernel/Arch/aarch64/Prekernel.h
+++ b/Kernel/Arch/aarch64/Prekernel.h
diff --git a/Kernel/Prekernel/Arch/aarch64/PrekernelCommon.cpp b/Kernel/Arch/aarch64/PrekernelCommon.cpp
index 6a24efda4f..5035ae5ab8 100644
--- a/Kernel/Prekernel/Arch/aarch64/PrekernelCommon.cpp
+++ b/Kernel/Arch/aarch64/PrekernelCommon.cpp
@@ -4,10 +4,10 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/Prekernel/Arch/aarch64/Prekernel.h>
+#include <Kernel/Arch/aarch64/Prekernel.h>
#include <Kernel/Arch/aarch64/ASM_wrapper.h>
-#include <Kernel/Prekernel/Arch/aarch64/UART.h>
+#include <Kernel/Arch/aarch64/UART.h>
namespace Prekernel {
diff --git a/Kernel/Prekernel/Arch/aarch64/PrekernelExceptions.cpp b/Kernel/Arch/aarch64/PrekernelExceptions.cpp
index 03f1a43591..9feb7fb821 100644
--- a/Kernel/Prekernel/Arch/aarch64/PrekernelExceptions.cpp
+++ b/Kernel/Arch/aarch64/PrekernelExceptions.cpp
@@ -5,9 +5,9 @@
*/
#include <Kernel/Arch/aarch64/ASM_wrapper.h>
+#include <Kernel/Arch/aarch64/Aarch64_asm_utils.h>
+#include <Kernel/Arch/aarch64/Prekernel.h>
#include <Kernel/Arch/aarch64/Registers.h>
-#include <Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h>
-#include <Kernel/Prekernel/Arch/aarch64/Prekernel.h>
extern "C" void enter_el2_from_el3();
extern "C" void enter_el1_from_el2();
diff --git a/Kernel/Prekernel/Arch/aarch64/PrekernelMMU.cpp b/Kernel/Arch/aarch64/PrekernelMMU.cpp
index 7aa1c6593a..38c953b600 100644
--- a/Kernel/Prekernel/Arch/aarch64/PrekernelMMU.cpp
+++ b/Kernel/Arch/aarch64/PrekernelMMU.cpp
@@ -6,12 +6,12 @@
#include <AK/Types.h>
-#include <Kernel/Prekernel/Arch/aarch64/Prekernel.h>
+#include <Kernel/Arch/aarch64/Prekernel.h>
#include <Kernel/Arch/aarch64/ASM_wrapper.h>
+#include <Kernel/Arch/aarch64/MMIO.h>
#include <Kernel/Arch/aarch64/Registers.h>
-#include <Kernel/Prekernel/Arch/aarch64/MMIO.h>
-#include <Kernel/Prekernel/Arch/aarch64/UART.h>
+#include <Kernel/Arch/aarch64/UART.h>
// Documentation here for Aarch64 Address Translations
// https://documentation-service.arm.com/static/5efa1d23dbdee951c1ccdec5?token=
diff --git a/Kernel/Prekernel/Arch/aarch64/SerenityLogoRGB.ppm b/Kernel/Arch/aarch64/SerenityLogoRGB.ppm
index 6cf9490cd4..6cf9490cd4 100644
--- a/Kernel/Prekernel/Arch/aarch64/SerenityLogoRGB.ppm
+++ b/Kernel/Arch/aarch64/SerenityLogoRGB.ppm
Binary files differ
diff --git a/Kernel/Prekernel/Arch/aarch64/Timer.cpp b/Kernel/Arch/aarch64/Timer.cpp
index b40fe8cf7c..0a703c180b 100644
--- a/Kernel/Prekernel/Arch/aarch64/Timer.cpp
+++ b/Kernel/Arch/aarch64/Timer.cpp
@@ -4,10 +4,10 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/Prekernel/Arch/aarch64/MMIO.h>
-#include <Kernel/Prekernel/Arch/aarch64/Mailbox.h>
-#include <Kernel/Prekernel/Arch/aarch64/Timer.h>
-#include <Kernel/Prekernel/Arch/aarch64/Utils.h>
+#include <Kernel/Arch/aarch64/MMIO.h>
+#include <Kernel/Arch/aarch64/Mailbox.h>
+#include <Kernel/Arch/aarch64/Timer.h>
+#include <Kernel/Arch/aarch64/Utils.h>
namespace Prekernel {
diff --git a/Kernel/Prekernel/Arch/aarch64/Timer.h b/Kernel/Arch/aarch64/Timer.h
index 27762930bf..27762930bf 100644
--- a/Kernel/Prekernel/Arch/aarch64/Timer.h
+++ b/Kernel/Arch/aarch64/Timer.h
diff --git a/Kernel/Prekernel/Arch/aarch64/UART.cpp b/Kernel/Arch/aarch64/UART.cpp
index 4c4bbce121..36852b6fce 100644
--- a/Kernel/Prekernel/Arch/aarch64/UART.cpp
+++ b/Kernel/Arch/aarch64/UART.cpp
@@ -4,10 +4,10 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/Prekernel/Arch/aarch64/GPIO.h>
-#include <Kernel/Prekernel/Arch/aarch64/MMIO.h>
-#include <Kernel/Prekernel/Arch/aarch64/Timer.h>
-#include <Kernel/Prekernel/Arch/aarch64/UART.h>
+#include <Kernel/Arch/aarch64/GPIO.h>
+#include <Kernel/Arch/aarch64/MMIO.h>
+#include <Kernel/Arch/aarch64/Timer.h>
+#include <Kernel/Arch/aarch64/UART.h>
namespace Prekernel {
diff --git a/Kernel/Prekernel/Arch/aarch64/UART.h b/Kernel/Arch/aarch64/UART.h
index 79cef0a166..79cef0a166 100644
--- a/Kernel/Prekernel/Arch/aarch64/UART.h
+++ b/Kernel/Arch/aarch64/UART.h
diff --git a/Kernel/Prekernel/Arch/aarch64/Utils.cpp b/Kernel/Arch/aarch64/Utils.cpp
index a8728dca5e..92d2f3a7d8 100644
--- a/Kernel/Prekernel/Arch/aarch64/Utils.cpp
+++ b/Kernel/Arch/aarch64/Utils.cpp
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/Prekernel/Arch/aarch64/UART.h>
-#include <Kernel/Prekernel/Arch/aarch64/Utils.h>
+#include <Kernel/Arch/aarch64/UART.h>
+#include <Kernel/Arch/aarch64/Utils.h>
void Prekernel::dbgln(const char* text)
{
diff --git a/Kernel/Prekernel/Arch/aarch64/Utils.h b/Kernel/Arch/aarch64/Utils.h
index 0c25610654..0c25610654 100644
--- a/Kernel/Prekernel/Arch/aarch64/Utils.h
+++ b/Kernel/Arch/aarch64/Utils.h
diff --git a/Kernel/Prekernel/Arch/aarch64/boot.S b/Kernel/Arch/aarch64/boot.S
index 4c44b5288a..4c44b5288a 100644
--- a/Kernel/Prekernel/Arch/aarch64/boot.S
+++ b/Kernel/Arch/aarch64/boot.S
diff --git a/Kernel/Prekernel/Arch/aarch64/init.cpp b/Kernel/Arch/aarch64/init.cpp
index 04d2fb4115..bce753da49 100644
--- a/Kernel/Prekernel/Arch/aarch64/init.cpp
+++ b/Kernel/Arch/aarch64/init.cpp
@@ -10,14 +10,14 @@
#include <AK/Types.h>
#include <Kernel/Arch/aarch64/ASM_wrapper.h>
-#include <Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h>
-#include <Kernel/Prekernel/Arch/aarch64/BootPPMParser.h>
-#include <Kernel/Prekernel/Arch/aarch64/Framebuffer.h>
-#include <Kernel/Prekernel/Arch/aarch64/Mailbox.h>
-#include <Kernel/Prekernel/Arch/aarch64/Prekernel.h>
-#include <Kernel/Prekernel/Arch/aarch64/Timer.h>
-#include <Kernel/Prekernel/Arch/aarch64/UART.h>
-#include <Kernel/Prekernel/Arch/aarch64/Utils.h>
+#include <Kernel/Arch/aarch64/Aarch64_asm_utils.h>
+#include <Kernel/Arch/aarch64/BootPPMParser.h>
+#include <Kernel/Arch/aarch64/Framebuffer.h>
+#include <Kernel/Arch/aarch64/Mailbox.h>
+#include <Kernel/Arch/aarch64/Prekernel.h>
+#include <Kernel/Arch/aarch64/Timer.h>
+#include <Kernel/Arch/aarch64/UART.h>
+#include <Kernel/Arch/aarch64/Utils.h>
static void draw_logo();
static u32 query_firmware_version();
diff --git a/Kernel/Prekernel/Arch/aarch64/linker.ld b/Kernel/Arch/aarch64/linker.ld
index e04e9290ab..e04e9290ab 100644
--- a/Kernel/Prekernel/Arch/aarch64/linker.ld
+++ b/Kernel/Arch/aarch64/linker.ld
diff --git a/Kernel/Prekernel/Arch/aarch64/vector_table.S b/Kernel/Arch/aarch64/vector_table.S
index 826b38ba56..826b38ba56 100644
--- a/Kernel/Prekernel/Arch/aarch64/vector_table.S
+++ b/Kernel/Arch/aarch64/vector_table.S
diff --git a/Kernel/linker.ld b/Kernel/Arch/x86/linker.ld
index 1bed3df22f..1bed3df22f 100644
--- a/Kernel/linker.ld
+++ b/Kernel/Arch/x86/linker.ld
diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt
index 893ac4cbc5..8686e6719c 100644
--- a/Kernel/CMakeLists.txt
+++ b/Kernel/CMakeLists.txt
@@ -386,15 +386,31 @@ if (NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
)
else()
set(SOURCES
- ${SOURCES}
- ${AK_SOURCES}
+ Arch/aarch64/BootPPMParser.cpp
+ Arch/aarch64/GPIO.cpp
+ Arch/aarch64/Framebuffer.cpp
+ Arch/aarch64/Mailbox.cpp
+ Arch/aarch64/MainIdRegister.cpp
+ Arch/aarch64/MMIO.cpp
+ Arch/aarch64/Timer.cpp
+ Arch/aarch64/UART.cpp
+ Arch/aarch64/Utils.cpp
+
+ # Preload specific
+ Arch/aarch64/init.cpp
+ Arch/aarch64/PrekernelMMU.cpp
+ Arch/aarch64/PrekernelExceptions.cpp
+ Arch/aarch64/PrekernelCommon.cpp
+
+ # Assembly
+ Arch/aarch64/boot.S
+ Arch/aarch64/Aarch64_asm_utils.S
+ Arch/aarch64/vector_table.S
- Arch/aarch64/dummy.cpp
Arch/aarch64/SmapDisabler.cpp
Arch/aarch64/ScopedCritical.cpp
- StdLib.cpp
MiniStdLib.cpp
- UBSanitizer.cpp
+ Prekernel/UBSanitizer.cpp
)
# Otherwise linker errors e.g undefined reference to `__aarch64_cas8_acq_rel'
@@ -492,6 +508,10 @@ if (ENABLE_KERNEL_ADDRESS_SANITIZER)
add_link_options(-fsanitize=kernel-address)
endif()
+if ("${SERENITY_ARCH}" STREQUAL "aarch64")
+ add_compile_options(-fno-threadsafe-statics)
+endif()
+
add_compile_definitions(KERNEL)
add_link_options(LINKER:-z,notext)
@@ -501,17 +521,22 @@ endif()
add_executable(Kernel ${SOURCES})
add_dependencies(Kernel generate_EscapeSequenceStateMachine.h)
-add_custom_command(
- OUTPUT linker.ld
- COMMAND "${CMAKE_CXX_COMPILER}" ${TARGET_STRING} -E -P -x c -I${CMAKE_CURRENT_SOURCE_DIR}/.. "${CMAKE_CURRENT_SOURCE_DIR}/linker.ld" -o "${CMAKE_CURRENT_BINARY_DIR}/linker.ld"
- MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/linker.ld"
- COMMENT "Preprocessing linker.ld"
- VERBATIM
-)
+if (NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/linker.ld
+ COMMAND "${CMAKE_CXX_COMPILER}" ${TARGET_STRING} -E -P -x c -I${CMAKE_CURRENT_SOURCE_DIR}/.. "${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/linker.ld" -o "${CMAKE_CURRENT_BINARY_DIR}/linker.ld"
+ MAIN_DEPENDENCY "Arch/x86/linker.ld"
+ COMMENT "Preprocessing linker.ld"
+ VERBATIM
+ )
-add_custom_target(generate_kernel_linker_script DEPENDS linker.ld)
-target_link_options(Kernel PRIVATE LINKER:-T ${CMAKE_CURRENT_BINARY_DIR}/linker.ld -nostdlib -nodefaultlibs)
-set_target_properties(Kernel PROPERTIES LINK_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/linker.ld")
+ add_custom_target(generate_kernel_linker_script DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/linker.ld)
+ target_link_options(Kernel PRIVATE LINKER:-T ${CMAKE_CURRENT_BINARY_DIR}/linker.ld -nostdlib -nodefaultlibs)
+ set_target_properties(Kernel PROPERTIES LINK_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/linker.ld")
+else()
+ target_link_options(Kernel PRIVATE LINKER:-T ${CMAKE_CURRENT_SOURCE_DIR}/Arch/aarch64/linker.ld -nostdlib LINKER:--no-pie)
+ set_target_properties(Kernel PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Arch/aarch64/linker.ld)
+endif()
if (ENABLE_KERNEL_LTO)
include(CheckIPOSupported)
@@ -532,20 +557,32 @@ if (NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
endif()
add_custom_command(
- TARGET Kernel POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E env NM=${CMAKE_NM} sh ${CMAKE_CURRENT_SOURCE_DIR}/mkmap.sh
- COMMAND ${CMAKE_COMMAND} -E env OBJCOPY=${CMAKE_OBJCOPY} sh ${CMAKE_CURRENT_SOURCE_DIR}/embedmap.sh
- COMMAND ${CMAKE_OBJCOPY} --only-keep-debug Kernel Kernel.debug
- COMMAND ${CMAKE_OBJCOPY} --strip-debug Kernel
- COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=Kernel.debug Kernel
- BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/kernel.map
+ TARGET Kernel POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E env NM=${CMAKE_NM} sh ${CMAKE_CURRENT_SOURCE_DIR}/mkmap.sh
+ COMMAND ${CMAKE_COMMAND} -E env OBJCOPY=${CMAKE_OBJCOPY} sh ${CMAKE_CURRENT_SOURCE_DIR}/embedmap.sh
+ COMMAND ${CMAKE_OBJCOPY} --only-keep-debug Kernel Kernel.debug
+ COMMAND ${CMAKE_OBJCOPY} --strip-debug Kernel
+ COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=Kernel.debug Kernel
+ BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/kernel.map
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Kernel" DESTINATION boot)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Kernel.debug" DESTINATION boot)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kernel.map" DESTINATION res)
+if ("${SERENITY_ARCH}" STREQUAL "aarch64")
+ embed_resource(Kernel serenity_boot_logo "Arch/aarch64/SerenityLogoRGB.ppm")
+ add_custom_command(
+ TARGET Kernel POST_BUILD
+ COMMAND ${CMAKE_OBJCOPY} -O binary Kernel kernel8.img
+ BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/kernel8.img
+ )
+endif()
+
serenity_install_headers(Kernel)
serenity_install_sources(Kernel)
-add_subdirectory(Prekernel)
+# aarch64 does not need a Prekernel
+if (NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
+ add_subdirectory(Prekernel)
+endif()
diff --git a/Kernel/Prekernel/CMakeLists.txt b/Kernel/Prekernel/CMakeLists.txt
index 5b3e1d3528..259e9831df 100644
--- a/Kernel/Prekernel/CMakeLists.txt
+++ b/Kernel/Prekernel/CMakeLists.txt
@@ -1,49 +1,19 @@
set(SOURCES
UBSanitizer.cpp
../MiniStdLib.cpp
-)
-if ("${SERENITY_ARCH}" STREQUAL "aarch64")
- set(SOURCES
- ${SOURCES}
- Arch/aarch64/BootPPMParser.cpp
- Arch/aarch64/GPIO.cpp
- Arch/aarch64/Framebuffer.cpp
- Arch/aarch64/Mailbox.cpp
- Arch/aarch64/MainIdRegister.cpp
- Arch/aarch64/MMIO.cpp
- Arch/aarch64/Timer.cpp
- Arch/aarch64/UART.cpp
- Arch/aarch64/Utils.cpp
-
- # Preload specific
- Arch/aarch64/init.cpp
- Arch/aarch64/PrekernelMMU.cpp
- Arch/aarch64/PrekernelExceptions.cpp
- Arch/aarch64/PrekernelCommon.cpp
-
- # Assembly
- Arch/aarch64/boot.S
- Arch/aarch64/Aarch64_asm_utils.S
- Arch/aarch64/vector_table.S
- )
-else()
- set(SOURCES
- ${SOURCES}
- Arch/x86/boot.S
- Arch/x86/multiboot.S
- # FIXME: Eventually, some of these should build on aarch64 too.
- init.cpp
- ../../Userland/Libraries/LibELF/Relocation.cpp
+ boot.S
+ multiboot.S
+ init.cpp
+ ../../Userland/Libraries/LibELF/Relocation.cpp
)
-endif()
if ("${SERENITY_ARCH}" STREQUAL "i686")
set(PREKERNEL_TARGET Prekernel32)
elseif ("${SERENITY_ARCH}" STREQUAL "x86_64")
set(PREKERNEL_TARGET Prekernel64)
-else()
- set(PREKERNEL_TARGET Prekernel)
+elseif("${SERENITY_ARCH}" STREQUAL "aarch64")
+ message(SEND_ERROR "Prekernel is not needed on aarch64 and should not be compiled!")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
@@ -51,13 +21,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
add_executable(${PREKERNEL_TARGET} ${SOURCES})
target_compile_options(${PREKERNEL_TARGET} PRIVATE -no-pie -fno-pic -fno-threadsafe-statics)
-if ("${SERENITY_ARCH}" STREQUAL "aarch64")
- set(PREKERNEL_LINKER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/Arch/aarch64/linker.ld")
-else()
- set(PREKERNEL_LINKER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/linker.ld")
-endif()
-target_link_options(${PREKERNEL_TARGET} PRIVATE LINKER:-T ${PREKERNEL_LINKER_SCRIPT} -nostdlib LINKER:--no-pie)
-set_target_properties(${PREKERNEL_TARGET} PROPERTIES LINK_DEPENDS ${PREKERNEL_LINKER_SCRIPT})
+target_link_options(${PREKERNEL_TARGET} PRIVATE LINKER:-T ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld -nostdlib LINKER:--no-pie)
+set_target_properties(${PREKERNEL_TARGET} PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(${PREKERNEL_TARGET} PRIVATE gcc)
@@ -65,23 +30,11 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
target_link_libraries(${PREKERNEL_TARGET} PRIVATE clang_rt.builtins)
endif()
-if ("${SERENITY_ARCH}" STREQUAL "i686" OR "${SERENITY_ARCH}" STREQUAL "x86_64")
- add_custom_command(
- TARGET ${PREKERNEL_TARGET} POST_BUILD
- COMMAND ${CMAKE_OBJCOPY} -O elf32-i386 ${CMAKE_CURRENT_BINARY_DIR}/${PREKERNEL_TARGET} ${CMAKE_CURRENT_BINARY_DIR}/Prekernel
- BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Prekernel
- )
-endif()
-
-if ("${SERENITY_ARCH}" STREQUAL "aarch64")
- embed_resource(Prekernel serenity_boot_logo "Arch/aarch64/SerenityLogoRGB.ppm")
-
- add_custom_command(
- TARGET Prekernel POST_BUILD
- COMMAND ${CMAKE_OBJCOPY} -O binary Prekernel kernel8.img
- BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/kernel8.img
- )
-endif()
+add_custom_command(
+ TARGET ${PREKERNEL_TARGET} POST_BUILD
+ COMMAND ${CMAKE_OBJCOPY} -O elf32-i386 ${CMAKE_CURRENT_BINARY_DIR}/${PREKERNEL_TARGET} ${CMAKE_CURRENT_BINARY_DIR}/Prekernel
+ BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Prekernel
+)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Prekernel" DESTINATION boot)
diff --git a/Kernel/Prekernel/Arch/x86/boot.S b/Kernel/Prekernel/boot.S
index ae0d5fe8f5..ae0d5fe8f5 100644
--- a/Kernel/Prekernel/Arch/x86/boot.S
+++ b/Kernel/Prekernel/boot.S
diff --git a/Kernel/Prekernel/Arch/x86/linker.ld b/Kernel/Prekernel/linker.ld
index 1204520540..1204520540 100644
--- a/Kernel/Prekernel/Arch/x86/linker.ld
+++ b/Kernel/Prekernel/linker.ld
diff --git a/Kernel/Prekernel/Arch/x86/multiboot.S b/Kernel/Prekernel/multiboot.S
index 1d43fa799b..1d43fa799b 100644
--- a/Kernel/Prekernel/Arch/x86/multiboot.S
+++ b/Kernel/Prekernel/multiboot.S
diff --git a/Meta/run.sh b/Meta/run.sh
index fc9e6152bf..b1ea1c2897 100755
--- a/Meta/run.sh
+++ b/Meta/run.sh
@@ -259,6 +259,16 @@ if [ "$NATIVE_WINDOWS_QEMU" -ne "1" ]; then
-qmp unix:qmp-sock,server,nowait"
fi
+if [ "$SERENITY_ARCH" = "aarch64" ]; then
+ SERENITY_KERNEL_AND_INITRD="
+ -kernel Kernel/Kernel
+ "
+else
+ SERENITY_KERNEL_AND_INITRD="
+ -kernel Kernel/Prekernel/Prekernel
+ -initrd Kernel/Kernel
+ "
+fi
[ -z "$SERENITY_COMMON_QEMU_ARGS" ] && SERENITY_COMMON_QEMU_ARGS="
@@ -370,8 +380,7 @@ elif [ "$SERENITY_RUN" = "qn" ]; then
"$SERENITY_QEMU_BIN" \
$SERENITY_COMMON_QEMU_ARGS \
-device $SERENITY_ETHERNET_DEVICE_TYPE \
- -kernel Kernel/Prekernel/Prekernel \
- -initrd Kernel/Kernel \
+ $SERENITY_KERNEL_AND_INITRD \
-append "${SERENITY_KERNEL_CMDLINE}"
elif [ "$SERENITY_RUN" = "qtap" ]; then
# Meta/run.sh qtap: qemu with tap
@@ -383,8 +392,7 @@ elif [ "$SERENITY_RUN" = "qtap" ]; then
$SERENITY_PACKET_LOGGING_ARG \
-netdev tap,ifname=tap0,id=br0 \
-device $SERENITY_ETHERNET_DEVICE_TYPE,netdev=br0 \
- -kernel Kernel/Prekernel/Prekernel \
- -initrd Kernel/Kernel \
+ $SERENITY_KERNEL_AND_INITRD \
-append "${SERENITY_KERNEL_CMDLINE}"
sudo ip tuntap del dev tap0 mode tap
elif [ "$SERENITY_RUN" = "qgrub" ] || [ "$SERENITY_RUN" = "qextlinux" ]; then
@@ -403,8 +411,7 @@ elif [ "$SERENITY_RUN" = "q35" ]; then
$SERENITY_VIRT_TECH_ARG \
-netdev user,id=breh,hostfwd=tcp:127.0.0.1:8888-10.0.2.15:8888,hostfwd=tcp:127.0.0.1:8823-10.0.2.15:23 \
-device $SERENITY_ETHERNET_DEVICE_TYPE,netdev=breh \
- -kernel Kernel/Prekernel/Prekernel \
- -initrd Kernel/Kernel \
+ $SERENITY_KERNEL_AND_INITRD \
-append "${SERENITY_KERNEL_CMDLINE}"
elif [ "$SERENITY_RUN" = "isapc" ]; then
# Meta/run.sh q35: qemu (q35 chipset) with SerenityOS
@@ -414,8 +421,7 @@ elif [ "$SERENITY_RUN" = "isapc" ]; then
$SERENITY_VIRT_TECH_ARG \
-netdev user,id=breh,hostfwd=tcp:127.0.0.1:8888-10.0.2.15:8888,hostfwd=tcp:127.0.0.1:8823-10.0.2.15:23 \
-device ne2k_isa,netdev=breh \
- -kernel Kernel/Prekernel/Prekernel \
- -initrd Kernel/Kernel \
+ $SERENITY_KERNEL_AND_INITRD \
-append "${SERENITY_KERNEL_CMDLINE}"
elif [ "$SERENITY_RUN" = "microvm" ]; then
# Meta/run.sh q35: qemu (q35 chipset) with SerenityOS
@@ -425,8 +431,7 @@ elif [ "$SERENITY_RUN" = "microvm" ]; then
$SERENITY_VIRT_TECH_ARG \
-netdev user,id=breh,hostfwd=tcp:127.0.0.1:8888-10.0.2.15:8888,hostfwd=tcp:127.0.0.1:8823-10.0.2.15:23 \
-device ne2k_isa,netdev=breh \
- -kernel Kernel/Prekernel/Prekernel \
- -initrd Kernel/Kernel \
+ $SERENITY_KERNEL_AND_INITRD \
-append "${SERENITY_KERNEL_CMDLINE}"
elif [ "$SERENITY_RUN" = "q35grub" ]; then
# Meta/run.sh q35grub: qemu (q35 chipset) with SerenityOS, using a grub disk image
@@ -455,8 +460,7 @@ elif [ "$SERENITY_RUN" = "ci" ]; then
-nographic \
-display none \
-debugcon file:debug.log \
- -kernel Kernel/Prekernel/Prekernel \
- -initrd Kernel/Kernel \
+ $SERENITY_KERNEL_AND_INITRD \
-append "${SERENITY_KERNEL_CMDLINE}"
else
# Meta/run.sh: qemu with user networking
@@ -473,7 +477,6 @@ else
$SERENITY_VIRT_TECH_ARG \
$SERENITY_PACKET_LOGGING_ARG \
$SERENITY_NETFLAGS \
- -kernel Kernel/Prekernel/Prekernel \
- -initrd Kernel/Kernel \
+ $SERENITY_KERNEL_AND_INITRD \
-append "${SERENITY_KERNEL_CMDLINE}"
fi