vapours: add time primitives, fix result name

This commit is contained in:
Michael Scire 2020-02-13 16:18:39 -08:00
parent ef3da6cb51
commit c6d1579265
13 changed files with 238 additions and 18 deletions

View file

@ -79,7 +79,7 @@ namespace ams::kern {
/* Convenience definitions. */
constexpr s32 DpcManagerThreadPriority = 3;
constexpr s64 DpcManagerTimeout = 192'000ll; /* TODO: Constexpr conversion from 10ms */
constexpr s64 DpcManagerTimeout = ams::svc::Tick(TimeSpan::FromMilliSeconds(10));
/* Globals. */
s64 g_preemption_priorities[cpu::NumCores];

View file

@ -17,6 +17,12 @@
namespace ams::kern {
namespace {
constexpr s64 DefaultTimeout = ams::svc::Tick(TimeSpan::FromSeconds(10));
}
void KResourceLimit::Initialize() {
/* This should be unnecessary for us, because our constructor will clear all fields. */
/* The following is analagous to what Nintendo's implementation (no constexpr constructor) would do, though. */
@ -91,8 +97,7 @@ namespace ams::kern {
}
bool KResourceLimit::Reserve(ams::svc::LimitableResource which, s64 value) {
/* TODO: constexpr definition for this default timeout (it's 10 seconds) */
return this->Reserve(which, value, KHardwareTimer::GetTick() + 192'000'000);
return this->Reserve(which, value, KHardwareTimer::GetTick() + DefaultTimeout);
}
bool KResourceLimit::Reserve(ams::svc::LimitableResource which, s64 value, s64 timeout) {