feat(amd64): add PGE to cpuid

This commit is contained in:
Loïc Grégoire
2026-03-29 21:16:57 -04:00
parent 88cdefe929
commit b0fb96dc5b
2 changed files with 7 additions and 2 deletions
+4
View File
@@ -320,6 +320,7 @@ pub const CpuFeatures = struct {
pcid: bool, pcid: bool,
smap: bool, smap: bool,
smep: bool, smep: bool,
pge: bool,
vendor_string: [12]u8, vendor_string: [12]u8,
brand_string: [48]u8, brand_string: [48]u8,
}; };
@@ -343,6 +344,7 @@ pub fn detect_cpu_features() void {
var pcid = false; var pcid = false;
var smap = false; var smap = false;
var smep = false; var smep = false;
var pge = false;
var vendor_string: [12]u8 = undefined; var vendor_string: [12]u8 = undefined;
var brand_string: [48]u8 = undefined; var brand_string: [48]u8 = undefined;
@@ -361,6 +363,7 @@ pub fn detect_cpu_features() void {
xsave = ecx.xsave; xsave = ecx.xsave;
pcid = ecx.pcid; pcid = ecx.pcid;
fxsave = edx.fxsave; fxsave = edx.fxsave;
pge = edx.pge;
} }
if (max_basic >= 0x7) { if (max_basic >= 0x7) {
@@ -416,5 +419,6 @@ pub fn detect_cpu_features() void {
.smep = smep, .smep = smep,
.vendor_string = vendor_string, .vendor_string = vendor_string,
.brand_string = brand_string, .brand_string = brand_string,
.pge = pge,
}; };
} }
+3 -2
View File
@@ -7,7 +7,7 @@ pub const name = "amd64";
const com1 = 0x3F8; const com1 = 0x3F8;
fn com1_init() void { fn com1_init() linksection(b.init) void {
cpu.outb(com1 + 0x3, 0x80); cpu.outb(com1 + 0x3, 0x80);
cpu.outb(com1 + 0x0, 0x0c); cpu.outb(com1 + 0x0, 0x0c);
cpu.outb(com1 + 0x1, 0x00); cpu.outb(com1 + 0x1, 0x00);
@@ -44,12 +44,13 @@ pub fn early_init() linksection(b.init) void {
const f = cpu.cpu_features; const f = cpu.cpu_features;
std.log.info("amd64/cpu: {s}", .{&f.brand_string}); std.log.info("amd64/cpu: {s}", .{&f.brand_string});
std.log.info("amd64/cpu: vendor={s} x2apic={} la57={} nx={} pcid={} smap={} smep={} pdpe1g={} invtsc={} xsave={} fxsave={} tsc-deadline={}", .{ std.log.info("amd64/cpu: vendor={s} x2apic={} la57={} nx={} pcid={} pge={} smap={} smep={} pdpe1g={} invtsc={} xsave={} fxsave={} tsc-deadline={}", .{
&f.vendor_string, &f.vendor_string,
@intFromBool(f.x2apic), @intFromBool(f.x2apic),
@intFromBool(f.five_level_paging), @intFromBool(f.five_level_paging),
@intFromBool(f.nx), @intFromBool(f.nx),
@intFromBool(f.pcid), @intFromBool(f.pcid),
@intFromBool(f.pge),
@intFromBool(f.smap), @intFromBool(f.smap),
@intFromBool(f.smep), @intFromBool(f.smep),
@intFromBool(f.gib_pages), @intFromBool(f.gib_pages),