MOS Source Code
Loading...
Searching...
No Matches
descriptors.h File Reference
#include <mos/platform/platform.h>
#include <mos/types.h>
+ Include dependency graph for descriptors.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  gdt_entry_t
 
struct  gdt_ptr_t
 
struct  tss64_t
 
struct  x86_cpu_descriptor_t
 
struct  idt_entry_t
 
struct  idtr_t
 

Macros

#define GDT_NULL   0x00
 
#define GDT_SEGMENT   0x10
 
#define GDT_PRESENT   0x80
 
#define GDT_GRANULARITY_BYTE   0x40
 
#define GDT_GRANULARITY_PAGE   0xC0
 
#define GDT_SEGMENT_NULL   0x00
 
#define GDT_SEGMENT_KCODE   0x10
 
#define GDT_SEGMENT_KDATA   0x20
 
#define GDT_SEGMENT_USERCODE   0x30
 
#define GDT_SEGMENT_USERDATA   0x40
 
#define GDT_SEGMENT_TSS   0x50
 
#define GDT_ENTRY_COUNT   6
 

Functions

 MOS_STATIC_ASSERT (sizeof(gdt_entry_t)==16, "gdt_entry_t is not 16 bytes")
 
 MOS_STATIC_ASSERT (sizeof(gdt_ptr_t)==2+sizeof(void *), "gdt_ptr_t is not 6 bytes")
 
 MOS_STATIC_ASSERT (sizeof(tss64_t)==0x68, "tss64_t is not 0x68 bytes")
 
 PER_CPU_DECLARE (x86_cpu_descriptor_t, x86_cpu_descriptor)
 
 MOS_STATIC_ASSERT (sizeof(idt_entry_t)==16, "idt_entry_t is not 16 bytes")
 
 MOS_STATIC_ASSERT (sizeof(idtr_t)==2+sizeof(void *), "idtr32_t is not 6 bytes")
 
void x86_init_percpu_gdt (void)
 
void x86_init_percpu_tss (void)
 
void x86_init_percpu_idt (void)
 
void x86_idt_init (void)
 
void gdt_flush (gdt_ptr_t *gdt_ptr)
 
void tss_flush (u32 tss_selector)
 
void gdt_flush_only (gdt_ptr_t *gdt_ptr)
 

Macro Definition Documentation

◆ GDT_NULL

#define GDT_NULL   0x00

Definition at line 8 of file descriptors.h.

◆ GDT_SEGMENT

#define GDT_SEGMENT   0x10

Definition at line 9 of file descriptors.h.

◆ GDT_PRESENT

#define GDT_PRESENT   0x80

Definition at line 10 of file descriptors.h.

◆ GDT_GRANULARITY_BYTE

#define GDT_GRANULARITY_BYTE   0x40

Definition at line 12 of file descriptors.h.

◆ GDT_GRANULARITY_PAGE

#define GDT_GRANULARITY_PAGE   0xC0

Definition at line 13 of file descriptors.h.

◆ GDT_SEGMENT_NULL

#define GDT_SEGMENT_NULL   0x00

Definition at line 15 of file descriptors.h.

◆ GDT_SEGMENT_KCODE

#define GDT_SEGMENT_KCODE   0x10

Definition at line 17 of file descriptors.h.

Referenced by x86_setup_thread_common().

◆ GDT_SEGMENT_KDATA

#define GDT_SEGMENT_KDATA   0x20

Definition at line 18 of file descriptors.h.

Referenced by x86_setup_thread_common().

◆ GDT_SEGMENT_USERCODE

#define GDT_SEGMENT_USERCODE   0x30

Definition at line 19 of file descriptors.h.

Referenced by x86_setup_thread_common().

◆ GDT_SEGMENT_USERDATA

#define GDT_SEGMENT_USERDATA   0x40

Definition at line 20 of file descriptors.h.

Referenced by x86_setup_thread_common().

◆ GDT_SEGMENT_TSS

#define GDT_SEGMENT_TSS   0x50

Definition at line 21 of file descriptors.h.

Referenced by x86_init_percpu_tss().

◆ GDT_ENTRY_COUNT

#define GDT_ENTRY_COUNT   6

Definition at line 23 of file descriptors.h.

Function Documentation

◆ MOS_STATIC_ASSERT() [1/5]

MOS_STATIC_ASSERT ( sizeof(gdt_entry_t) = =16,
"gdt_entry_t is not 16 bytes"  )

◆ MOS_STATIC_ASSERT() [2/5]

MOS_STATIC_ASSERT ( sizeof(gdt_ptr_t) = =2+sizeof(void *),
"gdt_ptr_t is not 6 bytes"  )

◆ MOS_STATIC_ASSERT() [3/5]

MOS_STATIC_ASSERT ( sizeof(tss64_t) = =0x68,
"tss64_t is not 0x68 bytes"  )

◆ PER_CPU_DECLARE()

PER_CPU_DECLARE ( x86_cpu_descriptor_t ,
x86_cpu_descriptor  )
extern

◆ MOS_STATIC_ASSERT() [4/5]

MOS_STATIC_ASSERT ( sizeof(idt_entry_t) = =16,
"idt_entry_t is not 16 bytes"  )

◆ MOS_STATIC_ASSERT() [5/5]

MOS_STATIC_ASSERT ( sizeof(idtr_t) = =2+sizeof(void *),
"idtr32_t is not 6 bytes"  )

◆ x86_init_percpu_gdt()

void x86_init_percpu_gdt ( void )

Definition at line 59 of file descriptors.c.

Referenced by platform_ap_entry(), and platform_startup_early().

+ Here is the call graph for this function:

◆ x86_init_percpu_tss()

void x86_init_percpu_tss ( void )

Definition at line 86 of file descriptors.c.

Referenced by platform_ap_entry(), and platform_startup_early().

+ Here is the call graph for this function:

◆ x86_init_percpu_idt()

void x86_init_percpu_idt ( void )

Definition at line 36 of file idt.c.

Referenced by platform_ap_entry(), and platform_startup_early().

◆ x86_idt_init()

void x86_idt_init ( void )

Definition at line 41 of file idt.c.

Referenced by platform_startup_early().

◆ gdt_flush()

void gdt_flush ( gdt_ptr_t * gdt_ptr)
extern

Referenced by x86_init_percpu_gdt().

◆ tss_flush()

void tss_flush ( u32 tss_selector)
extern

Referenced by x86_init_percpu_tss().

◆ gdt_flush_only()

void gdt_flush_only ( gdt_ptr_t * gdt_ptr)
extern