blob: 85f4d4763a7ad52e6623c4f9ad8c8080fdcc7950 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#include "kernel/devices/cpu.hpp"
#include "kapi/cpu.hpp"
#include "kapi/devices.hpp"
#include <kstd/print>
#include <cstddef>
#include <cstdint>
namespace kernel::devices
{
cpu::core::core(std::size_t major_number, std::size_t minor_number, std::uint64_t hardware_id, bool is_bsp)
: kapi::devices::bus{major_number, minor_number, "cpu_core"}
, m_hardware_id{hardware_id}
, m_is_bsp{is_bsp}
{}
auto cpu::core::hardware_id() const -> std::uint64_t
{
return m_hardware_id;
}
auto cpu::core::is_bsp() const -> bool
{
return m_is_bsp;
}
cpu::cpu(std::size_t major_number)
: kapi::devices::bus{major_number, 0, "cpu"}
{}
auto cpu::probe() -> bool
{
if (!kapi::cpu::discover_topology(*this))
{
kstd::println("[OS:DEV] Failed to discover CPU topology");
return false;
}
return true;
}
} // namespace kernel::devices
|