diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-04-01 12:15:25 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-04-01 12:15:25 +0200 |
| commit | 1f652b8b5ca5dbea588975466801cb1479f3dda8 (patch) | |
| tree | 2852f1d7cc6d33d0cb06c66fcfcf8c03dac2a112 /kernel/src/test_support/kapi/cpu.cpp | |
| parent | 0369fb7c4baa543dfb36ebb39ab53ac7560994ba (diff) | |
| download | teachos-1f652b8b5ca5dbea588975466801cb1479f3dda8.tar.xz teachos-1f652b8b5ca5dbea588975466801cb1479f3dda8.zip | |
kernel/tests: dissolve tests into source tree
Diffstat (limited to 'kernel/src/test_support/kapi/cpu.cpp')
| -rw-r--r-- | kernel/src/test_support/kapi/cpu.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/kernel/src/test_support/kapi/cpu.cpp b/kernel/src/test_support/kapi/cpu.cpp new file mode 100644 index 0000000..3ecaadc --- /dev/null +++ b/kernel/src/test_support/kapi/cpu.cpp @@ -0,0 +1,29 @@ +#include "kernel/tests/cpu.hpp" + +#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{}; + } + +} // namespace kapi::cpu
\ No newline at end of file |
