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

Class PerCpu

src/include/per_cpu.hpp:23–45  ·  view source on GitHub ↗

@brief 每个 CPU 核心的局部数据

Source from the content-addressed store, hash-verified

21
22/// @brief 每个 CPU 核心的局部数据
23struct PerCpu {
24 /// 核心 ID
25 size_t core_id{0};
26
27 /// 当前运行的任务
28 TaskControlBlock* running_task{nullptr};
29 /// 空闲任务
30 TaskControlBlock* idle_task{nullptr};
31 /// 调度数据 (RunQueue) 指针
32 CpuSchedData* sched_data{nullptr};
33
34 /// @name 构造/析构函数
35 /// @{
36 explicit PerCpu(size_t id) : core_id(id) {}
37
38 PerCpu() = default;
39 PerCpu(const PerCpu&) = default;
40 PerCpu(PerCpu&&) = default;
41 auto operator=(const PerCpu&) -> PerCpu& = default;
42 auto operator=(PerCpu&&) -> PerCpu& = default;
43 ~PerCpu() = default;
44 /// @}
45} __attribute__((aligned(SIMPLEKERNEL_PER_CPU_ALIGN_SIZE)));
46
47static_assert(sizeof(PerCpu) <= SIMPLEKERNEL_PER_CPU_ALIGN_SIZE,
48 "PerCpu size should not exceed cache line size");

Callers 5

main_smpFunction · 0.85
mainFunction · 0.85
main_smpFunction · 0.85
mainFunction · 0.85
SetUpMethod · 0.85

Calls

no outgoing calls

Tested by 1

SetUpMethod · 0.68