250 {
251 per_cpu::PerCpuArraySingleton::create();
253
259
260 TaskManagerSingleton::create();
261 TaskManagerSingleton::instance().InitCurrentCore();
262
264
266
268
270
271 for (size_t i = 0; i < kTestCount; ++i) {
272 test_results[i].name = test_cases[i].name;
274 test_results[i].exit_code = -1;
275 test_results[i].pid = 0;
276 }
277
278
279 size_t expected_cores = BasicInfoSingleton::instance().core_count - 1;
280 klog::Info(
"[RUNNER] Waiting for {} secondary core(s) to initialize...",
281 expected_cores);
282 while (g_cores_ready.load(std::memory_order_acquire) < expected_cores) {
284 }
285 klog::Info(
"[RUNNER] All cores ready, starting SMP tests");
286
287 for (size_t i = 0; i < kTestCount; ++i) {
288 if (!test_cases[i].is_smp_test) {
289 continue;
290 }
291 auto& result = test_results[i];
293
294 klog::Info(
"[SMP] Running: {}", test_cases[i].name);
295 bool smp_passed = test_cases[i].func();
296
297 result.exit_code = smp_passed ? 0 : 1;
298 result.status =
300
301 klog::Info(
"[SMP] Finished: {} — {}", test_cases[i].name,
302 smp_passed ? "PASS" : "FAIL");
303 }
304
305 auto runner = kstd::make_unique<TaskControlBlock>("test_runner", 10,
306 test_runner_entry, nullptr);
307 TaskManagerSingleton::instance().AddTask(std::move(runner));
308
309 TaskManagerSingleton::instance().Schedule();
310
311 __builtin_unreachable();
312}
auto WakeUpOtherCores() -> void
唤醒其余 core
auto ArchInit(int argc, const char **argv) -> void
体系结构相关初始化
auto DumpStack() -> void
打印调用栈
auto InterruptInit(int, const char **) -> void
体系结构相关中断初始化
auto TimerInit() -> void
初始化定时器
auto DeviceInit() -> void
设备子系统初始化入口
auto FileSystemInit() -> void
文件系统子系统初始化入口
auto MemoryInit() -> void
内存子系统初始化
auto GetCurrentCoreId() -> size_t
auto Info(etl::format_string< Args... > fmt, Args &&... args) -> void
以 INFO 级别记录日志
static __always_inline auto GetCurrentCore() -> PerCpu &
获取当前核心的 PerCpu 数据