Expose timer performance counter and clock rate functions
All checks were successful
Builds / ExectOS (amd64, release) (push) Successful in -59m30s
Builds / ExectOS (amd64, debug) (push) Successful in -59m28s
Builds / ExectOS (i686, release) (push) Successful in -59m30s
Builds / ExectOS (i686, debug) (push) Successful in -59m29s

This commit is contained in:
2026-05-10 23:42:13 +02:00
parent 6b14f31107
commit 897d9d4099
3 changed files with 48 additions and 0 deletions

View File

@@ -18,6 +18,11 @@
#ifndef __XTOS_ASSEMBLER__ #ifndef __XTOS_ASSEMBLER__
/* Hardware layer routines forward references */ /* Hardware layer routines forward references */
XTCLINK
XTAPI
LARGE_INTEGER
HlQueryPerformanceCounter(OUT PLARGE_INTEGER PerformanceFrequency);
XTCLINK XTCLINK
XTAPI XTAPI
UCHAR UCHAR
@@ -33,6 +38,11 @@ XTAPI
ULONG ULONG
HlReadRegister32(IN PVOID Register); HlReadRegister32(IN PVOID Register);
XTCLINK
XTAPI
ULONG
HlSetClockRate(IN ULONG Rate);
XTCLINK XTCLINK
XTAPI XTAPI
VOID VOID

View File

@@ -9,6 +9,24 @@
#include <xtos.hh> #include <xtos.hh>
/**
* Retrieves the current value of the high-resolution performance counter.
*
* @param PerformanceFrequency
* Suplies an optional pointer to a variable that receives the performance counter frequency in Hz.
*
* @return This routine returns the current 64-bit monotonic tick count.
*
* @since XT 1.0
*/
XTCLINK
XTAPI
LARGE_INTEGER
HlQueryPerformanceCounter(OUT PLARGE_INTEGER PerformanceFrequency)
{
return HL::Timer::QueryPerformanceCounter(PerformanceFrequency);
}
/** /**
* Reads the 8-bit data from the specified I/O port. * Reads the 8-bit data from the specified I/O port.
* *
@@ -117,6 +135,24 @@ HlReadRegister32(IN PVOID Register)
return HL::IoRegister::ReadRegister32(Register); return HL::IoRegister::ReadRegister32(Register);
} }
/**
* Requests a dynamic adjustment of the system clock resolution.
*
* @param Rate
* The requested clock rate change in 100-nanosecond units.
*
* @return This routine returns the actual clock rate granted by the hardware.
*
* @since XT 1.0
*/
XTCLINK
XTAPI
ULONG
HlSetClockRate(IN ULONG Rate)
{
return HL::Timer::SetClockRate(Rate);
}
/** /**
* Writes the 8-bit data to the specified I/O port. * Writes the 8-bit data to the specified I/O port.
* *

View File

@@ -6,12 +6,14 @@
@ fastcall ExReInitializeRundownProtection(ptr) @ fastcall ExReInitializeRundownProtection(ptr)
@ fastcall ExReleaseRundownProtection(ptr) @ fastcall ExReleaseRundownProtection(ptr)
@ fastcall ExWaitForRundownProtectionRelease(ptr) @ fastcall ExWaitForRundownProtectionRelease(ptr)
@ stdcall HlQueryPerformanceCounter(ptr)
@ cdecl HlReadPort8(ptr) @ cdecl HlReadPort8(ptr)
@ cdecl HlReadPort16(ptr) @ cdecl HlReadPort16(ptr)
@ cdecl HlReadPort32(ptr) @ cdecl HlReadPort32(ptr)
@ stdcall HlReadRegister8(ptr) @ stdcall HlReadRegister8(ptr)
@ stdcall HlReadRegister16(ptr) @ stdcall HlReadRegister16(ptr)
@ stdcall HlReadRegister32(ptr) @ stdcall HlReadRegister32(ptr)
@ stdcall HlSetClockRate(long)
@ cdecl HlWritePort8(ptr long) @ cdecl HlWritePort8(ptr long)
@ cdecl HlWritePort16(ptr long) @ cdecl HlWritePort16(ptr long)
@ cdecl HlWritePort32(ptr long) @ cdecl HlWritePort32(ptr long)