Implemented sleep for threads🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉

This commit is contained in:
Alex
2022-12-24 06:22:50 +02:00
parent 690191b927
commit 0942fb4cd3
4 changed files with 81 additions and 1 deletions

View File

@ -15,7 +15,7 @@ namespace Time
void time::Sleep(uint64_t Milliseconds)
{
#if defined(__amd64__) || defined(__i386__)
uintptr_t Target = mminq(&((HPET *)hpet)->MainCounterValue) + (Milliseconds * 1000000000000) / clk;
uint64_t Target = mminq(&((HPET *)hpet)->MainCounterValue) + (Milliseconds * 1000000000000) / clk;
#ifdef DEBUG
uint64_t Counter = mminq(&((HPET *)hpet)->MainCounterValue);
while (Counter < Target)
@ -31,6 +31,22 @@ namespace Time
#endif
}
uint64_t time::GetCounter()
{
#if defined(__amd64__) || defined(__i386__)
return mminq(&((HPET *)hpet)->MainCounterValue);
#elif defined(__aarch64__)
#endif
}
uint64_t time::CalculateTarget(uint64_t Milliseconds)
{
#if defined(__amd64__) || defined(__i386__)
return mminq(&((HPET *)hpet)->MainCounterValue) + (Milliseconds * 1000000000000) / clk;
#elif defined(__aarch64__)
#endif
}
time::time(void *_acpi)
{
if (_acpi)