MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / GetCoreCount

Method GetCoreCount

src/include/kernel_fdt.hpp:54–64  ·  view source on GitHub ↗

* @brief 获取 CPU 核心数量 * @return Expected 成功返回核心数,失败返回错误 * @pre fdt_header_ 不为空 */

Source from the content-addressed store, hash-verified

52 * @pre fdt_header_ 不为空
53 */
54 [[nodiscard]] auto GetCoreCount() const -> Expected<size_t> {
55 assert(fdt_header_ != nullptr && "fdt_header_ is null");
56
57 return CountNodesByDeviceType("cpu").and_then(
58 [](size_t count) -> Expected<size_t> {
59 if (count == 0) {
60 return std::unexpected(Error(ErrorCode::kFdtNodeNotFound));
61 }
62 return count;
63 });
64 }
65
66 /**
67 * @brief 判断 PSCI 信息

Callers 2

BasicInfoMethod · 0.45
BasicInfoMethod · 0.45

Calls 1

ErrorClass · 0.85

Tested by

no test coverage detected