Address feedback

This commit is contained in:
Billy Laws 2021-06-18 17:24:31 +01:00
parent b87f451746
commit 100cff7692
5 changed files with 7 additions and 8 deletions

View File

@ -75,7 +75,7 @@ namespace skyline {
return uuid.Swap();
}
UUID UUID::GenerateUuidV5(const std::array<u8, 20> sha1) {
UUID UUID::GenerateUuidV5(span<u8, 20> sha1) {
constexpr u8 reserved{0x1}; // RFC4122 variant
constexpr u8 version{0x5}; // v4 UUIDs are generated using SHA1 hashes

View File

@ -18,7 +18,7 @@ namespace skyline {
/**
* @brief Generates a version 5 UUID from the given SHA1
*/
static UUID GenerateUuidV5(const std::array<u8, 20> sha1);
static UUID GenerateUuidV5(span<u8, 20> sha1);
/**
* @brief Checks if a UUID is an invalid nil UUID

View File

@ -258,10 +258,9 @@ namespace skyline::kernel {
std::unique_lock coreLock(core->mutex);
auto currentIt{std::find(core->queue.begin(), core->queue.end(), thread)}, nextIt{std::next(currentIt)};
if (currentIt == core->queue.end())
if (currentIt == core->queue.end()) {
return;
if (currentIt == core->queue.begin()) {
} else if (currentIt == core->queue.begin()) {
// Alternatively, if it's currently running then we'd just want to yield if there's a higher priority thread to run instead
if (nextIt != core->queue.end() && (*nextIt)->priority < thread->priority) {
if (!thread->pendingYield) {

View File

@ -244,7 +244,7 @@ namespace skyline::kernel::type {
}
void KThread::DisarmPreemptionTimer() {
if (!isPreempted)
if (!isPreempted) [[unlikely]]
return;
std::unique_lock lock(statusMutex);

View File

@ -45,8 +45,8 @@ namespace skyline::service::am {
auto seedForPseudoDeviceId{state.loader->nacp->nacpContents.seedForPseudoDeviceId};
std::array<u8, 20> hashBuf{};
// On HOS the seed from control.ncap is hashed together with the device specific device ID seed,
// for us it's enough to just hash the seed from control.nacp as it provides the same guarantees.
// On HOS the seed from control.ncap is hashed together with the device specific device ID seed
// for us it's enough to just hash the seed from control.nacp as it provides the same guarantees
if (int err{mbedtls_sha1_ret(seedForPseudoDeviceId.data(), seedForPseudoDeviceId.size(), hashBuf.data())}; err < 0)
throw exception("Failed to hash device ID, err: {}", err);