diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-27 10:22:39 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-27 10:22:39 +0100 |
| commit | 9937bcb03d4b3c3e71c33786349d4a41203550c0 (patch) | |
| tree | bdccb35393863256ab0fc806836173c9a7bd50cf /src/boot/modules/MemoryTest/MemoryTest.cpp | |
| parent | 0fece463b13c0b6982ceb1be3e26c12444b1cb9e (diff) | |
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/boot/modules/MemoryTest/MemoryTest.cpp')
| -rw-r--r-- | src/boot/modules/MemoryTest/MemoryTest.cpp | 30 |
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; +} |
