From 9937bcb03d4b3c3e71c33786349d4a41203550c0 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 27 Mar 2026 10:22:39 +0100 Subject: [FEAT] kernel: Fix SysChk, add MemoryTest, fix BootThread class. Signed-off-by: Amlal El Mahrouss --- src/boot/modules/MemoryTest/MemoryTest.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/boot/modules/MemoryTest/MemoryTest.cpp (limited to 'src/boot/modules/MemoryTest/MemoryTest.cpp') 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 +#include +#include + +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; +} -- cgit v1.2.3