OurOS 0.1
Operating System built by McGill Students
 
Loading...
Searching...
No Matches
gdt.h File Reference
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  cpu_gdt_entry
 
struct  cpu_gdt_register
 

Macros

#define GDT_LONG_MODE   0x20
 
#define GDT_PRESENT   0x80
 
#define GDT_RING_0   0x00
 
#define GDT_RING_1   0x20
 
#define GDT_RING_2   0x40
 
#define GDT_RING_3   0x60
 
#define GDT_CONFORMING   0x04
 
#define GDT_SEGMENTS   3
 
#define GDT_NULL_OFFSET   0x00
 
#define GDT_KCODE   0x08
 
#define GDT_KCODE_LIMIT   0
 
#define GDT_KCODE_BASE   0
 
#define GDT_KCODE_MISC_LOW   GDT_PRESENT + GDT_RING_0
 
#define GDT_KCODE_MISC_HIGH   GDT_LONG_MODE
 
#define GDT_KDATA   0x10
 
#define GDT_KDATA_LIMIT   0
 
#define GDT_KDATA_BASE   0
 
#define GDT_KDATA_MISC_LOW   GDT_PRESENT
 
#define GDT_KDATA_MISC_HIGH   0
 
#define GDT_ENTRY_CREATE(lim, base, low, high)
 

Functions

struct cpu_gdt_entry __attribute__ ((packed))
 
void cpu_gdt_bind (void)
 
void cpu_gdt_describe (char *buf, uint64_t bufsz)
 

Variables

uint16_t limit_low
 
uint16_t base_low
 
uint8_t base_med
 
uint8_t present_dpl_and_conform
 
uint8_t flags_and_limit_high
 
uint8_t base_high
 
uint16_t limit
 
uint64_t base
 

Macro Definition Documentation

◆ GDT_CONFORMING

#define GDT_CONFORMING   0x04

◆ GDT_ENTRY_CREATE

#define GDT_ENTRY_CREATE (   lim,
  base,
  low,
  high 
)
Value:
{ \
lim & 0xffff, /* Segment limit (low) */ \
base & 0xffff, /* Base Address (low) */ \
(base >> 16) & 0xff, /* Base Address (med) */ \
low, /* Present/DPL/Conform */ \
high + (lim >> 16), /* Flags/Limit (high) */ \
base >> 24, /* Base Address (high) */ \
}
uint64_t base
Definition gdt.h:1

◆ GDT_KCODE

#define GDT_KCODE   0x08

◆ GDT_KCODE_BASE

#define GDT_KCODE_BASE   0

◆ GDT_KCODE_LIMIT

#define GDT_KCODE_LIMIT   0

◆ GDT_KCODE_MISC_HIGH

#define GDT_KCODE_MISC_HIGH   GDT_LONG_MODE

◆ GDT_KCODE_MISC_LOW

#define GDT_KCODE_MISC_LOW   GDT_PRESENT + GDT_RING_0

◆ GDT_KDATA

#define GDT_KDATA   0x10

◆ GDT_KDATA_BASE

#define GDT_KDATA_BASE   0

◆ GDT_KDATA_LIMIT

#define GDT_KDATA_LIMIT   0

◆ GDT_KDATA_MISC_HIGH

#define GDT_KDATA_MISC_HIGH   0

◆ GDT_KDATA_MISC_LOW

#define GDT_KDATA_MISC_LOW   GDT_PRESENT

◆ GDT_LONG_MODE

#define GDT_LONG_MODE   0x20

◆ GDT_NULL_OFFSET

#define GDT_NULL_OFFSET   0x00

◆ GDT_PRESENT

#define GDT_PRESENT   0x80

◆ GDT_RING_0

#define GDT_RING_0   0x00

◆ GDT_RING_1

#define GDT_RING_1   0x20

◆ GDT_RING_2

#define GDT_RING_2   0x40

◆ GDT_RING_3

#define GDT_RING_3   0x60

◆ GDT_SEGMENTS

#define GDT_SEGMENTS   3

Function Documentation

◆ __attribute__()

struct cpu_gdt_entry __attribute__ ( (packed)  )

◆ cpu_gdt_bind()

void cpu_gdt_bind ( void  )

◆ cpu_gdt_describe()

void cpu_gdt_describe ( char *  buf,
uint64_t  bufsz 
)

Variable Documentation

◆ base

uint64_t base

◆ base_high

uint8_t base_high

◆ base_low

uint16_t base_low

◆ base_med

uint8_t base_med

◆ flags_and_limit_high

uint8_t flags_and_limit_high

◆ limit

uint16_t limit

◆ limit_low

uint16_t limit_low

◆ present_dpl_and_conform

uint8_t present_dpl_and_conform