Import basic part of XTDK
ci/woodpecker/push/build Pipeline was successful
Details
ci/woodpecker/push/build Pipeline was successful
Details
This commit is contained in:
parent
f01fe7ed92
commit
3da8106c02
|
@ -0,0 +1,81 @@
|
||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: sdk/xtdk/xtdefs.h
|
||||||
|
* DESCRIPTION: XT definitions for basic types
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTDK_XTBASE_H
|
||||||
|
#define __XTDK_XTBASE_H
|
||||||
|
|
||||||
|
|
||||||
|
/* Routines and arguments modifiers */
|
||||||
|
#define IN
|
||||||
|
#define OUT
|
||||||
|
#define XTAPI __stdcall
|
||||||
|
#define XTCDECL __cdecl
|
||||||
|
#define XTFASTCALL __fastcall
|
||||||
|
#define XTINLINE __inline
|
||||||
|
|
||||||
|
/* Variable modifiers */
|
||||||
|
#define CONST const
|
||||||
|
#define EXTERN extern
|
||||||
|
#define STRUCT struct
|
||||||
|
#define STATIC static
|
||||||
|
#define VOLATILE volatile
|
||||||
|
|
||||||
|
/* NULL values */
|
||||||
|
#define NULL ((PVOID) 0)
|
||||||
|
#define NULL64 ((VOID * PVOID) 0)
|
||||||
|
|
||||||
|
/* Preprocessor macro for defining a structure alignment */
|
||||||
|
#define ALIGN(x) __declspec(align(x))
|
||||||
|
|
||||||
|
/* Macro for calculating size of an array */
|
||||||
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*x))
|
||||||
|
|
||||||
|
/* Macro for accessing the base address of a structure from a structure member */
|
||||||
|
#define CONTAIN_RECORD(Address, Type, Field) ((Type *)(((ULONG_PTR)Address) - (ULONG_PTR)(&(((Type *)0)->Field))))
|
||||||
|
|
||||||
|
/* Macro for calculating byte offset of a field in the structure */
|
||||||
|
#define FIELD_OFFSET(Structure, Field) ((LONG)(LONG_PTR)&(((Structure *)0)->Field))
|
||||||
|
|
||||||
|
/* Macro for calculating size of a field in the structure */
|
||||||
|
#define FIELD_SIZE(Structure, Field) (sizeof(((Structure *)0)->Field))
|
||||||
|
|
||||||
|
/* Macro that yields field type in the structure */
|
||||||
|
#define FIELD_TYPE(Structure, Field) (((Structure*)0)->Field)
|
||||||
|
|
||||||
|
/* Macro for rounding down */
|
||||||
|
#define ROUND_DOWN(X, Alignment) ((X) & ~((Alignment) - 1l))
|
||||||
|
|
||||||
|
/* Macro for rounding up */
|
||||||
|
#define ROUND_UP(X, Alignment) ROUND_DOWN((X) + (Alignment - 1), Alignment)
|
||||||
|
|
||||||
|
/* Variadic ABI functions */
|
||||||
|
typedef __builtin_va_list VA_LIST;
|
||||||
|
#define VA_ARG(Marker, Type) ((sizeof (Type) < sizeof(UINT_PTR)) ? \
|
||||||
|
(Type)(__builtin_va_arg(Marker, UINT_PTR)) : \
|
||||||
|
(Type)(__builtin_va_arg(Marker, Type)))
|
||||||
|
#define VA_COPY(Dest, Start) __builtin_va_copy(Dest, Start)
|
||||||
|
#define VA_START(Marker, Parameter) __builtin_va_start(Marker, Parameter)
|
||||||
|
#define VA_END(Marker) __builtin_va_end(Marker)
|
||||||
|
|
||||||
|
/* Data conversion macros */
|
||||||
|
#define HandleToLong(Var) ((LONG)(LONG_PTR)Var)
|
||||||
|
#define HandleToUlong(Var) ((ULONG)(ULONG_PTR)Var)
|
||||||
|
#define IntToPtr(Var) ((PVOID)(INT_PTR)Var)
|
||||||
|
#define LongToHandle(Var) ((HANDLE)(LONG_PTR)Var)
|
||||||
|
#define LongToPtr(Var) ((PVOID)(LONG_PTR)Var)
|
||||||
|
#define PtrToInt(Var) ((INT)(INT_PTR)Var)
|
||||||
|
#define PtrToLong(Var) ((LONG)(LONG_PTR)Var)
|
||||||
|
#define PtrToShort(Var) ((SHORT)(LONG_PTR)Var)
|
||||||
|
#define PtrToUint(Var) ((UINT)(UINT_PTR)Var)
|
||||||
|
#define PtrToUlong(Var) ((ULONG)(ULONG_PTR)Var)
|
||||||
|
#define PtrToUshort(Var) ((USHORT)(ULONG_PTR)Var)
|
||||||
|
#define UintToPtr(Var) ((PVOID)(UINT_PTR)Var)
|
||||||
|
#define UlongToHandle(Var) ((HANDLE)(ULONG_PTR)Var)
|
||||||
|
#define UlongToPtr(Var) ((PVOID)(ULONG_PTR)Var)
|
||||||
|
|
||||||
|
#endif /* __XTDK_XTBASE_H */
|
|
@ -0,0 +1,12 @@
|
||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: sdk/xtdk/xtkmapi.h
|
||||||
|
* DESCRIPTION: Top level header for the kernel-mode XT API
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Base XT headers */
|
||||||
|
#include "xttarget.h"
|
||||||
|
#include "xttypes.h"
|
||||||
|
#include "xtdefs.h"
|
|
@ -0,0 +1,33 @@
|
||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: sdk/xtdk/xttarget.h
|
||||||
|
* DESCRIPTION: XT target architecture specific definitions
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTDK_XTTARGET_H
|
||||||
|
#define __XTDK_XTTARGET_H
|
||||||
|
|
||||||
|
|
||||||
|
/* Preprocessor macros for including arch-specific headers */
|
||||||
|
#define _ARCH_STRINGIZE(x) _INCL_STRINGIZE(x)
|
||||||
|
#define _INCL_STRINGIZE(x) #x
|
||||||
|
#define ARCH_HEADER(header) _ARCH_STRINGIZE(_ARCH/header)
|
||||||
|
|
||||||
|
/* Architecture specific definitions */
|
||||||
|
#if defined(__i386__) || defined(__i686__)
|
||||||
|
#define _ARCH i686
|
||||||
|
#define _ARCH_I686 1
|
||||||
|
#define _XT32 1
|
||||||
|
#define EFI_ERROR_MASK 0x80000000
|
||||||
|
#elif defined(__amd64__) || defined(__x86_64__)
|
||||||
|
#define _ARCH amd64
|
||||||
|
#define _ARCH_AMD64 1
|
||||||
|
#define _XT64 1
|
||||||
|
#define EFI_ERROR_MASK 0x8000000000000000
|
||||||
|
#else
|
||||||
|
#error Unknown architecture
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __XTDK_XTTARGET_H */
|
|
@ -0,0 +1,282 @@
|
||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: sdk/xtdk/xttypes.h
|
||||||
|
* DESCRIPTION: Definitions of basic data types defined by XT
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTDK_XTTYPES_H
|
||||||
|
#define __XTDK_XTTYPES_H
|
||||||
|
|
||||||
|
#include "xttarget.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Standard C types */
|
||||||
|
typedef unsigned char BYTE, *PBYTE, *LPBYTE;
|
||||||
|
typedef char CHAR, *PCHAR, *LPCHAR;
|
||||||
|
typedef double DOUBLE, *PDOUBLE, *LPDOUBLE;
|
||||||
|
typedef unsigned long DWORD, *PDWORD, *LPDWORD;
|
||||||
|
typedef float FLOAT, *PFLOAT, *LPFLOAT;
|
||||||
|
typedef int INT, *PINT, *LPINT;
|
||||||
|
typedef long LONG, *PLONG, *LPLONG;
|
||||||
|
typedef signed char SCHAR, *PSCHAR;
|
||||||
|
typedef signed long SLONG, *PSLONG;
|
||||||
|
typedef short SHORT, *PSHORT, *LPSHORT;
|
||||||
|
typedef unsigned char UCHAR, *PUCHAR;
|
||||||
|
typedef unsigned int UINT, *PUINT;
|
||||||
|
typedef unsigned long ULONG, *PULONG, LPULONG;
|
||||||
|
typedef unsigned short USHORT, *PUSHORT;
|
||||||
|
typedef unsigned short WORD, *PWORD, *LPWORD;
|
||||||
|
typedef void VOID, *PVOID, *LPVOID;
|
||||||
|
|
||||||
|
/* Constant C types */
|
||||||
|
typedef const BYTE CBYTE, *PCBYTE, *LPCBYTE;
|
||||||
|
typedef const CHAR CCHAR, *PCCHAR, *LPCCHAR;
|
||||||
|
typedef const DOUBLE CDOUBLE, *PCDOUBLE, *LPCDOUBLE;
|
||||||
|
typedef const DWORD CDWORD, *PCDWORD, *LPCDWORD;
|
||||||
|
typedef const FLOAT CFLOAT, *PCFLOAT, *LPCFLOAT;
|
||||||
|
typedef const INT CINT, *PCINT, *LPCINT;
|
||||||
|
typedef const LONG CLONG, *PCLONG, *LPCLONG;
|
||||||
|
typedef const SCHAR CSCHAR, *PCSCHAR, *LPCSCHAR;
|
||||||
|
typedef const SHORT CSHORT, *PCSHORT, *LPCSHORT;
|
||||||
|
typedef const UCHAR CUCHAR, *PCUCHAR, *LPCUCHAR;
|
||||||
|
typedef const UINT CUINT, *PCUINT, *LPCUINT;
|
||||||
|
typedef const ULONG CULONG, *PCULONG, *LPCULONG;
|
||||||
|
typedef const USHORT CUSHORT, *PCUSHORT, *LPCUSHORT;
|
||||||
|
typedef const VOID CVOID, *PCVOID, *LPCVOID;
|
||||||
|
typedef const WORD CWORD, *PCWORD, *LPCWORD;
|
||||||
|
|
||||||
|
/* Integer types */
|
||||||
|
typedef signed char INT8, *PINT8;
|
||||||
|
typedef unsigned char UINT8, *PUINT8;
|
||||||
|
typedef signed short INT16, *PINT16;
|
||||||
|
typedef unsigned short UINT16, *PUINT16;
|
||||||
|
typedef signed int INT32, *PINT32;
|
||||||
|
typedef unsigned int UINT32, *PUINT32;
|
||||||
|
typedef signed long long INT64, *PINT64;
|
||||||
|
typedef unsigned long long UINT64, *PUINT64;
|
||||||
|
|
||||||
|
/* 64-bit types */
|
||||||
|
typedef long long LONG64, *PLONG64;
|
||||||
|
typedef long long LONGLONG, *PLONGLONG;
|
||||||
|
typedef unsigned long long ULONGLONG, *PULONGLONG;
|
||||||
|
|
||||||
|
/* Signed 32-bit wide types */
|
||||||
|
typedef signed int LONG32, *PLONG32;
|
||||||
|
|
||||||
|
/* Unsigned 32-bit wide types */
|
||||||
|
typedef unsigned int DWORD32, *PDWORD32;
|
||||||
|
typedef unsigned int ULONG32, *PULONG32;
|
||||||
|
|
||||||
|
/* Unsigned 64-bit wide types */
|
||||||
|
typedef unsigned long long DWORD64, *PDWORD64;
|
||||||
|
typedef unsigned long long ULONG64, *PULONG64;
|
||||||
|
|
||||||
|
/* Pointer size guaranteed types */
|
||||||
|
#if defined(_XT64)
|
||||||
|
typedef long long INT_PTR, *PINT_PTR;
|
||||||
|
typedef unsigned long long UINT_PTR, *PUINT_PTR;
|
||||||
|
typedef long long LONG_PTR, *PLONG_PTR;
|
||||||
|
typedef unsigned long long ULONG_PTR, *PULONG_PTR;
|
||||||
|
typedef unsigned long long POINTER_64_INT;
|
||||||
|
#else
|
||||||
|
typedef int INT_PTR, *PINT_PTR;
|
||||||
|
typedef unsigned int UINT_PTR, *PUINT_PTR;
|
||||||
|
typedef long LONG_PTR, *PLONG_PTR;
|
||||||
|
typedef unsigned long ULONG_PTR, *PULONG_PTR;
|
||||||
|
typedef unsigned long POINTER_64_INT;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Flag (bitfield) types */
|
||||||
|
typedef BYTE FCHAR;
|
||||||
|
typedef DWORD FLONG;
|
||||||
|
typedef WORD FSHORT;
|
||||||
|
|
||||||
|
/* SIZE_T types */
|
||||||
|
typedef ULONG_PTR SIZE_T, *PSIZE_T;
|
||||||
|
typedef LONG_PTR SSIZE_T, *PSSIZE_T;
|
||||||
|
|
||||||
|
/* Pointer to PVOID */
|
||||||
|
typedef PVOID *PPVOID;
|
||||||
|
|
||||||
|
/* Polymorphic values types */
|
||||||
|
typedef SLONG HPARAM, HRESULT;
|
||||||
|
typedef LONG_PTR LPARAM, LRESULT;
|
||||||
|
typedef UINT_PTR WPARAM, WRESULT;
|
||||||
|
|
||||||
|
/* Handle types */
|
||||||
|
typedef VOID *HANDLE, **PHANDLE;
|
||||||
|
typedef HANDLE *SPHANDLE, *LPHANDLE;
|
||||||
|
|
||||||
|
/* XT status types */
|
||||||
|
typedef LONG XTSTATUS, *PXTSTATUS;
|
||||||
|
|
||||||
|
/* ANSI character types */
|
||||||
|
typedef CHAR *PCH, *LPCH;
|
||||||
|
typedef CHAR *PCCH, *LPCCH;
|
||||||
|
typedef CHAR *PSTR, *LPSTR, *NPSTR;
|
||||||
|
typedef PSTR *PZPSTR;
|
||||||
|
typedef const PSTR *PCZPSTR;
|
||||||
|
typedef const CHAR *PCSTR, *LPCSTR;
|
||||||
|
typedef PCSTR *PZPCSTR;
|
||||||
|
|
||||||
|
/* ASCIIZ character types */
|
||||||
|
typedef CHAR SZ, *PSZ;
|
||||||
|
typedef const CHAR CSZ, *PCSZ;
|
||||||
|
|
||||||
|
/* UNICODE character types */
|
||||||
|
typedef USHORT WCHAR, *PWCHAR;
|
||||||
|
typedef WCHAR *PWCH, *LPWCH;
|
||||||
|
typedef const WCHAR *PCWCH, *LPCWCH;
|
||||||
|
typedef WCHAR *PWSTR, *LPWSTR, *NWPSTR;
|
||||||
|
typedef PWSTR *PZPWSTR;
|
||||||
|
typedef const PWSTR *PCZPWSTR;
|
||||||
|
typedef WCHAR *PUWSTR, *LPUWSTR;
|
||||||
|
typedef const WCHAR *PCWSTR, *LPCWSTR;
|
||||||
|
typedef PCWSTR *PZPCWSTR;
|
||||||
|
typedef const WCHAR *PCUWSTR, *LPCUWSTR;
|
||||||
|
|
||||||
|
/* Neutral character types */
|
||||||
|
typedef WCHAR TBYTE, *PTBYTE;
|
||||||
|
typedef WCHAR TCHAR, *PTCHAR;
|
||||||
|
typedef LPWSTR LP;
|
||||||
|
typedef LPWSTR PTCH, LPTCH;
|
||||||
|
typedef LPWSTR PTSTR, LPTSTR;
|
||||||
|
typedef LPCWSTR PCTSTR, LPCTSTR;
|
||||||
|
typedef LPUWSTR PUTSTR, LPUTSTR;
|
||||||
|
typedef LPCUWSTR PCUTSTR, LPCUTSTR;
|
||||||
|
|
||||||
|
/* Boolean type */
|
||||||
|
typedef enum _BOOLEAN
|
||||||
|
{
|
||||||
|
FALSE = 0,
|
||||||
|
TRUE = 1
|
||||||
|
} BOOLEAN, *PBOOLEAN;
|
||||||
|
|
||||||
|
/* 128-bit floats structure */
|
||||||
|
typedef struct _FLOAT128
|
||||||
|
{
|
||||||
|
LONGLONG LowPart;
|
||||||
|
LONGLONG HighPart;
|
||||||
|
} FLOAT128, *PFLOAT128;
|
||||||
|
|
||||||
|
/* 64-bit signed integer union */
|
||||||
|
typedef union _LARGE_INTEGER
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
DWORD LowPart;
|
||||||
|
LONG HighPart;
|
||||||
|
};
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
DWORD LowPart;
|
||||||
|
LONG HighPart;
|
||||||
|
} u;
|
||||||
|
LONGLONG QuadPart;
|
||||||
|
} LARGE_INTEGER, *PLARGE_INTEGER;
|
||||||
|
|
||||||
|
/* 64-bit unsigned integer union */
|
||||||
|
typedef union _ULARGE_INTEGER
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
DWORD LowPart;
|
||||||
|
DWORD HighPart;
|
||||||
|
};
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
DWORD LowPart;
|
||||||
|
DWORD HighPart;
|
||||||
|
} u;
|
||||||
|
ULONGLONG QuadPart;
|
||||||
|
} ULARGE_INTEGER, *PULARGE_INTEGER;
|
||||||
|
|
||||||
|
/* Counted string structure */
|
||||||
|
typedef struct _STRING
|
||||||
|
{
|
||||||
|
USHORT Length;
|
||||||
|
USHORT MaximumLength;
|
||||||
|
PCHAR Buffer;
|
||||||
|
} STRING, *PSTRING;
|
||||||
|
|
||||||
|
/* 32-bit counted string structure */
|
||||||
|
typedef struct _STRING32
|
||||||
|
{
|
||||||
|
USHORT Length;
|
||||||
|
USHORT MaximumLength;
|
||||||
|
ULONG Buffer;
|
||||||
|
} STRING32, *PSTRING32;
|
||||||
|
|
||||||
|
/* 64-bit counted string structure */
|
||||||
|
typedef struct _STRING64
|
||||||
|
{
|
||||||
|
USHORT Length;
|
||||||
|
USHORT MaximumLength;
|
||||||
|
ULONGLONG Buffer;
|
||||||
|
} STRING64, *PSTRING64;
|
||||||
|
|
||||||
|
/* Constant counted string structure */
|
||||||
|
typedef struct _CSTRING
|
||||||
|
{
|
||||||
|
USHORT Length;
|
||||||
|
USHORT MaximumLength;
|
||||||
|
PCCHAR Buffer;
|
||||||
|
} CSTRING, *PCSTRING;
|
||||||
|
|
||||||
|
/* ANSI string structure */
|
||||||
|
typedef struct _ANSI_STRING
|
||||||
|
{
|
||||||
|
USHORT Length;
|
||||||
|
USHORT MaximumLength;
|
||||||
|
PSTR Buffer;
|
||||||
|
} ANSI_STRING, *PANSI_STRING;
|
||||||
|
typedef const ANSI_STRING *PCANSI_STRING;
|
||||||
|
|
||||||
|
/* 32-bit ANSI string structure */
|
||||||
|
typedef struct _ANSI_STRING32
|
||||||
|
{
|
||||||
|
USHORT Length;
|
||||||
|
USHORT MaximumLength;
|
||||||
|
ULONG Buffer;
|
||||||
|
} ANSI_STRING32, *PANSI_STRING32;
|
||||||
|
typedef const ANSI_STRING32 *PCANSI_STRING32;
|
||||||
|
|
||||||
|
/* 64-bit ANSI string structure */
|
||||||
|
typedef struct _ANSI_STRING64
|
||||||
|
{
|
||||||
|
USHORT Length;
|
||||||
|
USHORT MaximumLength;
|
||||||
|
ULONGLONG Buffer;
|
||||||
|
} ANSI_STRING64, *PANSI_STRING64;
|
||||||
|
typedef const ANSI_STRING64 *PCANSI_STRING64;
|
||||||
|
|
||||||
|
/* UNICODE string structure */
|
||||||
|
typedef struct _UNICODE_STRING
|
||||||
|
{
|
||||||
|
USHORT Length;
|
||||||
|
USHORT MaximumLength;
|
||||||
|
PWSTR Buffer;
|
||||||
|
} UNICODE_STRING, *PUNICODE_STRING;
|
||||||
|
typedef const UNICODE_STRING *PCUNICODE_STRING;
|
||||||
|
|
||||||
|
/* 32-bit UNICODE string structure */
|
||||||
|
typedef struct _UNICODE_STRING32
|
||||||
|
{
|
||||||
|
USHORT Length;
|
||||||
|
USHORT MaximumLength;
|
||||||
|
ULONG Buffer;
|
||||||
|
} UNICODE_STRING32, *PUNICODE_STRING32;
|
||||||
|
typedef const UNICODE_STRING32 *PCUNICODE_STRING32;
|
||||||
|
|
||||||
|
/* 64-bit UNICODE string structure */
|
||||||
|
typedef struct _UNICODE_STRING64
|
||||||
|
{
|
||||||
|
USHORT Length;
|
||||||
|
USHORT MaximumLength;
|
||||||
|
ULONGLONG Buffer;
|
||||||
|
} UNICODE_STRING64, *PUNICODE_STRING64;
|
||||||
|
typedef const UNICODE_STRING64 *PCUNICODE_STRING64;
|
||||||
|
|
||||||
|
#endif /* __XTDK_XTTYPES_H */
|
Loading…
Reference in New Issue