Function code: u64 create_idt_entry(u32 offset, IDTEntryAttributes attrib){ u64 rv = 0; rv |= (u64)(offset & 0x0000FFFF) << 0; rv |= (u64)(0x8 & 0xFFFF) << 16; // seg selc will always be 0x8 as I will not be using any other code segments // RESERVED 8-BITS. NEXT SHIFT IS 40 rv |= (u64)(attrib.gate_type & 0xF) << 40; rv |= (u64)(attrib.reserved & 0b1) << 44; rv |= (u64)(attrib.DPL & 0b11) << 45; rv |= (u64)(attrib.present & 0b1) << 47; rv |= (u64)(offset & 0xFFFF0000) << 48; return rv; } Runtime argument values: offset = decimal: 2098592 hex: 0x2005A0 attrib = {gate_type = 14 '\016', reserved = 0 '\000', DPL = 0 '\000', present = 1 '\001'} Runtime output 💀: decimal: 156130651669888 hex: 0x8E0000080580