Advertisement
Guest User

Untitled

a guest
Oct 26th, 2024
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. Function code:
  2. u64 create_idt_entry(u32 offset, IDTEntryAttributes attrib){
  3. u64 rv = 0;
  4. rv |= (u64)(offset & 0x0000FFFF) << 0;
  5. rv |= (u64)(0x8 & 0xFFFF) << 16; // seg selc will always be 0x8 as I will not be using any other code segments
  6. // RESERVED 8-BITS. NEXT SHIFT IS 40
  7. rv |= (u64)(attrib.gate_type & 0xF) << 40;
  8. rv |= (u64)(attrib.reserved & 0b1) << 44;
  9. rv |= (u64)(attrib.DPL & 0b11) << 45;
  10. rv |= (u64)(attrib.present & 0b1) << 47;
  11. rv |= (u64)(offset & 0xFFFF0000) << 48;
  12. return rv;
  13. }
  14.  
  15. Runtime argument values:
  16. offset = decimal: 2098592 hex: 0x2005A0
  17. attrib = {gate_type = 14 '\016', reserved = 0 '\000', DPL = 0 '\000', present = 1 '\001'}
  18.  
  19. Runtime output 💀:
  20. decimal: 156130651669888 hex: 0x8E0000080580
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement