#include <kernel/kernel_map.h>
Go to the source code of this file.
Data Structures | |||||||||
struct | gdt_entry | ||||||||
GDT structure. More... | |||||||||
struct | gdt_register | ||||||||
The GDT register format. More... | |||||||||
Defines | |||||||||
#define | GDT_DIM 8192 | ||||||||
Number of entries in the GDT (Global Descriptor Table). | |||||||||
#define | GDT_ENTRY_DIM sizeof(gdt_entry_t) | ||||||||
GDT entry dimension in bytes. | |||||||||
#define | PRESENT 0x80 | ||||||||
The segment is present. | |||||||||
#define | CODE 0x18 | ||||||||
A code segment type. | |||||||||
#define | DATA 0x10 | ||||||||
A data segment type. | |||||||||
#define | EXP_DOWN 0x04 | ||||||||
The segment grows downward. | |||||||||
#define | CONFORMING 0x04 | ||||||||
A conforming code segment. | |||||||||
#define | READABLE 0x02 | ||||||||
A readable segment. | |||||||||
#define | WRITEABLE 0x02 | ||||||||
A writeable segment. | |||||||||
#define | CODE_SEG (CODE | PRESENT | READABLE) | ||||||||
A standard code segment. | |||||||||
#define | DATA_SEG (DATA | PRESENT | WRITEABLE) | ||||||||
A standard data segment. | |||||||||
#define | STACK_SEG DATA_SEG | ||||||||
A standard stack segment. | |||||||||
#define | TSS_SEG (PRESENT | 0x09) | ||||||||
A standard TSS segment. | |||||||||
#define | REAL_SEG (CODE | PRESENT | READABLE) | ||||||||
A real-mode area segment. | |||||||||
#define | INT_GATE (PRESENT | 0x0E) | ||||||||
32-bit Interrupt Gate. | |||||||||
#define | TASK_GATE (PRESENT | 0x05) | ||||||||
Task Gate. | |||||||||
#define | TRAP_GATE (PRESENT | 0x0F) | ||||||||
32-bit Trap Gate. | |||||||||
#define | DPL_0 0x00 | ||||||||
Descriptor Privilege Level 0 (maximum privilege). | |||||||||
#define | DPL_1 0x20 | ||||||||
Descriptor Privilege Level 1. | |||||||||
#define | DPL_2 0x40 | ||||||||
Descriptor Privilege Level 2. | |||||||||
#define | DPL_3 0x60 | ||||||||
Descriptor Privilege Level 3 (minimum privilege). | |||||||||
#define | BUSY_FLAG 0x02 | ||||||||
The busy bit of the TSS descriptor (to avoid recursive tasks). | |||||||||
#define | ATTR_32BIT 0x40 | ||||||||
Default size of the istructions (for a code segment) or the stack alignment (for a stack segment). | |||||||||
#define | ATTR_GRANUL 0x80 | ||||||||
The granularity of the segment size (limit field):
| |||||||||
#define | KERNEL_DATA 0x08 | ||||||||
This is the data selector for the kernel. REMEBER!!! It is defined also into irq.S! | |||||||||
#define | KERNEL_STACK 0x08 | ||||||||
This is the stack selector for the kernel. | |||||||||
#define | KERNEL_CODE 0x10 | ||||||||
This is the code selector for the kernel. | |||||||||
#define | USER_DATA 0x18 | ||||||||
This is the selector for the user data segment. | |||||||||
#define | USER_STACK 0x18 | ||||||||
This is the selector for the user stack segment. | |||||||||
#define | USER_CODE 0x20 | ||||||||
This is the selector for the user code segment. | |||||||||
#define | SEGMENT(linear) ( (word)(((dword)(linear) & 0xFFFF0000) >> 4) ) | ||||||||
(real-mode) Extract the segment part of a linear address. | |||||||||
#define | OFFSET(linear) ( (word)((dword)(linear) & 0xFFFF) ) | ||||||||
(real-mode) Extract the offset part of a linear address. | |||||||||
#define | LINEAR(seg, off) ( (dword)(((word)(seg) << 4) + (word)(off)) ) | ||||||||
(real-mode) Make a linear address from a segment:offset address. | |||||||||
#define | MK_FP(seg, off) ((FARPTR) (((uint32_t) (seg) << 16) | (uint16_t) (off))) | ||||||||
(i386) Make a far pointer from seg segment and off offset.
| |||||||||
#define | FP_SEG(fp) (((FARPTR) fp) >> 16) | ||||||||
(i386) Get the segment from the far pointer fp . | |||||||||
#define | FP_OFF(fp) (((FARPTR) fp) & 0xffff) | ||||||||
(i386) Get the offset from the far pointer fp . | |||||||||
#define | FP_TO_LINEAR(seg, off) ((void*) ((((uint16_t) (seg)) << 4) + ((uint16_t) (off)))) | ||||||||
Translate a real-mode segment:offset address to the linear address. This macro is equivalent to LINEAR(seg, off) macro. | |||||||||
Typedefs | |||||||||
typedef uint32_t | FARPTR | ||||||||
(i386) far pointer. | |||||||||
typedef uint32_t | far | ||||||||
(i386) far pointer. | |||||||||
typedef gdt_entry | gdt_entry_t | ||||||||
GDT structure. | |||||||||
typedef gdt_register | gdt_reg | ||||||||
The GDT register format. | |||||||||
Functions | |||||||||
__inline__ void | memsetb (void *dest_ptr, int val, dword count) | ||||||||
Sets count bytes to val .
| |||||||||
__inline__ void | memsetw (void *dest_ptr, word val, dword count) | ||||||||
Sets count words to val .
| |||||||||
__inline__ void | memsetl (void *dest_ptr, dword val, dword count) | ||||||||
Sets count double words to val .
| |||||||||
__inline__ void * | memset (void *s, unsigned long c, size_t count) | ||||||||
Optimized version of memset.
| |||||||||
__inline__ void | memcpyb (void *dest_ptr, const void *org_ptr, dword count) | ||||||||
Copy count bytes from org_ptr to dest_ptr .
| |||||||||
__inline__ void | memcpyw (void *dest_ptr, const void *org_ptr, dword count) | ||||||||
Copy count words from org_ptr to dest_ptr .
| |||||||||
__inline__ void | memcpyl (void *dest_ptr, const void *org_ptr, dword count) | ||||||||
Copy count double words from org_ptr to dest_ptr .
| |||||||||
__inline__ void * | memcpy (void *to, const void *from, size_t n) | ||||||||
Optimized version of memcpy.
| |||||||||
__inline__ int | memcmp (const void *s1, const void *s2, size_t n) | ||||||||
Compares the first n bytes of memory areas s1 and s2 . It returns an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2 .
| |||||||||
__inline__ void * | memchr (const void *cs, int c, size_t count) | ||||||||
Find a byte into a memory area.
| |||||||||
__inline__ void | k_update_segment_regs () | ||||||||
Update segment registers with kernel selectors. | |||||||||
word | setup_GDT_entry (word limit, dword base, byte attribs0_7, byte attribs8_15) | ||||||||
Initialize a GDT entry.
| |||||||||
void | remove_GDT_entry (word sel) | ||||||||
Remove a GDT entry.
| |||||||||
void | install_GDT () | ||||||||
Initialize the Global Descriptor Table with the default selectors and update the segment registers. |
Definition in file mem.h.