#include <libc.h>
#include <types.h>
#include <errno.h>
#include "gdt.h"
#include "sysdesc.h"
#include "tss.h"
Go to the source code of this file.
Define Documentation
Definition at line 35 of file gdt.c.
Definition at line 32 of file gdt.c.
Definition at line 28 of file gdt.c.
Function Documentation
Definition at line 99 of file gdt.c.
{
if (limit > (1 << 20))
{
pok_gdt[index].limit_low = (limit >> 12) & 0xFFFF;
pok_gdt[index].limit_high = (limit >> 28) & 0xF;
pok_gdt[index].granularity = 1;
}
else
{
pok_gdt[index].limit_low = limit & 0xFFFF;
pok_gdt[index].limit_high = (limit >> 16) & 0xFF;
pok_gdt[index].granularity = 0;
}
pok_gdt[index].base_low = base_address & 0xFFFFFF;
pok_gdt[index].base_high = (base_address >> 24) & 0xFF;
pok_gdt[index].type = t & 0xF;
pok_gdt[index].dpl = dpl & 0x3;
pok_gdt[index].s = 1;
pok_gdt[index].present = 1;
pok_gdt[index].available = 0;
pok_gdt[index].op_size = 1;
}
Definition at line 130 of file gdt.c.
{
pok_gdt[index].limit_low = limit & 0xFFFF;
pok_gdt[index].limit_high = (limit >> 16) & 0xFF;
pok_gdt[index].base_low = base_address & 0xFFFFFF;
pok_gdt[index].base_high = (base_address >> 24) & 0xFF;
pok_gdt[index].type = t & 0xF;
pok_gdt[index].dpl = dpl & 0x3;
pok_gdt[index].s = 0;
pok_gdt[index].present = 1;
pok_gdt[index].available = 0;
pok_gdt[index].op_size = 0;
}
Definition at line 41 of file gdt.c.
{
sysdesc_t sysdesc;
memset(pok_gdt, 0, sizeof (gdt_entry_t) * GDT_SIZE);
gdt_set_segment(GDT_CORE_CODE_SEGMENT, 0, ~0UL, GDTE_CODE, 0);
gdt_set_segment(GDT_CORE_DATA_SEGMENT, 0, ~0UL, GDTE_DATA, 0);
sysdesc.limit = sizeof (pok_gdt);
sysdesc.base = (uint32_t)pok_gdt;
asm ("lgdt %0"
:
: "m" (sysdesc));
asm ("ljmp %0, $1f \n"
"1: \n"
"mov %1, %%ax \n"
"mov %%ax, %%ds \n"
"mov %%ax, %%es \n"
"mov %%ax, %%fs \n"
"mov %%ax, %%gs \n"
"mov %%ax, %%ss \n"
:
: "i" (GDT_CORE_CODE_SEGMENT << 3),
"i" (GDT_CORE_DATA_SEGMENT << 3)
: "eax");
pok_tss_init();
return (POK_ERRNO_OK);
}
Definition at line 79 of file gdt.c.
{
uint16_t sel = GDT_BUILD_SELECTOR(GDT_TSS_SEGMENT, 0, 0);
memset(&pok_tss, 0, sizeof (tss_t));
pok_tss.ss0 = GDT_BUILD_SELECTOR(GDT_CORE_DATA_SEGMENT, 0, 0);
gdt_set_system(GDT_TSS_SEGMENT, (uint32_t)&pok_tss,
sizeof (tss_t), GDTE_TSS, 0);
asm ("ltr %0" : :"m"(sel));
return (POK_ERRNO_OK);
}
Definition at line 94 of file gdt.c.
Variable Documentation
Definition at line 37 of file gdt.c.
Definition at line 39 of file gdt.c.