diff --git a/Kernel/Arch/aarch64/Dummy.cpp b/Kernel/Arch/aarch64/Dummy.cpp index c8f90928616..9c947b330a2 100644 --- a/Kernel/Arch/aarch64/Dummy.cpp +++ b/Kernel/Arch/aarch64/Dummy.cpp @@ -141,63 +141,6 @@ void KString::operator delete(void*) VERIFY_NOT_REACHED(); } -// SafeMem.h -bool safe_memset(void*, int, size_t, void*&); -bool safe_memset(void*, int, size_t, void*&) -{ - VERIFY_NOT_REACHED(); - return false; -} - -ssize_t safe_strnlen(char const*, unsigned long, void*&); -ssize_t safe_strnlen(char const*, unsigned long, void*&) -{ - VERIFY_NOT_REACHED(); - return 0; -} - -bool safe_memcpy(void*, void const*, unsigned long, void*&); -bool safe_memcpy(void*, void const*, unsigned long, void*&) -{ - VERIFY_NOT_REACHED(); - return false; -} - -Optional safe_atomic_compare_exchange_relaxed(u32 volatile*, u32&, u32); -Optional safe_atomic_compare_exchange_relaxed(u32 volatile*, u32&, u32) -{ - VERIFY_NOT_REACHED(); - return {}; -} - -Optional safe_atomic_load_relaxed(u32 volatile*); -Optional safe_atomic_load_relaxed(u32 volatile*) -{ - VERIFY_NOT_REACHED(); - return {}; -} - -Optional safe_atomic_fetch_add_relaxed(u32 volatile*, u32); -Optional safe_atomic_fetch_add_relaxed(u32 volatile*, u32) -{ - VERIFY_NOT_REACHED(); - return {}; -} - -Optional safe_atomic_exchange_relaxed(u32 volatile*, u32); -Optional safe_atomic_exchange_relaxed(u32 volatile*, u32) -{ - VERIFY_NOT_REACHED(); - return {}; -} - -bool safe_atomic_store_relaxed(u32 volatile*, u32); -bool safe_atomic_store_relaxed(u32 volatile*, u32) -{ - VERIFY_NOT_REACHED(); - return {}; -} - } extern "C" { diff --git a/Kernel/Arch/aarch64/SafeMem.cpp b/Kernel/Arch/aarch64/SafeMem.cpp new file mode 100644 index 00000000000..93167f1108c --- /dev/null +++ b/Kernel/Arch/aarch64/SafeMem.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2022, Timon Kruiper + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include + +namespace Kernel { + +bool safe_memset(void*, int, size_t, void*&) +{ + VERIFY_NOT_REACHED(); + return false; +} + +ssize_t safe_strnlen(char const*, unsigned long, void*&) +{ + VERIFY_NOT_REACHED(); + return 0; +} + +bool safe_memcpy(void* dest_ptr, void const* src_ptr, unsigned long n, void*&) +{ + // FIXME: Actually implement a safe memcpy. + memcpy(dest_ptr, src_ptr, n); + return true; +} + +Optional safe_atomic_compare_exchange_relaxed(u32 volatile*, u32&, u32) +{ + VERIFY_NOT_REACHED(); + return {}; +} + +Optional safe_atomic_load_relaxed(u32 volatile*) +{ + VERIFY_NOT_REACHED(); + return {}; +} + +Optional safe_atomic_fetch_add_relaxed(u32 volatile*, u32) +{ + VERIFY_NOT_REACHED(); + return {}; +} + +Optional safe_atomic_exchange_relaxed(u32 volatile*, u32) +{ + VERIFY_NOT_REACHED(); + return {}; +} + +bool safe_atomic_store_relaxed(u32 volatile*, u32) +{ + VERIFY_NOT_REACHED(); + return {}; +} + +} diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index f1a1c6231d2..acc4cbf13c7 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -418,6 +418,7 @@ else() Arch/aarch64/kprintf.cpp Arch/aarch64/MainIdRegister.cpp Arch/aarch64/PageDirectory.cpp + Arch/aarch64/SafeMem.cpp Arch/aarch64/ScopedCritical.cpp Arch/aarch64/SmapDisabler.cpp Arch/aarch64/init.cpp