Advertisement
Guest User

gdt.h

a guest
Sep 1st, 2023
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.80 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include <stdint.h>
  4.  
  5. typedef struct
  6. {
  7.     uint16_t LimitLow;                  // limit (bits 0-15)
  8.     uint16_t BaseLow;                   // base (bits 0-15)
  9.     uint8_t BaseMiddle;                 // base (bits 16-23)
  10.     uint8_t Access;                     // access
  11.     uint8_t FlagsLimitHi;               // limit (bits 16-19) | flags
  12.     uint8_t BaseHigh;                   // base (bits 24-31)
  13. } __attribute__((packed)) GDTEntry;
  14.  
  15. typedef struct {
  16.     uint16_t limit;       // limit size of all GDT segments
  17.     uint64_t base_address;  // base address of the first GDT segment
  18. } __attribute__((packed)) GDT_PTR;
  19.  
  20.  
  21. #define GTD_DESC_COUNT 10
  22.  
  23. void SetGDTEntry(int index, uint32_t base, uint32_t limit, uint8_t access, uint8_t gran);
  24. void GDT_Init();
  25.  
  26.  
  27. void gdt_init(void);
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement