#include "kernel/test_support/cpu.hpp" #include #include #include namespace { auto static initialized = std::atomic_flag{}; } namespace kapi::cpu { auto init() -> void { if (initialized.test_and_set()) { throw std::logic_error("kapi::cpu::init() called more than once"); } // TODO: make sure that simulated interrupt can run. } auto halt() -> void { throw kernel::tests::cpu::halt{}; } auto discover_topology() -> bool { // TODO: implement more meaningful simulated CPU topology discovery return true; } } // namespace kapi::cpu namespace kernel::tests::cpu { auto deinit() -> void { if (!initialized.test()) { throw std::logic_error{"kapi::cpu::reset() called before kapi::cpu::init()"}; } initialized.clear(); } } // namespace kernel::tests::cpu