MyOS Kernel
gdt.c File Reference
#include <stdint.h>
#include <string.h>

Data Structures

struct  gdt_entry
 
struct  gdt_description
 
struct  tss_entry
 

Macros

#define NUM_ENTRIES   6
 Number of entries in the GDT.
 

Functions

static void set_entry (int i, uint32_t base, uint32_t limit, uint8_t access)
 
static void write_tss (int32_t num, uint16_t ss0, uint32_t esp0)
 
void allow_all_ports ()
 
void block_all_ports ()
 
void gdt_init ()
 

Variables

uint32_t int_stack_top
 Initial kernel stack before the kernel's first yield.
 
static gdt_entry gdt [NUM_ENTRIES]
 The GDT.
 
static gdt_description gdt_desc
 The value to load into the GDTR.
 
tss_entry tss
 The TSS.
 

Function Documentation

◆ allow_all_ports()

void allow_all_ports ( )

Allows all ports in the IOPB.

◆ block_all_ports()

void block_all_ports ( )

Blocks all ports in the IOPB.

◆ gdt_init()

void gdt_init ( )

Initializes the GDT & TSS.

◆ set_entry()

static void set_entry ( int  i,
uint32_t  base,
uint32_t  limit,
uint8_t  access 
)
static

Set a GDT entry.

Parameters
iThe GDT entry to set.
baseThe base of the GDT entry.
limitThe limit of the GDT entry.
accessThe access byte of the GDT entry.

◆ write_tss()

static void write_tss ( int32_t  num,
uint16_t  ss0,
uint32_t  esp0 
)
static

Set a GDT entry.

Parameters
numThe GDT entry to set.
ss0The kernel stack selector.
esp0The kernel stack pointer.