Advertisement
Guest User

idt.h

a guest
Sep 1st, 2023
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1. #pragma once
  2. #include "kattributes.h"
  3. typedef struct {
  4.     uint16_t isrLow;
  5.     uint16_t kernelCs;
  6.     uint8_t     ist;          
  7.     uint8_t     attributes;  
  8.     uint16_t    isrMid;      
  9.     uint32_t    isrHigh;    
  10.     uint32_t    reserved;
  11.  
  12. }PACKED IDT_ENTRY64;
  13.  
  14. typedef struct {
  15.     uint16_t limit;
  16.     uint64_t base;
  17.  
  18. }PACKED IDT_DESCRIPTOR64;
  19.  
  20. typedef enum
  21. {
  22.     IDT_FLAG_GATE_64BIT_INT         = 0xE,
  23.     IDT_FLAG_GATE_64BIT_TRAP        = 0xF,
  24.  
  25.     IDT_FLAG_RING0                  = (0 << 5),
  26.     IDT_FLAG_RING1                  = (1 << 5),
  27.     IDT_FLAG_RING2                  = (2 << 5),
  28.     IDT_FLAG_RING3                  = (3 << 5),
  29.  
  30.     IDT_FLAG_PRESENT                = 0x80,
  31.  
  32. } IDT_FLAGS;
  33.  
  34. void IDT_SetGate(int gate, void* handler, int flags);
  35. void Initialize_IDT();
  36. void IDT_EnableGate(int interrupt);
  37. void IDT_DisableGate(int interrupt) ;
  38. void Initialize_IDT();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement