forked from xamidev/pepperOS
Function comments (v1)
This commit is contained in:
@@ -14,11 +14,20 @@
|
||||
uint64_t gdt_entries[NUM_GDT_ENTRIES];
|
||||
struct GDTR gdtr;
|
||||
|
||||
/*
|
||||
* gdt_load - Loads Global Descriptor Table
|
||||
*/
|
||||
static void gdt_load()
|
||||
{
|
||||
asm("lgdt %0" : : "m"(gdtr));
|
||||
}
|
||||
|
||||
/*
|
||||
* gdt_flush - Flushes the Global Descriptor Table
|
||||
*
|
||||
* This function loads new Segment Selectors to make
|
||||
* the GDT changes take effect
|
||||
*/
|
||||
static void gdt_flush()
|
||||
{
|
||||
// Here, 0x8 is the kernel code selector
|
||||
@@ -42,6 +51,15 @@ static void gdt_flush()
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* gdt_init - Global Descriptor Table initialization
|
||||
*
|
||||
* This function loads a new GDT in the CPU.
|
||||
* It contains a null descriptor, kernel code and data
|
||||
* segments, and user code and data segments.
|
||||
* However, we do not use segmentation to manage memory on
|
||||
* 64-bit x86, as it's deprecated. Instead, we use paging.
|
||||
*/
|
||||
void gdt_init()
|
||||
{
|
||||
// Null descriptor (required)
|
||||
|
||||
Reference in New Issue
Block a user