Pip
Architecture-dependent parts of Pip: MAL, IAL and boot
|
GDT configuration. More...
#include "gdt.h"
#include "libc.h"
#include "debug.h"
#include "pipcall.h"
#include "segment_selectors.h"
Macros | |
#define | GDT_N_ENTRY (LAST_PIPCALL + 1) |
Functions | |
void | set_segment_descriptor (uint32_t num, uint32_t base, uint32_t limit, unsigned char type, unsigned char dpl, unsigned char granularity) |
void | set_callgate_descriptor (int num, void *handler, uint8_t args, uint8_t dpl, uint16_t segment) |
Installs a call gate entry into the GDT. More... | |
void | set_tss_descriptor (uint32_t num, tss_t *tss_ptr, uint32_t limit, unsigned char type, unsigned char dpl, unsigned char granularity) |
void | set_tss (uint16_t kernel_code_segment, uint16_t kernel_data_segment, uint16_t kernel_stack_segment) |
void | setKernelStack (uint32_t stack) |
Updates the kernel stack address into the TSS. More... | |
void | load_gdt (void *base, uint16_t limit) |
void | load_tss () |
void | gdt_init (void) |
Installs the GDT into the CPU. More... | |
Variables | |
gdt_entry_t | gdt [GDT_N_ENTRY] |
Our GDT. More... | |
tss_t | tss |
Generic TSS for userland-to-kernel switch. More... | |
void * | cg_outbGlue |
void * | cg_inbGlue |
void * | cg_outwGlue |
void * | cg_inwGlue |
void * | cg_outlGlue |
void * | cg_inlGlue |
void * | cg_outaddrlGlue |
void * | cg_createPartition |
void * | cg_countToMap |
void * | cg_prepare |
void * | cg_addVAddr |
void * | cg_get_int_state |
void * | cg_set_int_state |
void * | cg_removeVAddr |
void * | cg_mappedInChild |
void * | cg_deletePartition |
void * | cg_collect |
void * | cg_yieldGlue |
GDT configuration.
#define GDT_N_ENTRY (LAST_PIPCALL + 1) |
void gdt_init | ( | void | ) |
Installs the GDT into the CPU.
Callgate setup (Syscalls)
void load_gdt | ( | void * | base, |
uint16_t | limit | ||
) |
< Pointer to our GDT
void load_tss | ( | ) |
void set_callgate_descriptor | ( | int | num, |
void * | handler, | ||
uint8_t | args, | ||
uint8_t | dpl, | ||
uint16_t | segment | ||
) |
Installs a call gate entry into the GDT.
num | The index of the segment into the GDT |
handler | The function pointer |
args | Argument count |
dpl | Descriptor Privilege Level (Caller Privilege Level must be numerically less or equal to DPL) |
segment | The segment to switch to |
void set_segment_descriptor | ( | uint32_t | num, |
uint32_t | base, | ||
uint32_t | limit, | ||
unsigned char | type, | ||
unsigned char | dpl, | ||
unsigned char | granularity | ||
) |
void set_tss | ( | uint16_t | kernel_code_segment, |
uint16_t | kernel_data_segment, | ||
uint16_t | kernel_stack_segment | ||
) |
< Pointer to the previous TSS entry (updated on a task switch)
< Kernel-mode ESP (static)
< Kernel-mode stack segment (static)
< Ring-1 ESP (static)
< Ring-1 stack segment (static)
< Ring-2 ESP (static)
< Ring-2 stack segment (static)
< Page directory address (static)
< Execution pointer (prior to task switch)
< CPU flags (prior to task switch)
< General register EAX (prior to task switch)
< General register ECX (prior to task switch)
< General register EDX (prior to task switch)
< General register EBX (prior to task switch)
< User-mode ESP (prior to task switch)
< User-mode EBP (prior to task switch)
< General register ESI (prior to task switch)
< General register EDI (prior to task switch)
< Segment selector ES (prior to task switch)
< Segment selector CS (prior to task switch)
< Segment selector SS (prior to task switch)
< Segment selector DS (prior to task switch)
< Segment selector FS (prior to task switch)
< Segment selector GS (prior to task switch)
< Pointer to the LDT (static)
< Flag to raise an exception when a task switch to this task occurs (static)
< IOMMU base
void set_tss_descriptor | ( | uint32_t | num, |
tss_t * | tss_ptr, | ||
uint32_t | limit, | ||
unsigned char | type, | ||
unsigned char | dpl, | ||
unsigned char | granularity | ||
) |
void setKernelStack | ( | uint32_t | stack | ) |
Updates the kernel stack address into the TSS.
stack | The stack address |
void* cg_addVAddr |
void* cg_collect |
void* cg_countToMap |
void* cg_createPartition |
void* cg_deletePartition |
void* cg_get_int_state |
void* cg_inbGlue |
void* cg_inlGlue |
void* cg_inwGlue |
void* cg_mappedInChild |
void* cg_outaddrlGlue |
void* cg_outbGlue |
void* cg_outlGlue |
void* cg_outwGlue |
void* cg_prepare |
void* cg_removeVAddr |
void* cg_set_int_state |
void* cg_yieldGlue |
gdt_entry_t gdt[GDT_N_ENTRY] |
Our GDT.
tss_t tss |
Generic TSS for userland-to-kernel switch.