Add GDT, IDT and TSS related structures
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
parent
cdef64d1e6
commit
f74ba62f24
@ -9,6 +9,11 @@
|
||||
#ifndef __XTDK_AMD64_KETYPES_H
|
||||
#define __XTDK_AMD64_KETYPES_H
|
||||
|
||||
#include <xttypes.h>
|
||||
|
||||
|
||||
/* IOPM Definitions */
|
||||
#define IO_ACCESS_MAP_NONE 0
|
||||
|
||||
/* Static Kernel-Mode address start */
|
||||
#define KSEG0_BASE 0xFFFFF80000000000
|
||||
@ -19,4 +24,71 @@
|
||||
/* XTOS Kernel stack size */
|
||||
#define KERNEL_STACK_SIZE 0x8000
|
||||
|
||||
/* Global Descriptor Table (GDT) entry union definition */
|
||||
typedef union _KGDTENTRY
|
||||
{
|
||||
struct
|
||||
{
|
||||
USHORT LimitLow;
|
||||
USHORT BaseLow;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR BaseMiddle;
|
||||
UCHAR Flags1;
|
||||
UCHAR Flags2;
|
||||
UCHAR BaseHigh;
|
||||
} Bytes;
|
||||
struct {
|
||||
ULONG BaseMiddle:8;
|
||||
ULONG Type:5;
|
||||
ULONG Dpl:2;
|
||||
ULONG Present:1;
|
||||
ULONG LimitHigh:4;
|
||||
ULONG System:1;
|
||||
ULONG LongMode:1;
|
||||
ULONG DefaultBig:1;
|
||||
ULONG Granularity:1;
|
||||
ULONG BaseHigh:8;
|
||||
} Bits;
|
||||
};
|
||||
ULONG BaseUpper;
|
||||
ULONG MustBeZero;
|
||||
};
|
||||
ULONG64 Alignment;
|
||||
} KGDTENTRY, *PKGDTENTRY;
|
||||
|
||||
/* Interrupt Descriptor Table (IDT) entry union definition */
|
||||
typedef union _KIDTENTRY
|
||||
{
|
||||
struct
|
||||
{
|
||||
USHORT OffsetLow;
|
||||
USHORT Selector;
|
||||
USHORT IstIndex:3;
|
||||
USHORT Reserved0:5;
|
||||
USHORT Type:5;
|
||||
USHORT Dpl:2;
|
||||
USHORT Present:1;
|
||||
USHORT OffsetMiddle;
|
||||
ULONG OffsetHigh;
|
||||
ULONG Reserved1;
|
||||
};
|
||||
ULONG64 Alignment;
|
||||
} KIDTENTRY, *PKIDTENTRY;
|
||||
|
||||
/* Task State Segment (TSS) structure definition */
|
||||
typedef struct _KTSS
|
||||
{
|
||||
ULONG Reserved0;
|
||||
ULONG64 Rsp0;
|
||||
ULONG64 Rsp1;
|
||||
ULONG64 Rsp2;
|
||||
ULONG64 Ist[8];
|
||||
ULONG64 Reserved1;
|
||||
USHORT Reserved2;
|
||||
USHORT IoMapBase;
|
||||
} KTSS, *PKTSS;
|
||||
|
||||
#endif /* __XTDK_AMD64_KETYPES_H */
|
||||
|
@ -13,5 +13,10 @@
|
||||
/* Architecture-related structures forward references */
|
||||
typedef struct _CPUID_REGISTERS CPUID_REGISTERS, *PCPUID_REGISTERS;
|
||||
typedef struct _HARDWARE_PTE HARDWARE_PTE, *PHARDWARE_PTE;
|
||||
typedef struct _KTSS KTSS, *PKTSS;
|
||||
|
||||
/* Architecture-related unions forward references */
|
||||
typedef union _KGDTENTRY KGDTENTRY, *PKGDTENTRY;
|
||||
typedef union _KIDTENTRY KIDTENTRY, *PKIDTENTRY;
|
||||
|
||||
#endif /* __XTDK_AMD64_XTSTRUCT_H */
|
||||
|
@ -9,6 +9,15 @@
|
||||
#ifndef __XTDK_I686_KETYPES_H
|
||||
#define __XTDK_I686_KETYPES_H
|
||||
|
||||
#include <xttypes.h>
|
||||
|
||||
|
||||
/* IOPM Definitions */
|
||||
#define IOPM_COUNT 1
|
||||
#define IOPM_SIZE 8192
|
||||
#define IOPM_FULL_SIZE 8196
|
||||
#define IOPM_ACCESS_MAP_NONE 0
|
||||
#define IOPM_DIRECTION_MAP_SIZE 32
|
||||
|
||||
/* Static Kernel-Mode address start */
|
||||
#define KSEG0_BASE 0x80000000
|
||||
@ -19,4 +28,87 @@
|
||||
/* XTOS Kernel stack size */
|
||||
#define KERNEL_STACK_SIZE 0x4000
|
||||
|
||||
/* Global Descriptor Table (GDT) entry structure definition */
|
||||
typedef struct _KGDTENTRY
|
||||
{
|
||||
USHORT LimitLow;
|
||||
USHORT BaseLow;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR BaseMiddle;
|
||||
UCHAR Flags1;
|
||||
UCHAR Flags2;
|
||||
UCHAR BaseHigh;
|
||||
} Bytes;
|
||||
struct
|
||||
{
|
||||
ULONG BaseMid:8;
|
||||
ULONG Type:5;
|
||||
ULONG Dpl:2;
|
||||
ULONG Present:1;
|
||||
ULONG LimitHigh:4;
|
||||
ULONG System:1;
|
||||
ULONG Reserved0:1;
|
||||
ULONG DefaultBig:1;
|
||||
ULONG Granularity:1;
|
||||
ULONG BaseHigh:8;
|
||||
} Bits;
|
||||
} HighWord;
|
||||
} KGDTENTRY, *PKGDTENTRY;
|
||||
|
||||
/* Interrupt Descriptor Table (IDT) entry structure definition */
|
||||
typedef struct _KIDTENTRY {
|
||||
USHORT Offset;
|
||||
USHORT Selector;
|
||||
USHORT Access;
|
||||
USHORT ExtendedOffset;
|
||||
} KIDTENTRY, *PKIDTENTRY;
|
||||
|
||||
/* Interrupt direction access map structure definition */
|
||||
typedef struct _KIIO_ACCESS_MAP {
|
||||
UCHAR DirectionMap[IOPM_DIRECTION_MAP_SIZE];
|
||||
UCHAR IoMap[IOPM_FULL_SIZE];
|
||||
} KIIO_ACCESS_MAP, *PKIIO_ACCESS_MAP;
|
||||
|
||||
/* Task State Segment (TSS) structure definition */
|
||||
typedef struct _KTSS {
|
||||
USHORT Backlink;
|
||||
USHORT Reserved0;
|
||||
ULONG Esp0;
|
||||
USHORT Ss0;
|
||||
USHORT Reserved1;
|
||||
ULONG NotUsed1[4];
|
||||
ULONG CR3;
|
||||
ULONG Eip;
|
||||
ULONG EFlags;
|
||||
ULONG Eax;
|
||||
ULONG Ecx;
|
||||
ULONG Edx;
|
||||
ULONG Ebx;
|
||||
ULONG Esp;
|
||||
ULONG Ebp;
|
||||
ULONG Esi;
|
||||
ULONG Edi;
|
||||
USHORT Es;
|
||||
USHORT Reserved2;
|
||||
USHORT Cs;
|
||||
USHORT Reserved3;
|
||||
USHORT Ss;
|
||||
USHORT Reserved4;
|
||||
USHORT Ds;
|
||||
USHORT Reserved5;
|
||||
USHORT Fs;
|
||||
USHORT Reserved6;
|
||||
USHORT Gs;
|
||||
USHORT Reserved7;
|
||||
USHORT LDT;
|
||||
USHORT Reserved8;
|
||||
USHORT Flags;
|
||||
USHORT IoMapBase;
|
||||
KIIO_ACCESS_MAP IoMaps[IOPM_COUNT];
|
||||
UCHAR IntDirectionMap[IOPM_DIRECTION_MAP_SIZE];
|
||||
} KTSS, *PKTSS;
|
||||
|
||||
#endif /* __XTDK_I686_KETYPES_H */
|
||||
|
@ -14,5 +14,9 @@
|
||||
typedef struct _CPUID_REGISTERS CPUID_REGISTERS, *PCPUID_REGISTERS;
|
||||
typedef struct _HARDWARE_PTE HARDWARE_PTE, *PHARDWARE_PTE;
|
||||
typedef struct _HARDWARE_PTE_PAE HARDWARE_PTE_PAE, *PHARDWARE_PTE_PAE;
|
||||
typedef struct _KGDTENTRY KGDTENTRY, *PKGDTENTRY;
|
||||
typedef struct _KIDTENTRY KIDTENTRY, *PKIDTENTRY;
|
||||
typedef struct _KIIO_ACCESS_MAP KIIO_ACCESS_MAP, *PKIIO_ACCESS_MAP;
|
||||
typedef struct _KTSS KTSS, *PKTSS;
|
||||
|
||||
#endif /* __XTDK_I686_XTSTRUCT_H */
|
||||
|
@ -14,6 +14,9 @@
|
||||
#include <xttypes.h>
|
||||
|
||||
|
||||
/* Interrupt Request Level (IRQL) */
|
||||
typedef UCHAR KIRQL, *PKIRQL;
|
||||
|
||||
/* 128-bit buffer containing a unique identifier value */
|
||||
typedef struct _GUID
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user