Migrate AR subsystem to C++
Some checks failed
Builds / ExectOS (amd64, debug) (push) Failing after 24s
Builds / ExectOS (amd64, release) (push) Failing after 27s
Builds / ExectOS (i686, debug) (push) Failing after 24s
Builds / ExectOS (i686, release) (push) Failing after 24s

This commit is contained in:
2025-09-08 15:29:13 +02:00
parent 27fec1bacb
commit c8dc2a1407
42 changed files with 2042 additions and 695 deletions

View File

@@ -20,8 +20,9 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 23)
set(CMAKE_CXX_STANDARD 23)
# Disable standard C libraries
# Disable standard C and C++ libraries
set(CMAKE_C_STANDARD_LIBRARIES "" CACHE INTERNAL "")
set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE INTERNAL "")
# Clean linker flags
set(CMAKE_STATIC_LINKER_FLAGS "")

View File

@@ -1,13 +0,0 @@
## XT Building Kit (XTBK)
The XTBK, or XT Building Kit is a kind of SDK (Software Development Kit) utilized internally by XTOS, the XT Operating
System. It is designed to provide a collection of public functions that are available within the operating system but
not necessarily exposed or accessible to software and driver developers.
Unlike XTDK, which focuses on providing headers for external developers to create kernel mode drivers and user mode
applications, XTBK serves as an extension to XTDK and aids in the code-sharing process between different XTOS
components. This enables the reuse of code across various components of the operating system, resulting in a more
efficient and streamlined development process.
By incorporating XTBK, XTOS can optimize code reuse, particularly in low-level kernel code that can be shared with other
components like the boot loader. This approach helps in reducing code duplication and improving overall code
maintainability. Additionally, it allows for consistent implementation of functionality across different parts of the OS.

View File

@@ -16,30 +16,37 @@
/* Routines used by XTLDR */
XTCLINK
XTCDECL
VOID
ArClearInterruptFlag(VOID);
XTCLINK
XTCDECL
BOOLEAN
ArCpuId(IN OUT PCPUID_REGISTERS Registers);
XTCLINK
XTCDECL
VOID
ArEnableExtendedPhysicalAddressing(IN ULONG_PTR PageMap);
XTCLINK
XTCDECL
VOID
ArHalt(VOID);
XTCLINK
XTCDECL
ULONG_PTR
ArReadControlRegister(IN USHORT ControlRegister);
XTCLINK
XTCDECL
ULONGLONG
ArReadModelSpecificRegister(IN ULONG Register);
XTCLINK
XTCDECL
VOID
ArWriteControlRegister(IN USHORT ControlRegister,

View File

@@ -16,28 +16,34 @@
/* HAL library routines forward references */
XTCLINK
XTCDECL
UCHAR
HlIoPortInByte(IN USHORT Port);
XTCLINK
XTCDECL
ULONG
HlIoPortInLong(IN USHORT Port);
XTCLINK
XTCDECL
USHORT
HlIoPortInShort(IN USHORT Port);
XTCLINK
XTCDECL
VOID
HlIoPortOutByte(IN USHORT Port,
IN UCHAR Data);
XTCLINK
XTCDECL
VOID
HlIoPortOutLong(IN USHORT Port,
IN ULONG Value);
XTCLINK
XTCDECL
VOID
HlIoPortOutShort(IN USHORT Port,

View File

@@ -14,6 +14,7 @@
/* XT BootLoader routines forward references */
XTCLINK
XTCDECL
EFI_STATUS
BlGetXtLdrProtocol(IN PEFI_SYSTEM_TABLE SystemTable,

View File

@@ -14,26 +14,32 @@
/* Kernel Executive routines forward references */
XTCLINK
XTFASTCALL
BOOLEAN
ExAcquireRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
XTCLINK
XTFASTCALL
VOID
ExCompleteRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
XTCLINK
XTFASTCALL
VOID
ExInitializeRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
XTCLINK
XTFASTCALL
VOID
ExReInitializeRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
XTCLINK
XTFASTCALL
VOID
ExReleaseRundownProtection(IN PEX_RUNDOWN_REFERENCE Descriptor);
XTCLINK
XTFASTCALL
VOID
ExWaitForRundownProtectionRelease(IN PEX_RUNDOWN_REFERENCE Descriptor);

View File

@@ -15,11 +15,13 @@
/* Routines used by XTLDR */
XTCLINK
XTCDECL
XTSTATUS
HlComPortPutByte(IN PCPPORT Port,
IN UCHAR Byte);
XTCLINK
XTCDECL
XTSTATUS
HlInitializeComPort(IN OUT PCPPORT Port,

View File

@@ -16,26 +16,32 @@
/* Routines used by XTLDR */
XTCLINK
XTCDECL
VOID
ArClearInterruptFlag(VOID);
XTCLINK
XTCDECL
BOOLEAN
ArCpuId(IN OUT PCPUID_REGISTERS Registers);
XTCLINK
XTCDECL
VOID
ArHalt(VOID);
XTCLINK
XTCDECL
ULONG_PTR
ArReadControlRegister(IN USHORT ControlRegister);
XTCLINK
XTCDECL
ULONGLONG
ArReadModelSpecificRegister(IN ULONG Register);
XTCLINK
XTCDECL
VOID
ArWriteControlRegister(IN USHORT ControlRegister,

View File

@@ -16,28 +16,34 @@
/* HAL library routines forward references */
XTCLINK
XTCDECL
UCHAR
HlIoPortInByte(IN USHORT Port);
XTCLINK
XTCDECL
ULONG
HlIoPortInLong(IN USHORT Port);
XTCLINK
XTCDECL
USHORT
HlIoPortInShort(IN USHORT Port);
XTCLINK
XTCDECL
VOID
HlIoPortOutByte(IN USHORT Port,
IN UCHAR Data);
XTCLINK
XTCDECL
VOID
HlIoPortOutLong(IN USHORT Port,
IN ULONG Value);
XTCLINK
XTCDECL
VOID
HlIoPortOutShort(IN USHORT Port,

View File

@@ -16,36 +16,44 @@
/* Kernel services routines forward references */
XTCLINK
XTFASTCALL
VOID
KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_LEVEL LockLevel);
XTCLINK
XTFASTCALL
VOID
KeAcquireSpinLock(IN OUT PKSPIN_LOCK SpinLock);
XTCLINK
XTAPI
XTSTATUS
KeAcquireSystemResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
OUT PSYSTEM_RESOURCE_HEADER *ResourceHeader);
XTCLINK
XTAPI
BOOLEAN
KeCancelTimer(IN PKTIMER Timer);
XTCLINK
XTFASTCALL
KRUNLEVEL
KeGetCurrentRunLevel(VOID);
XTCLINK
XTAPI
XTSTATUS
KeGetSystemResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
OUT PSYSTEM_RESOURCE_HEADER *ResourceHeader);
XTCLINK
XTAPI
BOOLEAN
KeGetTimerState(IN PKTIMER Timer);
XTCLINK
XTAPI
VOID
KeInitializeApc(IN PKAPC Apc,
@@ -57,45 +65,54 @@ KeInitializeApc(IN PKAPC Apc,
IN KPROCESSOR_MODE ApcMode,
IN PVOID Context);
XTCLINK
XTAPI
VOID
KeInitializeDpc(IN PKDPC Dpc,
IN PKDEFERRED_ROUTINE DpcRoutine,
IN PVOID DpcContext);
XTCLINK
XTAPI
VOID
KeInitializeSemaphore(IN PKSEMAPHORE Semaphore,
IN LONG Count,
IN LONG Limit);
XTCLINK
XTAPI
VOID
KeInitializeSpinLock(IN PKSPIN_LOCK SpinLock);
XTCLINK
XTAPI
VOID
KeInitializeThreadedDpc(IN PKDPC Dpc,
IN PKDEFERRED_ROUTINE DpcRoutine,
IN PVOID DpcContext);
XTCLINK
XTAPI
VOID
KeInitializeTimer(OUT PKTIMER Timer,
IN KTIMER_TYPE Type);
XTCLINK
XTFASTCALL
VOID
KeLowerRunLevel(IN KRUNLEVEL RunLevel);
XTCLINK
XTFASTCALL
KRUNLEVEL
KeRaiseRunLevel(IN KRUNLEVEL RunLevel);
XTCLINK
XTAPI
LONG
KeReadSemaphoreState(IN PKSEMAPHORE Semaphore);
XTCLINK
XTAPI
LONG
KeReleaseSemaphore(IN PKSEMAPHORE Semaphore,
@@ -103,23 +120,28 @@ KeReleaseSemaphore(IN PKSEMAPHORE Semaphore,
IN LONG Adjustment,
IN BOOLEAN Wait);
XTCLINK
XTFASTCALL
VOID
KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_LEVEL LockLevel);
XTCLINK
XTFASTCALL
VOID
KeReleaseSpinLock(IN OUT PKSPIN_LOCK SpinLock);
XTCLINK
XTAPI
VOID
KeReleaseSystemResource(IN PSYSTEM_RESOURCE_HEADER ResourceHeader);
XTCLINK
XTAPI
VOID
KeSetTargetProcessorDpc(IN PKDPC Dpc,
IN CCHAR Number);
XTCLINK
XTAPI
VOID
KeSetTimer(IN PKTIMER Timer,
@@ -127,10 +149,12 @@ KeSetTimer(IN PKTIMER Timer,
IN LONG Period,
IN PKDPC Dpc);
XTCLINK
XTAPI
VOID
KeSignalCallDpcDone(IN PVOID SystemArgument);
XTCLINK
XTAPI
BOOLEAN
KeSignalCallDpcSynchronize(IN PVOID SystemArgument);

View File

@@ -7,6 +7,7 @@
*/
/* Base XT headers */
#include <xtcompat.h>
#include <xtdefs.h>
#include <xtstatus.h>
#include <xttarget.h>

21
sdk/xtdk/xtcompat.h Normal file
View File

@@ -0,0 +1,21 @@
/**
* PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory
* FILE: sdk/xtdk/xtcompat.h
* DESCRIPTION: C/C++ compatibility macros
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
*/
#ifndef __XTDK_XTCOMPAT_H
#define __XTDK_XTCOMPAT_H
#ifdef __cplusplus
#define XTCLINK extern "C"
typedef wchar_t wchar;
#else
#define XTCLINK
typedef unsigned short wchar;
#endif
#endif /* __XTDK_XTCOMPAT_H */

View File

@@ -7,6 +7,7 @@
*/
/* Base XT headers */
#include <xtcompat.h>
#include <xtdefs.h>
#include <xtstatus.h>
#include <xttarget.h>

View File

@@ -10,6 +10,7 @@
#define __XTDK_XTTYPES_H
#include <xttarget.h>
#include <xtcompat.h>
/* Standard C types */
@@ -128,7 +129,7 @@ typedef CHAR SZ, *PSZ;
typedef const CHAR CSZ, *PCSZ;
/* UNICODE character types */
typedef USHORT WCHAR, *PWCHAR;
typedef wchar WCHAR, *PWCHAR;
typedef WCHAR *PWCH, *LPWCH;
typedef const WCHAR *PCWCH, *LPCWCH;
typedef WCHAR *PWSTR, *LPWSTR, *NWPSTR;