aboutsummaryrefslogtreecommitdiff
path: root/mirai/interrupts/types/descriptor.zig
blob: 7b9865d9626dcde87072d2e83e6c4b678ef5cbdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! IDT Descriptor for LIDT

const gate = @import("gate.zig");

pub const Descriptor = packed struct(u80) {
    limit: u16,
    base: u64,

    pub fn from_table(table: *const [256]gate.Gate64) Descriptor {
        return Descriptor{
            .limit = @sizeOf([256]gate.Gate64) - 1,
            .base = @intFromPtr(table),
        };
    }
};

comptime {
    if (@sizeOf(Descriptor) != 10) @compileError("Descriptor must be 10 bytes");
}