Advertisement
My-Bad-2

idt_nnew.cpp

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