XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions
x86_64_gdt.h File Reference
#include <stdint.h>
Include dependency graph for x86_64_gdt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _gdt
 
struct  _gdtr
 

Macros

#define GDT_ENTRY_NULL   0
 
#define GDT_ENTRY_KERNEL_CODE   1
 
#define GDT_ENTRY_KERNEL_DATA   2
 
#define GDT_ENTRY_USER_CODE32   3
 
#define GDT_ENTRY_USER_DATA   4
 
#define GDT_ENTRY_USER_CODE   5
 
#define GDT_ENTRY_KERNEL_CODE32   6
 
#define GDT_ENTRY_TSS   7
 
#define GDT_ENTRY_MAX   9
 
#define SEGVAL(gdtent, rpl)    ((gdtent << 3) | rpl)
 
#define SEGVAL_LDT(ldtent, rpl)    ((ldtent << 3) | 0x4 | rpl)
 
#define GDT_FLAG_GRAN   0x8
 
#define GDT_FLAG_32BT   0x4
 
#define GDT_FLAG_64BT   0x2
 
#define GDT_ACCESS_PRESENT   0x80
 
#define GDT_ACCESS_PRIVL(x)   (x << 5)
 
#define GDT_ACCESS_TYPE   0x10
 
#define GDT_ACCESS_EX   0x8
 
#define GDT_ACCESS_DC   0x4
 
#define GDT_ACCESS_RW   0x2
 
#define GDT_ACCESS_AC   0x1
 

Typedefs

typedef struct _gdt gdt_entry
 
typedef struct _gdtpgdt_entry
 
typedef struct _gdtr gdtr
 
typedef struct _gdtrpgdtr
 

Enumerations

enum  sregs {
  SREG_CS , SREG_DS , SREG_ES , SREG_FS ,
  SREG_GS , SREG_SS
}
 

Functions

void x86_64_hal_init_gdt ()
 Initialize the Global Descriptor Table.
 
void x86_64_hal_init_gdt_ap ()
 
void set_gdt_entry (gdt_entry &entry, size_t base, size_t limit, uint8_t access, uint8_t flags)
 

Macro Definition Documentation

◆ GDT_ACCESS_AC

#define GDT_ACCESS_AC   0x1

◆ GDT_ACCESS_DC

#define GDT_ACCESS_DC   0x4

◆ GDT_ACCESS_EX

#define GDT_ACCESS_EX   0x8

◆ GDT_ACCESS_PRESENT

#define GDT_ACCESS_PRESENT   0x80

◆ GDT_ACCESS_PRIVL

#define GDT_ACCESS_PRIVL (   x)    (x << 5)

◆ GDT_ACCESS_RW

#define GDT_ACCESS_RW   0x2

◆ GDT_ACCESS_TYPE

#define GDT_ACCESS_TYPE   0x10

◆ GDT_ENTRY_KERNEL_CODE

#define GDT_ENTRY_KERNEL_CODE   1

◆ GDT_ENTRY_KERNEL_CODE32

#define GDT_ENTRY_KERNEL_CODE32   6

◆ GDT_ENTRY_KERNEL_DATA

#define GDT_ENTRY_KERNEL_DATA   2

◆ GDT_ENTRY_MAX

#define GDT_ENTRY_MAX   9

◆ GDT_ENTRY_NULL

#define GDT_ENTRY_NULL   0

BSD 2-Clause License

Copyright (c) 2022-2023, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ GDT_ENTRY_TSS

#define GDT_ENTRY_TSS   7

◆ GDT_ENTRY_USER_CODE

#define GDT_ENTRY_USER_CODE   5

◆ GDT_ENTRY_USER_CODE32

#define GDT_ENTRY_USER_CODE32   3

◆ GDT_ENTRY_USER_DATA

#define GDT_ENTRY_USER_DATA   4

◆ GDT_FLAG_32BT

#define GDT_FLAG_32BT   0x4

◆ GDT_FLAG_64BT

#define GDT_FLAG_64BT   0x2

◆ GDT_FLAG_GRAN

#define GDT_FLAG_GRAN   0x8

◆ SEGVAL

#define SEGVAL (   gdtent,
  rpl 
)     ((gdtent << 3) | rpl)

◆ SEGVAL_LDT

#define SEGVAL_LDT (   ldtent,
  rpl 
)     ((ldtent << 3) | 0x4 | rpl)

Typedef Documentation

◆ gdt_entry

typedef struct _gdt gdt_entry

◆ gdtr

typedef struct _gdtr gdtr

◆ pgdt_entry

typedef struct _gdt * pgdt_entry

◆ pgdtr

typedef struct _gdtr * pgdtr

Enumeration Type Documentation

◆ sregs

enum sregs
Enumerator
SREG_CS 
SREG_DS 
SREG_ES 
SREG_FS 
SREG_GS 
SREG_SS 

Function Documentation

◆ set_gdt_entry()

void set_gdt_entry ( gdt_entry entry,
size_t  base,
size_t  limit,
uint8_t  access,
uint8_t  flags 
)
extern

==========================================================================================

G L O B A L D E S C R I P T O R T A B L E

◆ x86_64_hal_init_gdt()

void x86_64_hal_init_gdt ( )

Initialize the Global Descriptor Table.

◆ x86_64_hal_init_gdt_ap()

void x86_64_hal_init_gdt_ap ( )
extern