Advertisement
My-Bad-2

Untitled

Nov 1st, 2023
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | Source Code | 0 0
  1. extern "C" uintptr_t __interrupt_handlers[256];
  2.  
  3. namespace system {
  4. namespace interrupts {
  5. static idt _idt = {};
  6.  
  7. void init() {
  8.     for (int i = 0; i < 256; i++) {
  9.         _idt.entries[i] = {__interrupt_handlers[i], 0, type::Gate};
  10.     }
  11.  
  12.     idt_descriptor descriptor = {
  13.         (uint16_t)sizeof(idt_entry) * 256 - 1,
  14.         reinterpret_cast<uintptr_t>(&_idt),
  15.     };
  16.  
  17.     descriptor.load();
  18.  
  19.     log::info.print("IDT Initialization - Success");
  20. }
  21. }  // namespace interrupts
  22. }  // namespace system
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement