Guest User

Untitled

a guest
Jul 22nd, 2024
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. void IDTEntry(int num, unsigned int offset, uint16_t selector, uint8_t gate_type, uint8_t dpl){
  2. uint64_t entry = 0;
  3. entry = entry | (((uint64_t)offset & 0x0000FFFF) << 0);
  4. entry = entry | (((uint64_t)selector & 0xFFFF) << 16);
  5. // 8 bits reseentryed (next is 40)
  6. entry = entry | (((uint64_t)gate_type & 0xF) << 40);
  7. // 1 bits reseentryed (next is 45)
  8. entry = entry | (((uint64_t)dpl & 0b11) << 45);
  9. uint64_t thingy = 0b1;
  10. entry = entry | (((uint64_t)thingy & 0b1) << 47);
  11. entry = entry | (((uint64_t)offset & 0xFFFF0000) << 48);
  12. IDT[num] = entry;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment