summaryrefslogtreecommitdiffhomepage
path: root/src/boot/modules/MemoryTest/MemoryTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot/modules/MemoryTest/MemoryTest.cpp')
-rw-r--r--src/boot/modules/MemoryTest/MemoryTest.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/boot/modules/MemoryTest/MemoryTest.cpp b/src/boot/modules/MemoryTest/MemoryTest.cpp
new file mode 100644
index 00000000..49f28dcb
--- /dev/null
+++ b/src/boot/modules/MemoryTest/MemoryTest.cpp
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org)
+// Licensed under the Apache License, Version 2.0 (see LICENSE file)
+// Official repository: https://github.com/ne-foss-org/nekernel
+
+#include <BootKit/BootKit.h>
+#include <BootKit/BootThread.h>
+#include <FirmwareKit/EFI/API.h>
+
+EXTERN_C Int32 MemoryTestModuleMain(Kernel::HEL::BootInfoHeader* handover) {
+ fw_init_efi((EfiSystemTable*) handover->f_FirmwareCustomTables[Kernel::HEL::kHandoverTableST]);
+
+ Boot::BootTextWriter writer;
+ writer.Write("MemoryTest: Testing Memory...\r");
+
+ constexpr auto kTestValue = 0x20000000L;
+
+ Int32* mem = (Int32*) kTestValue;
+ if (!mem) return kEfiFail;
+
+ auto prev = *mem;
+ *mem = 42;
+ if (*mem != 42) {
+ return kEfiFail;
+ }
+
+ *mem = prev;
+
+ return kEfiOk;
+}