blob: 55b2beefc93d8c44e705198f6de22dc6bf3e2d2d (
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
46
47
48
49
50
51
|
//! TSS State
const types = @import("types/types.zig");
const constants = @import("constants/constants.zig");
const CoreTss = types.CoreTss;
const Tss = types.Tss;
var boot_tss: Tss = Tss{};
var core_tss_array: [constants.max_cores]CoreTss = undefined;
var core_count: u16 = 0;
var initialized: bool = false;
pub fn get_boot_tss() *Tss {
return &boot_tss;
}
pub fn get_boot_tss_address() u64 {
return @intFromPtr(&boot_tss);
}
pub fn get_core_tss(core_id: u16) ?*CoreTss {
if (core_id >= core_count) {
return null;
}
return &core_tss_array[core_id];
}
pub fn register_core(core_id: u16) ?*CoreTss {
if (core_id >= constants.max_cores) {
return null;
}
if (core_id >= core_count) {
core_count = core_id + 1;
}
core_tss_array[core_id] = CoreTss.init(core_id);
return &core_tss_array[core_id];
}
pub fn get_core_count() u16 {
return core_count;
}
pub fn is_initialized() bool {
return initialized;
}
pub fn set_initialized() void {
initialized = true;
}
|