cowos

custom OS from scratch in C
git clone git://git.daat.foo/cowos.git
Log | Files | Refs | README | LICENSE

gdt.h (538B)


      1 #include <stdint.h>
      2 
      3 #ifndef GDT_H
      4 #define GDT_H
      5 
      6 typedef struct GDTEntry {
      7 	uint16_t limit_low;
      8 	uint16_t base_low;
      9 	uint8_t base_mid;
     10 	uint8_t access;
     11 	uint8_t limit_high_and_flags;
     12 	uint8_t base_high;
     13 } __attribute__((packed)) GDTEntry;
     14 
     15 typedef struct GDTPtr {
     16 	uint16_t limit;
     17 	uint64_t base;
     18 } __attribute__((packed)) GDTPtr;
     19 
     20 #define GDT_NUM_ENTRIES 5 // Incl. null descriptor 
     21 #define GDT_KERNEL_CODE 0x08
     22 #define GDT_KERNEL_DATA 0x10
     23 #define GDT_USER_CODE   0x18
     24 #define GDT_USER_DATA   0x20
     25 
     26 void initGDT();
     27 
     28 #endif /* GDT_H */