diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-04-01 09:48:12 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-04-01 09:48:12 +0200 |
| commit | 0b139b3c66b340bb560dc608ea3b15a07ec95ee3 (patch) | |
| tree | 6d0408eabcb79d25c1cc2b6c2893c260c3b1785e /kernel | |
| parent | fa1ea53e6f3dd6b9b5f5f8160776b230184a30bf (diff) | |
| download | teachos-0b139b3c66b340bb560dc608ea3b15a07ec95ee3.tar.xz teachos-0b139b3c66b340bb560dc608ea3b15a07ec95ee3.zip | |
kernel/tests: add kapi::cpu::init stub
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/tests/kapi/cpu.cpp | 16 | ||||
| -rw-r--r-- | kernel/tests/src/main.cpp | 4 |
2 files changed, 19 insertions, 1 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{}; diff --git a/kernel/tests/src/main.cpp b/kernel/tests/src/main.cpp index f1f9bb4..a21aa9d 100644 --- a/kernel/tests/src/main.cpp +++ b/kernel/tests/src/main.cpp @@ -1,10 +1,12 @@ #include <kapi/cio.hpp> +#include <kapi/cpu.hpp> #include <catch2/catch_session.hpp> auto main(int argc, char ** argv) -> int { kapi::cio::init(); + kapi::cpu::init(); return Catch::Session().run(argc, argv); -}
\ No newline at end of file +} |
