Migrate RTL subsystem to C++
Some checks failed
Builds / ExectOS (amd64, debug) (push) Failing after 21s
Builds / ExectOS (amd64, release) (push) Failing after 20s
Builds / ExectOS (i686, debug) (push) Failing after 19s
Builds / ExectOS (i686, release) (push) Failing after 18s

This commit is contained in:
2025-09-11 18:28:24 +02:00
parent e507dd0390
commit 9518e7da8e
35 changed files with 3133 additions and 1068 deletions

130
xtoskrnl/hl/exports.cc Normal file
View File

@@ -0,0 +1,130 @@
/**
* PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtoskrnl/hl/exports.cc
* DESCRIPTION: C-compatible API wrappers for exported kernel functions
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
*/
#include <xtos.hh>
/**
* Reads an 8-bit data from a specified register address.
*
* @param Register
* Supplies a pointer to register address holding data to read.
*
* @return This routine returns a value at the specified register.
*
* @since XT 1.0
*/
XTCLINK
XTAPI
UCHAR
HlReadRegister8(IN PVOID Register)
{
return HL::IoRegister::ReadRegister8(Register);
}
/**
* Reads a 16-bit data from a specified register address.
*
* @param Register
* Supplies a pointer to register address holding data to read.
*
* @return This routine returns a value at the specified register.
*
* @since XT 1.0
*/
XTCLINK
XTAPI
USHORT
HlReadRegister16(IN PVOID Register)
{
return HL::IoRegister::ReadRegister16(Register);
}
/**
* Reads a 32-bit data from a specified register address.
*
* @param Register
* Supplies a pointer to register address holding data to read.
*
* @return This routine returns a value at the specified register.
*
* @since XT 1.0
*/
XTCLINK
XTAPI
ULONG
HlReadRegister32(IN PVOID Register)
{
return HL::IoRegister::ReadRegister32(Register);
}
/**
* Writes an 8-bit value into a specified register address.
*
* @param Register
* Supplies a pointer to register address where data will be written.
*
* @param Value
* Supplies a new value that will be stored into a register.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCLINK
XTAPI
VOID
HlWriteRegister8(IN PVOID Register,
IN UCHAR Value)
{
HL::IoRegister::WriteRegister8(Register, Value);
}
/**
* Writes a 16-bit value into a specified register address.
*
* @param Register
* Supplies a pointer to register address where data will be written.
*
* @param Value
* Supplies a new value that will be stored into a register.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCLINK
XTAPI
VOID
HlWriteRegister16(IN PVOID Register,
IN USHORT Value)
{
HL::IoRegister::WriteRegister16(Register, Value);
}
/**
* Writes a 32-bit value into a specified register address.
*
* @param Register
* Supplies a pointer to register address where data will be written.
*
* @param Value
* Supplies a new value that will be stored into a register.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCLINK
XTAPI
VOID
HlWriteRegister32(IN PVOID Register,
IN ULONG Value)
{
HL::IoRegister::WriteRegister32(Register, Value);
}

124
xtoskrnl/hl/ioreg.cc Normal file
View File

@@ -0,0 +1,124 @@
/**
* PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtoskrnl/hl/ioreg.cc
* DESCRIPTION: Basic I/O registers access functionality
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/
#include <xtos.hh>
/**
* Reads an 8-bit data from a specified register address.
*
* @param Register
* Supplies a pointer to register address holding data to read.
*
* @return This routine returns a value at the specified register.
*
* @since XT 1.0
*/
XTAPI
UCHAR
HL::IoRegister::ReadRegister8(IN PVOID Register)
{
return *((VOLATILE PUCHAR)Register);
}
/**
* Reads a 16-bit data from a specified register address.
*
* @param Register
* Supplies a pointer to register address holding data to read.
*
* @return This routine returns a value at the specified register.
*
* @since XT 1.0
*/
XTAPI
USHORT
HL::IoRegister::ReadRegister16(IN PVOID Register)
{
return *((VOLATILE PUSHORT)Register);
}
/**
* Reads a 32-bit data from a specified register address.
*
* @param Register
* Supplies a pointer to register address holding data to read.
*
* @return This routine returns a value at the specified register.
*
* @since XT 1.0
*/
XTAPI
ULONG
HL::IoRegister::ReadRegister32(IN PVOID Register)
{
return *((VOLATILE PULONG)Register);
}
/**
* Writes an 8-bit value into a specified register address.
*
* @param Register
* Supplies a pointer to register address where data will be written.
*
* @param Value
* Supplies a new value that will be stored into a register.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
HL::IoRegister::WriteRegister8(IN PVOID Register,
IN UCHAR Value)
{
*((VOLATILE PUCHAR)Register) = Value;
}
/**
* Writes a 16-bit value into a specified register address.
*
* @param Register
* Supplies a pointer to register address where data will be written.
*
* @param Value
* Supplies a new value that will be stored into a register.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
HL::IoRegister::WriteRegister16(IN PVOID Register,
IN USHORT Value)
{
*((VOLATILE PUSHORT)Register) = Value;
}
/**
* Writes a 32-bit value into a specified register address.
*
* @param Register
* Supplies a pointer to register address where data will be written.
*
* @param Value
* Supplies a new value that will be stored into a register.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
HL::IoRegister::WriteRegister32(IN PVOID Register,
IN ULONG Value)
{
*((VOLATILE PULONG)Register) = Value;
}