aboutsummaryrefslogtreecommitdiff
path: root/kernel/tests/kapi/cpu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/tests/kapi/cpu.cpp')
-rw-r--r--kernel/tests/kapi/cpu.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/tests/kapi/cpu.cpp b/kernel/tests/kapi/cpu.cpp
index f03fca0..3ecaadc 100644
--- a/kernel/tests/kapi/cpu.cpp
+++ b/kernel/tests/kapi/cpu.cpp
@@ -2,9 +2,25 @@
#include <kapi/cpu.hpp>
+#include <atomic>
+#include <stdexcept>
+
namespace kapi::cpu
{
+ auto init() -> void
+ {
+ auto static initialized = std::atomic_flag{};
+ if (initialized.test_and_set())
+ {
+ throw std::logic_error("kapi::cpu::init() called more than once");
+ }
+
+ // TODO: make sure that simulated interrupt can run.
+
+ return;
+ }
+
auto halt() -> void
{
throw kernel::tests::cpu::halt{};