ReactOS 0.4.15-dev-7918-g2a2556c
intrin_i.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define Ke386GetGlobalDescriptorTable   __sgdt
 
#define Ke386SetGlobalDescriptorTable   __lgdt
 
#define Ke386GetLocalDescriptorTable   __sldt
 

Functions

FORCEINLINE PKGDTENTRY KiGetGdtEntry (_In_ PVOID pGdt, _In_ USHORT Selector)
 
FORCEINLINE VOID KiSetGdtDescriptorBase (_Inout_ PKGDTENTRY Entry, _In_ ULONG32 Base)
 
FORCEINLINE VOID KiSetGdtDescriptorLimit (_Inout_ PKGDTENTRY Entry, _In_ ULONG Limit)
 
FORCEINLINE VOID KiSetGdtEntryEx (_Inout_ PKGDTENTRY Entry, _In_ ULONG32 Base, _In_ ULONG Limit, _In_ UCHAR Type, _In_ UCHAR Dpl, _In_ BOOLEAN Granularity, _In_ UCHAR SegMode)
 
FORCEINLINE VOID KiSetGdtEntry (_Inout_ PKGDTENTRY Entry, _In_ ULONG32 Base, _In_ ULONG Limit, _In_ UCHAR Type, _In_ UCHAR Dpl, _In_ UCHAR SegMode)
 

Macro Definition Documentation

◆ Ke386GetGlobalDescriptorTable

#define Ke386GetGlobalDescriptorTable   __sgdt

Definition at line 452 of file intrin_i.h.

◆ Ke386GetLocalDescriptorTable

#define Ke386GetLocalDescriptorTable   __sldt

Definition at line 454 of file intrin_i.h.

◆ Ke386SetGlobalDescriptorTable

#define Ke386SetGlobalDescriptorTable   __lgdt

Definition at line 453 of file intrin_i.h.

Function Documentation

◆ KiGetGdtEntry()

FORCEINLINE PKGDTENTRY KiGetGdtEntry ( _In_ PVOID  pGdt,
_In_ USHORT  Selector 
)

Definition at line 10 of file intrin_i.h.

13{
14 return (PKGDTENTRY)((ULONG_PTR)pGdt + (Selector & ~RPL_MASK));
15}
#define ULONG_PTR
Definition: config.h:101
#define RPL_MASK
Definition: ketypes.h:130

◆ KiSetGdtDescriptorBase()

FORCEINLINE VOID KiSetGdtDescriptorBase ( _Inout_ PKGDTENTRY  Entry,
_In_ ULONG32  Base 
)

Definition at line 19 of file intrin_i.h.

22{
23 Entry->BaseLow = (USHORT)(Base & 0xffff);
24 Entry->HighWord.Bytes.BaseMid = (UCHAR)((Base >> 16) & 0xff);
25 Entry->HighWord.Bytes.BaseHi = (UCHAR)((Base >> 24) & 0xff);
26 // Entry->BaseUpper = (ULONG)(Base >> 32);
27}
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2439
unsigned short USHORT
Definition: pedump.c:61
base of all file and directory entries
Definition: entries.h:83
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ KiSetGdtDescriptorLimit()

FORCEINLINE VOID KiSetGdtDescriptorLimit ( _Inout_ PKGDTENTRY  Entry,
_In_ ULONG  Limit 
)

Definition at line 31 of file intrin_i.h.

34{
35 if (Limit < 0x100000)
36 {
37 Entry->HighWord.Bits.Granularity = 0;
38 }
39 else
40 {
41 Limit >>= 12;
42 Entry->HighWord.Bits.Granularity = 1;
43 }
44 Entry->LimitLow = (USHORT)(Limit & 0xffff);
45 Entry->HighWord.Bits.LimitHi = ((Limit >> 16) & 0x0f);
46}
_In_ LONG _In_ LONG Limit
Definition: kefuncs.h:304

◆ KiSetGdtEntry()

FORCEINLINE VOID KiSetGdtEntry ( _Inout_ PKGDTENTRY  Entry,
_In_ ULONG32  Base,
_In_ ULONG  Limit,
_In_ UCHAR  Type,
_In_ UCHAR  Dpl,
_In_ UCHAR  SegMode 
)

Definition at line 73 of file intrin_i.h.

80{
81 KiSetGdtEntryEx(Entry, Base, Limit, Type, Dpl, FALSE, SegMode);
82}
Type
Definition: Type.h:7
#define FALSE
Definition: types.h:117
FORCEINLINE VOID KiSetGdtEntryEx(_Inout_ PKGDTENTRY Entry, _In_ ULONG32 Base, _In_ ULONG Limit, _In_ UCHAR Type, _In_ UCHAR Dpl, _In_ BOOLEAN Granularity, _In_ UCHAR SegMode)
Definition: intrin_i.h:50

Referenced by WinLdrSetProcessorContext().

◆ KiSetGdtEntryEx()

FORCEINLINE VOID KiSetGdtEntryEx ( _Inout_ PKGDTENTRY  Entry,
_In_ ULONG32  Base,
_In_ ULONG  Limit,
_In_ UCHAR  Type,
_In_ UCHAR  Dpl,
_In_ BOOLEAN  Granularity,
_In_ UCHAR  SegMode 
)

Definition at line 50 of file intrin_i.h.

58{
61 Entry->HighWord.Bits.Type = (Type & 0x1f);
62 Entry->HighWord.Bits.Dpl = (Dpl & 0x3);
63 Entry->HighWord.Bits.Pres = (Type != 0); // Present, must be 1 when the GDT entry is valid.
64 Entry->HighWord.Bits.Sys = 0; // System
65 Entry->HighWord.Bits.Reserved_0 = 0; // LongMode = !!(SegMode & 1);
66 Entry->HighWord.Bits.Default_Big = !!(SegMode & 2);
67 Entry->HighWord.Bits.Granularity |= !!Granularity; // The flag may have been already set by KiSetGdtDescriptorLimit().
68 // Entry->MustBeZero = 0;
69}
FORCEINLINE VOID KiSetGdtDescriptorLimit(PKGDTENTRY Entry, ULONG Limit)
Definition: intrin_i.h:40
FORCEINLINE VOID KiSetGdtDescriptorBase(PKGDTENTRY Entry, ULONG64 Base)
Definition: intrin_i.h:30

Referenced by KiSetGdtEntry(), and WinLdrSetProcessorContext().