topology: system cpu topology

This commit is contained in:
Matheus
2024-10-05 11:32:39 -03:00
parent 8315d5642e
commit 3152d1bc3c
3 changed files with 71 additions and 0 deletions
+10
View File
@@ -3,6 +3,7 @@
#include <cpuid.h>
#include <logging.h>
#include <arch/cpuid.h>
#include <kernel/topology.h>
#define EFER_SYSCALLENABLE 1
@@ -213,4 +214,13 @@ void cpu_initstate() {
done += snprintf(str_buf + done, 128 - done, "%d%c", topology_ids[i], i == topology_depth - 1 ? 0 : ':');
str_buf[done] = '\n';
printf("%s\n", str_buf);
// insert it into the topology tree
topology_node_t *topology_nodes[topology_depth];
for (int i = 0; i < topology_depth; ++i) {
topology_nodes[i] = topology_create_node();
__assert(topology_nodes[i]);
topology_insert(topology_nodes[i], i == 0 ? topology_get_root() : topology_nodes[i - 1], TOPOLOGY_MAKE_ID(topology_types[i], topology_ids[i]), current_cpu());
}
}