mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-27 15:45:30 +03:00
Refactor all logger calls
This commit is contained in:
parent
769e6c933d
commit
5cd1f01690
@ -7,7 +7,6 @@
|
||||
#include <android/asset_manager_jni.h>
|
||||
#include <sys/system_properties.h>
|
||||
#include "skyline/common.h"
|
||||
#include "skyline/common/logger.h"
|
||||
#include "skyline/common/language.h"
|
||||
#include "skyline/common/signal.h"
|
||||
#include "skyline/common/settings.h"
|
||||
@ -113,15 +112,15 @@ extern "C" JNIEXPORT void Java_emu_skyline_EmulationActivity_executeApplication(
|
||||
InputWeak = os->state.input;
|
||||
jvmManager->InitializeControllers();
|
||||
|
||||
logger->InfoNoPrefix("Launching ROM {}", skyline::JniString(env, romUriJstring));
|
||||
skyline::Logger::InfoNoPrefix("Launching ROM {}", skyline::JniString(env, romUriJstring));
|
||||
|
||||
os->Execute(romFd, static_cast<skyline::loader::RomFormat>(romType));
|
||||
} catch (std::exception &e) {
|
||||
logger->ErrorNoPrefix("An uncaught exception has occurred: {}", e.what());
|
||||
skyline::Logger::ErrorNoPrefix("An uncaught exception has occurred: {}", e.what());
|
||||
} catch (const skyline::signal::SignalException &e) {
|
||||
logger->ErrorNoPrefix("An uncaught exception has occurred: {}", e.what());
|
||||
skyline::Logger::ErrorNoPrefix("An uncaught exception has occurred: {}", e.what());
|
||||
} catch (...) {
|
||||
logger->ErrorNoPrefix("An unknown uncaught exception has occurred");
|
||||
skyline::Logger::ErrorNoPrefix("An unknown uncaught exception has occurred");
|
||||
}
|
||||
|
||||
perfetto::TrackEvent::Flush();
|
||||
@ -129,7 +128,7 @@ extern "C" JNIEXPORT void Java_emu_skyline_EmulationActivity_executeApplication(
|
||||
InputWeak.reset();
|
||||
|
||||
auto end{std::chrono::steady_clock::now()};
|
||||
logger->Write(skyline::Logger::LogLevel::Info, fmt::format("Emulation has ended in {}ms", std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count()));
|
||||
skyline::Logger::Write(skyline::Logger::LogLevel::Info, fmt::format("Emulation has ended in {}ms", std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count()));
|
||||
|
||||
skyline::Logger::EmulationContext.Finalize();
|
||||
close(romFd);
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <boost/container/small_vector.hpp>
|
||||
#include <common/span.h>
|
||||
#include <common/result.h>
|
||||
#include <common/logger.h>
|
||||
|
||||
namespace skyline {
|
||||
class Settings;
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Copyright © 2021 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include <android/log.h>
|
||||
#include "utils.h"
|
||||
#include "logger.h"
|
||||
|
||||
namespace skyline {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include <fstream>
|
||||
#include <mutex>
|
||||
#include "common.h"
|
||||
#include "base.h"
|
||||
|
||||
namespace skyline {
|
||||
/**
|
||||
|
@ -22,11 +22,11 @@ namespace skyline::gpu {
|
||||
#endif
|
||||
|
||||
auto instanceLayers{context.enumerateInstanceLayerProperties()};
|
||||
if (state.logger->configLevel >= Logger::LogLevel::Debug) {
|
||||
if (Logger::configLevel >= Logger::LogLevel::Debug) {
|
||||
std::string layers;
|
||||
for (const auto &instanceLayer : instanceLayers)
|
||||
layers += util::Format("\n* {} (Sv{}.{}.{}, Iv{}.{}.{}) - {}", instanceLayer.layerName, VK_VERSION_MAJOR(instanceLayer.specVersion), VK_VERSION_MINOR(instanceLayer.specVersion), VK_VERSION_PATCH(instanceLayer.specVersion), VK_VERSION_MAJOR(instanceLayer.implementationVersion), VK_VERSION_MINOR(instanceLayer.implementationVersion), VK_VERSION_PATCH(instanceLayer.implementationVersion), instanceLayer.description);
|
||||
state.logger->Debug("Vulkan Layers:{}", layers);
|
||||
Logger::Debug("Vulkan Layers:{}", layers);
|
||||
}
|
||||
|
||||
for (const auto &requiredLayer : requiredLayers) {
|
||||
@ -43,11 +43,11 @@ namespace skyline::gpu {
|
||||
};
|
||||
|
||||
auto instanceExtensions{context.enumerateInstanceExtensionProperties()};
|
||||
if (state.logger->configLevel >= Logger::LogLevel::Debug) {
|
||||
if (Logger::configLevel >= Logger::LogLevel::Debug) {
|
||||
std::string extensions;
|
||||
for (const auto &instanceExtension : instanceExtensions)
|
||||
extensions += util::Format("\n* {} (v{}.{}.{})", instanceExtension.extensionName, VK_VERSION_MAJOR(instanceExtension.specVersion), VK_VERSION_MINOR(instanceExtension.specVersion), VK_VERSION_PATCH(instanceExtension.specVersion));
|
||||
state.logger->Debug("Vulkan Instance Extensions:{}", extensions);
|
||||
Logger::Debug("Vulkan Instance Extensions:{}", extensions);
|
||||
}
|
||||
|
||||
for (const auto &requiredExtension : requiredInstanceExtensions) {
|
||||
@ -66,15 +66,14 @@ namespace skyline::gpu {
|
||||
});
|
||||
}
|
||||
|
||||
vk::raii::DebugReportCallbackEXT GPU::CreateDebugReportCallback(const DeviceState &state, const vk::raii::Instance &instance) {
|
||||
vk::raii::DebugReportCallbackEXT GPU::CreateDebugReportCallback(const vk::raii::Instance &instance) {
|
||||
return vk::raii::DebugReportCallbackEXT(instance, vk::DebugReportCallbackCreateInfoEXT{
|
||||
.flags = vk::DebugReportFlagBitsEXT::eError | vk::DebugReportFlagBitsEXT::eWarning | vk::DebugReportFlagBitsEXT::ePerformanceWarning | vk::DebugReportFlagBitsEXT::eInformation | vk::DebugReportFlagBitsEXT::eDebug,
|
||||
.pfnCallback = reinterpret_cast<PFN_vkDebugReportCallbackEXT>(&DebugCallback),
|
||||
.pUserData = state.logger.get(),
|
||||
});
|
||||
}
|
||||
|
||||
VkBool32 GPU::DebugCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char *layerPrefix, const char *message, Logger *logger) {
|
||||
VkBool32 GPU::DebugCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char *layerPrefix, const char *message) {
|
||||
constexpr std::array<Logger::LogLevel, 5> severityLookup{
|
||||
Logger::LogLevel::Info, // VK_DEBUG_REPORT_INFORMATION_BIT_EXT
|
||||
Logger::LogLevel::Warn, // VK_DEBUG_REPORT_WARNING_BIT_EXT
|
||||
@ -111,16 +110,16 @@ namespace skyline::gpu {
|
||||
#undef IGNORE_TYPE
|
||||
}
|
||||
|
||||
logger->Write(severityLookup.at(static_cast<size_t>(std::countr_zero(static_cast<u32>(flags)))), util::Format("Vk{}:{}[0x{:X}]:I{}:L{}: {}", layerPrefix, vk::to_string(vk::DebugReportObjectTypeEXT(objectType)), object, messageCode, location, message));
|
||||
Logger::Write(severityLookup.at(static_cast<size_t>(std::countr_zero(static_cast<u32>(flags)))), util::Format("Vk{}:{}[0x{:X}]:I{}:L{}: {}", layerPrefix, vk::to_string(vk::DebugReportObjectTypeEXT(objectType)), object, messageCode, location, message));
|
||||
|
||||
return VK_FALSE;
|
||||
}
|
||||
|
||||
vk::raii::PhysicalDevice GPU::CreatePhysicalDevice(const DeviceState &state, const vk::raii::Instance &instance) {
|
||||
vk::raii::PhysicalDevice GPU::CreatePhysicalDevice(const vk::raii::Instance &instance) {
|
||||
return std::move(vk::raii::PhysicalDevices(instance).front()); // We just select the first device as we aren't expecting multiple GPUs
|
||||
}
|
||||
|
||||
vk::raii::Device GPU::CreateDevice(const DeviceState &state, const vk::raii::PhysicalDevice &physicalDevice, typeof(vk::DeviceQueueCreateInfo::queueCount) &vkQueueFamilyIndex) {
|
||||
vk::raii::Device GPU::CreateDevice(const vk::raii::PhysicalDevice &physicalDevice, typeof(vk::DeviceQueueCreateInfo::queueCount) &vkQueueFamilyIndex) {
|
||||
auto properties{physicalDevice.getProperties()}; // We should check for required properties here, if/when we have them
|
||||
|
||||
// auto features{physicalDevice.getFeatures()}; // Same as above
|
||||
@ -154,7 +153,7 @@ namespace skyline::gpu {
|
||||
throw exception("Cannot find a queue family with both eGraphics and eCompute bits set");
|
||||
}()};
|
||||
|
||||
if (state.logger->configLevel >= Logger::LogLevel::Info) {
|
||||
if (Logger::configLevel >= Logger::LogLevel::Info) {
|
||||
std::string extensionString;
|
||||
for (const auto &extension : deviceExtensions)
|
||||
extensionString += util::Format("\n* {} (v{}.{}.{})", extension.extensionName, VK_VERSION_MAJOR(extension.specVersion), VK_VERSION_MINOR(extension.specVersion), VK_VERSION_PATCH(extension.specVersion));
|
||||
@ -164,7 +163,7 @@ namespace skyline::gpu {
|
||||
for (const auto &queueFamily : queueFamilies)
|
||||
queueString += util::Format("\n* {}x{}{}{}{}{}: TSB{} MIG({}x{}x{}){}", queueFamily.queueCount, queueFamily.queueFlags & vk::QueueFlagBits::eGraphics ? 'G' : '-', queueFamily.queueFlags & vk::QueueFlagBits::eCompute ? 'C' : '-', queueFamily.queueFlags & vk::QueueFlagBits::eTransfer ? 'T' : '-', queueFamily.queueFlags & vk::QueueFlagBits::eSparseBinding ? 'S' : '-', queueFamily.queueFlags & vk::QueueFlagBits::eProtected ? 'P' : '-', queueFamily.timestampValidBits, queueFamily.minImageTransferGranularity.width, queueFamily.minImageTransferGranularity.height, queueFamily.minImageTransferGranularity.depth, familyIndex++ == vkQueueFamilyIndex ? " <--" : "");
|
||||
|
||||
state.logger->Info("Vulkan Device:\nName: {}\nType: {}\nVulkan Version: {}.{}.{}\nDriver Version: {}.{}.{}\nQueues:{}\nExtensions:{}", properties.deviceName, vk::to_string(properties.deviceType), VK_VERSION_MAJOR(properties.apiVersion), VK_VERSION_MINOR(properties.apiVersion), VK_VERSION_PATCH(properties.apiVersion), VK_VERSION_MAJOR(properties.driverVersion), VK_VERSION_MINOR(properties.driverVersion), VK_VERSION_PATCH(properties.driverVersion), queueString, extensionString);
|
||||
Logger::Info("Vulkan Device:\nName: {}\nType: {}\nVulkan Version: {}.{}.{}\nDriver Version: {}.{}.{}\nQueues:{}\nExtensions:{}", properties.deviceName, vk::to_string(properties.deviceType), VK_VERSION_MAJOR(properties.apiVersion), VK_VERSION_MINOR(properties.apiVersion), VK_VERSION_PATCH(properties.apiVersion), VK_VERSION_MAJOR(properties.driverVersion), VK_VERSION_MINOR(properties.driverVersion), VK_VERSION_PATCH(properties.driverVersion), queueString, extensionString);
|
||||
}
|
||||
|
||||
return vk::raii::Device(physicalDevice, vk::DeviceCreateInfo{
|
||||
@ -175,5 +174,5 @@ namespace skyline::gpu {
|
||||
});
|
||||
}
|
||||
|
||||
GPU::GPU(const DeviceState &state) : vkInstance(CreateInstance(state, vkContext)), vkDebugReportCallback(CreateDebugReportCallback(state, vkInstance)), vkPhysicalDevice(CreatePhysicalDevice(state, vkInstance)), vkDevice(CreateDevice(state, vkPhysicalDevice, vkQueueFamilyIndex)), vkQueue(vkDevice, vkQueueFamilyIndex, 0), memory(*this), scheduler(*this), presentation(state, *this), texture(*this) {}
|
||||
GPU::GPU(const DeviceState &state) : vkInstance(CreateInstance(state, vkContext)), vkDebugReportCallback(CreateDebugReportCallback(vkInstance)), vkPhysicalDevice(CreatePhysicalDevice(vkInstance)), vkDevice(CreateDevice(vkPhysicalDevice, vkQueueFamilyIndex)), vkQueue(vkDevice, vkQueueFamilyIndex, 0), memory(*this), scheduler(*this), presentation(state, *this), texture(*this) {}
|
||||
}
|
||||
|
@ -16,13 +16,13 @@ namespace skyline::gpu {
|
||||
private:
|
||||
static vk::raii::Instance CreateInstance(const DeviceState &state, const vk::raii::Context &context);
|
||||
|
||||
static vk::raii::DebugReportCallbackEXT CreateDebugReportCallback(const DeviceState &state, const vk::raii::Instance &instance);
|
||||
static vk::raii::DebugReportCallbackEXT CreateDebugReportCallback(const vk::raii::Instance &instance);
|
||||
|
||||
static VKAPI_ATTR VkBool32 VKAPI_CALL DebugCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char *layerPrefix, const char *message, Logger *logger);
|
||||
static VKAPI_ATTR VkBool32 VKAPI_CALL DebugCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char *layerPrefix, const char *message);
|
||||
|
||||
static vk::raii::PhysicalDevice CreatePhysicalDevice(const DeviceState &state, const vk::raii::Instance &instance);
|
||||
static vk::raii::PhysicalDevice CreatePhysicalDevice(const vk::raii::Instance &instance);
|
||||
|
||||
static vk::raii::Device CreateDevice(const DeviceState &state, const vk::raii::PhysicalDevice &physicalDevice, typeof(vk::DeviceQueueCreateInfo::queueCount)& queueConfiguration);
|
||||
static vk::raii::Device CreateDevice(const vk::raii::PhysicalDevice &physicalDevice, typeof(vk::DeviceQueueCreateInfo::queueCount)& queueConfiguration);
|
||||
|
||||
public:
|
||||
static constexpr u32 VkApiVersion{VK_API_VERSION_1_1}; //!< The version of core Vulkan that we require
|
||||
|
@ -72,13 +72,13 @@ namespace skyline::gpu {
|
||||
AChoreographer_postFrameCallback64(AChoreographer_getInstance(), reinterpret_cast<AChoreographer_frameCallback64>(&ChoreographerCallback), this);
|
||||
while (ALooper_pollAll(-1, nullptr, nullptr, nullptr) == ALOOPER_POLL_WAKE && !choreographerStop); // Will block and process callbacks till ALooper_wake() is called with choreographerStop set
|
||||
} catch (const signal::SignalException &e) {
|
||||
state.logger->Error("{}\nStack Trace:{}", e.what(), state.loader->GetStackTrace(e.frames));
|
||||
Logger::Error("{}\nStack Trace:{}", e.what(), state.loader->GetStackTrace(e.frames));
|
||||
if (state.process)
|
||||
state.process->Kill(false);
|
||||
else
|
||||
std::rethrow_exception(std::current_exception());
|
||||
} catch (const std::exception &e) {
|
||||
state.logger->Error(e.what());
|
||||
Logger::Error(e.what());
|
||||
if (state.process)
|
||||
state.process->Kill(false);
|
||||
else
|
||||
|
@ -29,7 +29,7 @@ namespace skyline::kernel::ipc {
|
||||
auto bufX{reinterpret_cast<BufferDescriptorX *>(pointer)};
|
||||
if (bufX->Pointer()) {
|
||||
inputBuf.emplace_back(bufX->Pointer(), static_cast<u16>(bufX->size));
|
||||
state.logger->Verbose("Buf X #{}: 0x{:X}, 0x{:X}, #{}", index, bufX->Pointer(), static_cast<u16>(bufX->size), static_cast<u16>(bufX->Counter()));
|
||||
Logger::Verbose("Buf X #{}: 0x{:X}, 0x{:X}, #{}", index, bufX->Pointer(), static_cast<u16>(bufX->size), static_cast<u16>(bufX->Counter()));
|
||||
}
|
||||
pointer += sizeof(BufferDescriptorX);
|
||||
}
|
||||
@ -38,7 +38,7 @@ namespace skyline::kernel::ipc {
|
||||
auto bufA{reinterpret_cast<BufferDescriptorABW *>(pointer)};
|
||||
if (bufA->Pointer()) {
|
||||
inputBuf.emplace_back(bufA->Pointer(), bufA->Size());
|
||||
state.logger->Verbose("Buf A #{}: 0x{:X}, 0x{:X}", index, bufA->Pointer(), static_cast<u64>(bufA->Size()));
|
||||
Logger::Verbose("Buf A #{}: 0x{:X}, 0x{:X}", index, bufA->Pointer(), static_cast<u64>(bufA->Size()));
|
||||
}
|
||||
pointer += sizeof(BufferDescriptorABW);
|
||||
}
|
||||
@ -47,7 +47,7 @@ namespace skyline::kernel::ipc {
|
||||
auto bufB{reinterpret_cast<BufferDescriptorABW *>(pointer)};
|
||||
if (bufB->Pointer()) {
|
||||
outputBuf.emplace_back(bufB->Pointer(), bufB->Size());
|
||||
state.logger->Verbose("Buf B #{}: 0x{:X}, 0x{:X}", index, bufB->Pointer(), static_cast<u64>(bufB->Size()));
|
||||
Logger::Verbose("Buf B #{}: 0x{:X}, 0x{:X}", index, bufB->Pointer(), static_cast<u64>(bufB->Size()));
|
||||
}
|
||||
pointer += sizeof(BufferDescriptorABW);
|
||||
}
|
||||
@ -57,7 +57,7 @@ namespace skyline::kernel::ipc {
|
||||
if (bufW->Pointer()) {
|
||||
outputBuf.emplace_back(bufW->Pointer(), bufW->Size());
|
||||
outputBuf.emplace_back(bufW->Pointer(), bufW->Size());
|
||||
state.logger->Verbose("Buf W #{}: 0x{:X}, 0x{:X}", index, bufW->Pointer(), static_cast<u16>(bufW->Size()));
|
||||
Logger::Verbose("Buf W #{}: 0x{:X}, 0x{:X}", index, bufW->Pointer(), static_cast<u16>(bufW->Size()));
|
||||
}
|
||||
pointer += sizeof(BufferDescriptorABW);
|
||||
}
|
||||
@ -94,33 +94,33 @@ namespace skyline::kernel::ipc {
|
||||
payloadOffset = cmdArg;
|
||||
|
||||
if (payload->magic != util::MakeMagic<u32>("SFCI") && (header->type != CommandType::Control && header->type != CommandType::ControlWithContext && header->type != CommandType::Close) && (!domain || domain->command != DomainCommand::CloseVHandle)) // SFCI is the magic in received IPC messages
|
||||
state.logger->Debug("Unexpected Magic in PayloadHeader: 0x{:X}", static_cast<u32>(payload->magic));
|
||||
Logger::Debug("Unexpected Magic in PayloadHeader: 0x{:X}", static_cast<u32>(payload->magic));
|
||||
|
||||
|
||||
if (header->cFlag == BufferCFlag::SingleDescriptor) {
|
||||
auto bufC{reinterpret_cast<BufferDescriptorC *>(bufCPointer)};
|
||||
if (bufC->address) {
|
||||
outputBuf.emplace_back(bufC->Pointer(), static_cast<u16>(bufC->size));
|
||||
state.logger->Verbose("Buf C: 0x{:X}, 0x{:X}", bufC->Pointer(), static_cast<u16>(bufC->size));
|
||||
Logger::Verbose("Buf C: 0x{:X}, 0x{:X}", bufC->Pointer(), static_cast<u16>(bufC->size));
|
||||
}
|
||||
} else if (header->cFlag > BufferCFlag::SingleDescriptor) {
|
||||
for (u8 index{}; (static_cast<u8>(header->cFlag) - 2) > index; index++) { // (cFlag - 2) C descriptors are present
|
||||
auto bufC{reinterpret_cast<BufferDescriptorC *>(bufCPointer)};
|
||||
if (bufC->address) {
|
||||
outputBuf.emplace_back(bufC->Pointer(), static_cast<u16>(bufC->size));
|
||||
state.logger->Verbose("Buf C #{}: 0x{:X}, 0x{:X}", index, bufC->Pointer(), static_cast<u16>(bufC->size));
|
||||
Logger::Verbose("Buf C #{}: 0x{:X}, 0x{:X}", index, bufC->Pointer(), static_cast<u16>(bufC->size));
|
||||
}
|
||||
bufCPointer += sizeof(BufferDescriptorC);
|
||||
}
|
||||
}
|
||||
|
||||
if (header->type == CommandType::Request || header->type == CommandType::RequestWithContext) {
|
||||
state.logger->Verbose("Header: Input No: {}, Output No: {}, Raw Size: {}", inputBuf.size(), outputBuf.size(), static_cast<u64>(cmdArgSz));
|
||||
Logger::Verbose("Header: Input No: {}, Output No: {}, Raw Size: {}", inputBuf.size(), outputBuf.size(), static_cast<u64>(cmdArgSz));
|
||||
if (header->handleDesc)
|
||||
state.logger->Verbose("Handle Descriptor: Send PID: {}, Copy Count: {}, Move Count: {}", static_cast<bool>(handleDesc->sendPid), static_cast<u32>(handleDesc->copyCount), static_cast<u32>(handleDesc->moveCount));
|
||||
Logger::Verbose("Handle Descriptor: Send PID: {}, Copy Count: {}, Move Count: {}", static_cast<bool>(handleDesc->sendPid), static_cast<u32>(handleDesc->copyCount), static_cast<u32>(handleDesc->moveCount));
|
||||
if (isDomain)
|
||||
state.logger->Verbose("Domain Header: Command: {}, Input Object Count: {}, Object ID: 0x{:X}", domain->command, domain->inputCount, domain->objectId);
|
||||
state.logger->Verbose("Command ID: 0x{:X}", static_cast<u32>(payload->value));
|
||||
Logger::Verbose("Domain Header: Command: {}, Input Object Count: {}, Object ID: 0x{:X}", domain->command, domain->inputCount, domain->objectId);
|
||||
Logger::Verbose("Command ID: 0x{:X}", static_cast<u32>(payload->value));
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,6 +181,6 @@ namespace skyline::kernel::ipc {
|
||||
}
|
||||
}
|
||||
|
||||
state.logger->Verbose("Output: Raw Size: {}, Result: 0x{:X}, Copy Handles: {}, Move Handles: {}", static_cast<u32>(header->rawSize), static_cast<u32>(payloadHeader->value), copyHandles.size(), moveHandles.size());
|
||||
Logger::Verbose("Output: Raw Size: {}, Result: 0x{:X}, Copy Handles: {}, Move Handles: {}", static_cast<u32>(header->rawSize), static_cast<u32>(payloadHeader->value), copyHandles.size(), moveHandles.size());
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ namespace skyline::kernel {
|
||||
if (size > code.size)
|
||||
throw exception("Code region ({}) is smaller than mapped code size ({})", code.size, size);
|
||||
|
||||
state.logger->Debug("Region Map:\nVMM Base: 0x{:X}\nCode Region: 0x{:X} - 0x{:X} (Size: 0x{:X})\nAlias Region: 0x{:X} - 0x{:X} (Size: 0x{:X})\nHeap Region: 0x{:X} - 0x{:X} (Size: 0x{:X})\nStack Region: 0x{:X} - 0x{:X} (Size: 0x{:X})\nTLS/IO Region: 0x{:X} - 0x{:X} (Size: 0x{:X})", base.address, code.address, code.address + code.size, code.size, alias.address, alias.address + alias.size, alias.size, heap.address, heap
|
||||
Logger::Debug("Region Map:\nVMM Base: 0x{:X}\nCode Region: 0x{:X} - 0x{:X} (Size: 0x{:X})\nAlias Region: 0x{:X} - 0x{:X} (Size: 0x{:X})\nHeap Region: 0x{:X} - 0x{:X} (Size: 0x{:X})\nStack Region: 0x{:X} - 0x{:X} (Size: 0x{:X})\nTLS/IO Region: 0x{:X} - 0x{:X} (Size: 0x{:X})", base.address, code.address, code.address + code.size, code.size, alias.address, alias.address + alias.size, alias.size, heap.address, heap
|
||||
.address + heap.size, heap.size, stack.address, stack.address + stack.size, stack.size, tlsIo.address, tlsIo.address + tlsIo.size, tlsIo.size);
|
||||
}
|
||||
|
||||
|
@ -70,14 +70,14 @@ namespace skyline::kernel {
|
||||
}
|
||||
|
||||
if (optimalCore != currentCore)
|
||||
state.logger->Debug("Load Balancing T{}: C{} -> C{}", thread->id, currentCore->id, optimalCore->id);
|
||||
Logger::Debug("Load Balancing T{}: C{} -> C{}", thread->id, currentCore->id, optimalCore->id);
|
||||
else
|
||||
state.logger->Debug("Load Balancing T{}: C{} (Late)", thread->id, currentCore->id);
|
||||
Logger::Debug("Load Balancing T{}: C{} (Late)", thread->id, currentCore->id);
|
||||
|
||||
return *optimalCore;
|
||||
}
|
||||
|
||||
state.logger->Debug("Load Balancing T{}: C{} (Early)", thread->id, currentCore->id);
|
||||
Logger::Debug("Load Balancing T{}: C{} (Early)", thread->id, currentCore->id);
|
||||
|
||||
return *currentCore;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace skyline::kernel::svc {
|
||||
state.ctx->gpr.w0 = result::InvalidSize;
|
||||
state.ctx->gpr.x1 = 0;
|
||||
|
||||
state.logger->Warn("'size' not divisible by 2MB: {}", size);
|
||||
Logger::Warn("'size' not divisible by 2MB: {}", size);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -27,21 +27,21 @@ namespace skyline::kernel::svc {
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
state.ctx->gpr.x1 = reinterpret_cast<u64>(heap->ptr);
|
||||
|
||||
state.logger->Debug("Allocated at 0x{:X} - 0x{:X} (0x{:X} bytes)", heap->ptr, heap->ptr + heap->size, heap->size);
|
||||
Logger::Debug("Allocated at 0x{:X} - 0x{:X} (0x{:X} bytes)", heap->ptr, heap->ptr + heap->size, heap->size);
|
||||
}
|
||||
|
||||
void SetMemoryAttribute(const DeviceState &state) {
|
||||
auto pointer{reinterpret_cast<u8 *>(state.ctx->gpr.x0)};
|
||||
if (!util::IsPageAligned(pointer)) {
|
||||
state.ctx->gpr.w0 = result::InvalidAddress;
|
||||
state.logger->Warn("'pointer' not page aligned: 0x{:X}", pointer);
|
||||
Logger::Warn("'pointer' not page aligned: 0x{:X}", pointer);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t size{state.ctx->gpr.x1};
|
||||
if (!util::IsPageAligned(size)) {
|
||||
state.ctx->gpr.w0 = result::InvalidSize;
|
||||
state.logger->Warn("'size' {}: 0x{:X}", size ? "not page aligned" : "is zero", size);
|
||||
Logger::Warn("'size' {}: 0x{:X}", size ? "not page aligned" : "is zero", size);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -51,20 +51,20 @@ namespace skyline::kernel::svc {
|
||||
auto maskedValue{mask.value | value.value};
|
||||
if (maskedValue != mask.value || !mask.isUncached || mask.isDeviceShared || mask.isBorrowed || mask.isIpcLocked) {
|
||||
state.ctx->gpr.w0 = result::InvalidCombination;
|
||||
state.logger->Warn("'mask' invalid: 0x{:X}, 0x{:X}", mask.value, value.value);
|
||||
Logger::Warn("'mask' invalid: 0x{:X}, 0x{:X}", mask.value, value.value);
|
||||
return;
|
||||
}
|
||||
|
||||
auto chunk{state.process->memory.Get(pointer)};
|
||||
if (!chunk) {
|
||||
state.ctx->gpr.w0 = result::InvalidAddress;
|
||||
state.logger->Warn("Cannot find memory region: 0x{:X}", pointer);
|
||||
Logger::Warn("Cannot find memory region: 0x{:X}", pointer);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!chunk->state.attributeChangeAllowed) {
|
||||
state.ctx->gpr.w0 = result::InvalidState;
|
||||
state.logger->Warn("Attribute change not allowed for chunk: 0x{:X}", pointer);
|
||||
Logger::Warn("Attribute change not allowed for chunk: 0x{:X}", pointer);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ namespace skyline::kernel::svc {
|
||||
newChunk.attributes.isUncached = value.isUncached;
|
||||
state.process->memory.InsertChunk(newChunk);
|
||||
|
||||
state.logger->Debug("Set CPU caching to {} at 0x{:X} - 0x{:X} (0x{:X} bytes)", !static_cast<bool>(value.isUncached), pointer, pointer + size, size);
|
||||
Logger::Debug("Set CPU caching to {} at 0x{:X} - 0x{:X} (0x{:X} bytes)", !static_cast<bool>(value.isUncached), pointer, pointer + size, size);
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
}
|
||||
|
||||
@ -85,32 +85,32 @@ namespace skyline::kernel::svc {
|
||||
|
||||
if (!util::IsPageAligned(destination) || !util::IsPageAligned(source)) {
|
||||
state.ctx->gpr.w0 = result::InvalidAddress;
|
||||
state.logger->Warn("Addresses not page aligned: Source: 0x{:X}, Destination: 0x{:X} (Size: 0x{:X} bytes)", source, destination, size);
|
||||
Logger::Warn("Addresses not page aligned: Source: 0x{:X}, Destination: 0x{:X} (Size: 0x{:X} bytes)", source, destination, size);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!util::IsPageAligned(size)) {
|
||||
state.ctx->gpr.w0 = result::InvalidSize;
|
||||
state.logger->Warn("'size' {}: 0x{:X}", size ? "not page aligned" : "is zero", size);
|
||||
Logger::Warn("'size' {}: 0x{:X}", size ? "not page aligned" : "is zero", size);
|
||||
return;
|
||||
}
|
||||
|
||||
auto stack{state.process->memory.stack};
|
||||
if (!stack.IsInside(destination)) {
|
||||
state.ctx->gpr.w0 = result::InvalidMemoryRegion;
|
||||
state.logger->Warn("Destination not within stack region: Source: 0x{:X}, Destination: 0x{:X} (Size: 0x{:X} bytes)", source, destination, size);
|
||||
Logger::Warn("Destination not within stack region: Source: 0x{:X}, Destination: 0x{:X} (Size: 0x{:X} bytes)", source, destination, size);
|
||||
return;
|
||||
}
|
||||
|
||||
auto chunk{state.process->memory.Get(source)};
|
||||
if (!chunk) {
|
||||
state.ctx->gpr.w0 = result::InvalidAddress;
|
||||
state.logger->Warn("Source has no descriptor: Source: 0x{:X}, Destination: 0x{:X} (Size: 0x{:X} bytes)", source, destination, size);
|
||||
Logger::Warn("Source has no descriptor: Source: 0x{:X}, Destination: 0x{:X} (Size: 0x{:X} bytes)", source, destination, size);
|
||||
return;
|
||||
}
|
||||
if (!chunk->state.mapAllowed) {
|
||||
state.ctx->gpr.w0 = result::InvalidState;
|
||||
state.logger->Warn("Source doesn't allow usage of svcMapMemory: Source: 0x{:X}, Destination: 0x{:X}, Size: 0x{:X}, MemoryState: 0x{:X}", source, destination, size, chunk->state.value);
|
||||
Logger::Warn("Source doesn't allow usage of svcMapMemory: Source: 0x{:X}, Destination: 0x{:X}, Size: 0x{:X}, MemoryState: 0x{:X}", source, destination, size, chunk->state.value);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ namespace skyline::kernel::svc {
|
||||
throw exception("svcMapMemory: Cannot find memory object in handle table for address 0x{:X}", source);
|
||||
object->item->UpdatePermission(source, size, {false, false, false});
|
||||
|
||||
state.logger->Debug("Mapped range 0x{:X} - 0x{:X} to 0x{:X} - 0x{:X} (Size: 0x{:X} bytes)", source, source + size, destination, destination + size, size);
|
||||
Logger::Debug("Mapped range 0x{:X} - 0x{:X} to 0x{:X} - 0x{:X} (Size: 0x{:X} bytes)", source, source + size, destination, destination + size, size);
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
}
|
||||
|
||||
@ -133,20 +133,20 @@ namespace skyline::kernel::svc {
|
||||
|
||||
if (!util::IsPageAligned(destination) || !util::IsPageAligned(source)) {
|
||||
state.ctx->gpr.w0 = result::InvalidAddress;
|
||||
state.logger->Warn("Addresses not page aligned: Source: 0x{:X}, Destination: 0x{:X} (Size: 0x{:X} bytes)", source, destination, size);
|
||||
Logger::Warn("Addresses not page aligned: Source: 0x{:X}, Destination: 0x{:X} (Size: 0x{:X} bytes)", source, destination, size);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!util::IsPageAligned(size)) {
|
||||
state.ctx->gpr.w0 = result::InvalidSize;
|
||||
state.logger->Warn("'size' {}: 0x{:X}", size ? "not page aligned" : "is zero", size);
|
||||
Logger::Warn("'size' {}: 0x{:X}", size ? "not page aligned" : "is zero", size);
|
||||
return;
|
||||
}
|
||||
|
||||
auto stack{state.process->memory.stack};
|
||||
if (!stack.IsInside(source)) {
|
||||
state.ctx->gpr.w0 = result::InvalidMemoryRegion;
|
||||
state.logger->Warn("Source not within stack region: Source: 0x{:X}, Destination: 0x{:X} (Size: 0x{:X} bytes)", source, destination, size);
|
||||
Logger::Warn("Source not within stack region: Source: 0x{:X}, Destination: 0x{:X} (Size: 0x{:X} bytes)", source, destination, size);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -154,13 +154,13 @@ namespace skyline::kernel::svc {
|
||||
auto destChunk{state.process->memory.Get(destination)};
|
||||
if (!sourceChunk || !destChunk) {
|
||||
state.ctx->gpr.w0 = result::InvalidAddress;
|
||||
state.logger->Warn("Addresses have no descriptor: Source: 0x{:X}, Destination: 0x{:X} (Size: 0x{:X} bytes)", source, destination, size);
|
||||
Logger::Warn("Addresses have no descriptor: Source: 0x{:X}, Destination: 0x{:X} (Size: 0x{:X} bytes)", source, destination, size);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!destChunk->state.mapAllowed) {
|
||||
state.ctx->gpr.w0 = result::InvalidState;
|
||||
state.logger->Warn("Destination doesn't allow usage of svcMapMemory: Source: 0x{:X}, Destination: 0x{:X} (Size: 0x{:X} bytes) 0x{:X}", source, destination, size, destChunk->state.value);
|
||||
Logger::Warn("Destination doesn't allow usage of svcMapMemory: Source: 0x{:X}, Destination: 0x{:X} (Size: 0x{:X} bytes) 0x{:X}", source, destination, size, destChunk->state.value);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ namespace skyline::kernel::svc {
|
||||
|
||||
state.process->CloseHandle(sourceObject->handle);
|
||||
|
||||
state.logger->Debug("Unmapped range 0x{:X} - 0x{:X} to 0x{:X} - 0x{:X} (Size: 0x{:X} bytes)", source, source + size, destination, destination + size, size);
|
||||
Logger::Debug("Unmapped range 0x{:X} - 0x{:X} to 0x{:X} - 0x{:X} (Size: 0x{:X} bytes)", source, source + size, destination, destination + size, size);
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ namespace skyline::kernel::svc {
|
||||
.ipcRefCount = 0,
|
||||
};
|
||||
|
||||
state.logger->Debug("Address: 0x{:X}, Region Start: 0x{:X}, Size: 0x{:X}, Type: 0x{:X}, Is Uncached: {}, Permissions: {}{}{}", pointer, memInfo.address, memInfo.size, memInfo.type, static_cast<bool>(chunk->attributes.isUncached), chunk->permission.r ? 'R' : '-', chunk->permission.w ? 'W' : '-', chunk->permission.x ? 'X' : '-');
|
||||
Logger::Debug("Address: 0x{:X}, Region Start: 0x{:X}, Size: 0x{:X}, Type: 0x{:X}, Is Uncached: {}, Permissions: {}{}{}", pointer, memInfo.address, memInfo.size, memInfo.type, static_cast<bool>(chunk->attributes.isUncached), chunk->permission.r ? 'R' : '-', chunk->permission.w ? 'W' : '-', chunk->permission.x ? 'X' : '-');
|
||||
} else {
|
||||
auto addressSpaceEnd{reinterpret_cast<u64>(state.process->memory.addressSpace.address + state.process->memory.addressSpace.size)};
|
||||
|
||||
@ -209,7 +209,7 @@ namespace skyline::kernel::svc {
|
||||
.type = static_cast<u32>(memory::MemoryType::Reserved),
|
||||
};
|
||||
|
||||
state.logger->Debug("Trying to query memory outside of the application's address space: 0x{:X}", pointer);
|
||||
Logger::Debug("Trying to query memory outside of the application's address space: 0x{:X}", pointer);
|
||||
}
|
||||
|
||||
*reinterpret_cast<memory::MemoryInfo *>(state.ctx->gpr.x0) = memInfo;
|
||||
@ -218,7 +218,7 @@ namespace skyline::kernel::svc {
|
||||
}
|
||||
|
||||
void ExitProcess(const DeviceState &state) {
|
||||
state.logger->Debug("Exiting process");
|
||||
Logger::Debug("Exiting process");
|
||||
throw nce::NCE::ExitException(true);
|
||||
}
|
||||
|
||||
@ -236,13 +236,13 @@ namespace skyline::kernel::svc {
|
||||
idealCore = (idealCore == IdealCoreUseProcessValue) ? static_cast<i32>(state.process->npdm.meta.idealCore) : idealCore;
|
||||
if (idealCore < 0 || idealCore >= constant::CoreCount) {
|
||||
state.ctx->gpr.w0 = result::InvalidCoreId;
|
||||
state.logger->Warn("'idealCore' invalid: {}", idealCore);
|
||||
Logger::Warn("'idealCore' invalid: {}", idealCore);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!state.process->npdm.threadInfo.priority.Valid(priority)) {
|
||||
state.ctx->gpr.w0 = result::InvalidPriority;
|
||||
state.logger->Warn("'priority' invalid: {}", priority);
|
||||
Logger::Warn("'priority' invalid: {}", priority);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -252,12 +252,12 @@ namespace skyline::kernel::svc {
|
||||
|
||||
auto thread{state.process->CreateThread(entry, entryArgument, stackTop, priority, static_cast<u8>(idealCore))};
|
||||
if (thread) {
|
||||
state.logger->Debug("Created thread #{} with handle 0x{:X} (Entry Point: 0x{:X}, Argument: 0x{:X}, Stack Pointer: 0x{:X}, Priority: {}, Ideal Core: {})", thread->id, thread->handle, entry, entryArgument, stackTop, priority, idealCore);
|
||||
Logger::Debug("Created thread #{} with handle 0x{:X} (Entry Point: 0x{:X}, Argument: 0x{:X}, Stack Pointer: 0x{:X}, Priority: {}, Ideal Core: {})", thread->id, thread->handle, entry, entryArgument, stackTop, priority, idealCore);
|
||||
|
||||
state.ctx->gpr.w1 = thread->handle;
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
} else {
|
||||
state.logger->Debug("Cannot create thread (Entry Point: 0x{:X}, Argument: 0x{:X}, Stack Pointer: 0x{:X}, Priority: {}, Ideal Core: {})", entry, entryArgument, stackTop, priority, idealCore);
|
||||
Logger::Debug("Cannot create thread (Entry Point: 0x{:X}, Argument: 0x{:X}, Stack Pointer: 0x{:X}, Priority: {}, Ideal Core: {})", entry, entryArgument, stackTop, priority, idealCore);
|
||||
state.ctx->gpr.w1 = 0;
|
||||
state.ctx->gpr.w0 = result::OutOfResource;
|
||||
}
|
||||
@ -267,17 +267,17 @@ namespace skyline::kernel::svc {
|
||||
KHandle handle{state.ctx->gpr.w0};
|
||||
try {
|
||||
auto thread{state.process->GetHandle<type::KThread>(handle)};
|
||||
state.logger->Debug("Starting thread #{}: 0x{:X}", thread->id, handle);
|
||||
Logger::Debug("Starting thread #{}: 0x{:X}", thread->id, handle);
|
||||
thread->Start();
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
} catch (const std::out_of_range &) {
|
||||
state.logger->Warn("'handle' invalid: 0x{:X}", handle);
|
||||
Logger::Warn("'handle' invalid: 0x{:X}", handle);
|
||||
state.ctx->gpr.w0 = result::InvalidHandle;
|
||||
}
|
||||
}
|
||||
|
||||
void ExitThread(const DeviceState &state) {
|
||||
state.logger->Debug("Exiting current thread");
|
||||
Logger::Debug("Exiting current thread");
|
||||
throw nce::NCE::ExitException(false);
|
||||
}
|
||||
|
||||
@ -288,7 +288,7 @@ namespace skyline::kernel::svc {
|
||||
|
||||
i64 in{static_cast<i64>(state.ctx->gpr.x0)};
|
||||
if (in > 0) {
|
||||
state.logger->Debug("Sleeping for {}ns", in);
|
||||
Logger::Debug("Sleeping for {}ns", in);
|
||||
TRACE_EVENT("kernel", "SleepThread", "duration", in);
|
||||
|
||||
struct timespec spec{
|
||||
@ -301,7 +301,7 @@ namespace skyline::kernel::svc {
|
||||
} else {
|
||||
switch (in) {
|
||||
case yieldWithCoreMigration: {
|
||||
state.logger->Debug("Waking any appropriate parked threads and yielding");
|
||||
Logger::Debug("Waking any appropriate parked threads and yielding");
|
||||
TRACE_EVENT("kernel", "YieldWithCoreMigration");
|
||||
state.scheduler->WakeParkedThread();
|
||||
state.scheduler->Rotate();
|
||||
@ -310,7 +310,7 @@ namespace skyline::kernel::svc {
|
||||
}
|
||||
|
||||
case yieldWithoutCoreMigration: {
|
||||
state.logger->Debug("Cooperative yield");
|
||||
Logger::Debug("Cooperative yield");
|
||||
TRACE_EVENT("kernel", "YieldWithoutCoreMigration");
|
||||
state.scheduler->Rotate();
|
||||
state.scheduler->WaitSchedule();
|
||||
@ -318,7 +318,7 @@ namespace skyline::kernel::svc {
|
||||
}
|
||||
|
||||
case yieldToAnyThread: {
|
||||
state.logger->Debug("Parking current thread");
|
||||
Logger::Debug("Parking current thread");
|
||||
TRACE_EVENT("kernel", "YieldToAnyThread");
|
||||
state.scheduler->ParkThread();
|
||||
state.scheduler->WaitSchedule(false);
|
||||
@ -336,12 +336,12 @@ namespace skyline::kernel::svc {
|
||||
try {
|
||||
auto thread{state.process->GetHandle<type::KThread>(handle)};
|
||||
i8 priority{thread->priority};
|
||||
state.logger->Debug("Retrieving thread #{}'s priority: {}", thread->id, priority);
|
||||
Logger::Debug("Retrieving thread #{}'s priority: {}", thread->id, priority);
|
||||
|
||||
state.ctx->gpr.w1 = static_cast<u32>(priority);
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
} catch (const std::out_of_range &) {
|
||||
state.logger->Warn("'handle' invalid: 0x{:X}", handle);
|
||||
Logger::Warn("'handle' invalid: 0x{:X}", handle);
|
||||
state.ctx->gpr.w0 = result::InvalidHandle;
|
||||
}
|
||||
}
|
||||
@ -350,13 +350,13 @@ namespace skyline::kernel::svc {
|
||||
KHandle handle{state.ctx->gpr.w0};
|
||||
i8 priority{static_cast<i8>(state.ctx->gpr.w1)};
|
||||
if (!state.process->npdm.threadInfo.priority.Valid(priority)) {
|
||||
state.logger->Warn("'priority' invalid: 0x{:X}", priority);
|
||||
Logger::Warn("'priority' invalid: 0x{:X}", priority);
|
||||
state.ctx->gpr.w0 = result::InvalidPriority;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
auto thread{state.process->GetHandle<type::KThread>(handle)};
|
||||
state.logger->Debug("Setting thread #{}'s priority to {}", thread->id, priority);
|
||||
Logger::Debug("Setting thread #{}'s priority to {}", thread->id, priority);
|
||||
if (thread->priority != priority) {
|
||||
thread->basePriority = priority;
|
||||
i8 newPriority{};
|
||||
@ -371,7 +371,7 @@ namespace skyline::kernel::svc {
|
||||
}
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
} catch (const std::out_of_range &) {
|
||||
state.logger->Warn("'handle' invalid: 0x{:X}", handle);
|
||||
Logger::Warn("'handle' invalid: 0x{:X}", handle);
|
||||
state.ctx->gpr.w0 = result::InvalidHandle;
|
||||
}
|
||||
}
|
||||
@ -382,13 +382,13 @@ namespace skyline::kernel::svc {
|
||||
auto thread{state.process->GetHandle<type::KThread>(handle)};
|
||||
auto idealCore{thread->idealCore};
|
||||
auto affinityMask{thread->affinityMask};
|
||||
state.logger->Debug("Getting thread #{}'s Ideal Core ({}) + Affinity Mask ({})", thread->id, idealCore, affinityMask);
|
||||
Logger::Debug("Getting thread #{}'s Ideal Core ({}) + Affinity Mask ({})", thread->id, idealCore, affinityMask);
|
||||
|
||||
state.ctx->gpr.x2 = affinityMask.to_ullong();
|
||||
state.ctx->gpr.w1 = static_cast<u32>(idealCore);
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
} catch (const std::out_of_range &) {
|
||||
state.logger->Warn("'handle' invalid: 0x{:X}", handle);
|
||||
Logger::Warn("'handle' invalid: 0x{:X}", handle);
|
||||
state.ctx->gpr.w0 = result::InvalidHandle;
|
||||
}
|
||||
}
|
||||
@ -411,25 +411,25 @@ namespace skyline::kernel::svc {
|
||||
|
||||
auto processMask{state.process->npdm.threadInfo.coreMask};
|
||||
if ((processMask | affinityMask) != processMask) {
|
||||
state.logger->Warn("'affinityMask' invalid: {} (Process Mask: {})", affinityMask, processMask);
|
||||
Logger::Warn("'affinityMask' invalid: {} (Process Mask: {})", affinityMask, processMask);
|
||||
state.ctx->gpr.w0 = result::InvalidCoreId;
|
||||
return;
|
||||
}
|
||||
|
||||
if (affinityMask.none() || !affinityMask.test(static_cast<size_t>(idealCore))) {
|
||||
state.logger->Warn("'affinityMask' invalid: {} (Ideal Core: {})", affinityMask, idealCore);
|
||||
Logger::Warn("'affinityMask' invalid: {} (Ideal Core: {})", affinityMask, idealCore);
|
||||
state.ctx->gpr.w0 = result::InvalidCombination;
|
||||
return;
|
||||
}
|
||||
|
||||
state.logger->Debug("Setting thread #{}'s Ideal Core ({}) + Affinity Mask ({})", thread->id, idealCore, affinityMask);
|
||||
Logger::Debug("Setting thread #{}'s Ideal Core ({}) + Affinity Mask ({})", thread->id, idealCore, affinityMask);
|
||||
|
||||
std::lock_guard guard(thread->coreMigrationMutex);
|
||||
thread->idealCore = static_cast<u8>(idealCore);
|
||||
thread->affinityMask = affinityMask;
|
||||
|
||||
if (!affinityMask.test(static_cast<size_t>(thread->coreId)) && thread->coreId != constant::ParkedCoreId) {
|
||||
state.logger->Debug("Migrating thread #{} to Ideal Core C{} -> C{}", thread->id, thread->coreId, idealCore);
|
||||
Logger::Debug("Migrating thread #{} to Ideal Core C{} -> C{}", thread->id, thread->coreId, idealCore);
|
||||
|
||||
if (thread == state.thread) {
|
||||
state.scheduler->RemoveThread();
|
||||
@ -445,7 +445,7 @@ namespace skyline::kernel::svc {
|
||||
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
} catch (const std::out_of_range &) {
|
||||
state.logger->Warn("'handle' invalid: 0x{:X}", handle);
|
||||
Logger::Warn("'handle' invalid: 0x{:X}", handle);
|
||||
state.ctx->gpr.w0 = result::InvalidHandle;
|
||||
}
|
||||
}
|
||||
@ -453,7 +453,7 @@ namespace skyline::kernel::svc {
|
||||
void GetCurrentProcessorNumber(const DeviceState &state) {
|
||||
std::lock_guard guard(state.thread->coreMigrationMutex);
|
||||
u8 coreId{state.thread->coreId};
|
||||
state.logger->Debug("C{}", coreId);
|
||||
Logger::Debug("C{}", coreId);
|
||||
state.ctx->gpr.w0 = coreId;
|
||||
}
|
||||
|
||||
@ -462,10 +462,10 @@ namespace skyline::kernel::svc {
|
||||
TRACE_EVENT_FMT("kernel", "ClearEvent 0x{:X}", handle);
|
||||
try {
|
||||
std::static_pointer_cast<type::KEvent>(state.process->GetHandle(handle))->ResetSignal();
|
||||
state.logger->Debug("Clearing 0x{:X}", handle);
|
||||
Logger::Debug("Clearing 0x{:X}", handle);
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
} catch (const std::out_of_range &) {
|
||||
state.logger->Warn("'handle' invalid: 0x{:X}", handle);
|
||||
Logger::Warn("'handle' invalid: 0x{:X}", handle);
|
||||
state.ctx->gpr.w0 = result::InvalidHandle;
|
||||
return;
|
||||
}
|
||||
@ -479,31 +479,31 @@ namespace skyline::kernel::svc {
|
||||
|
||||
if (!util::IsPageAligned(pointer)) {
|
||||
state.ctx->gpr.w0 = result::InvalidAddress;
|
||||
state.logger->Warn("'pointer' not page aligned: 0x{:X}", pointer);
|
||||
Logger::Warn("'pointer' not page aligned: 0x{:X}", pointer);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t size{state.ctx->gpr.x2};
|
||||
if (!util::IsPageAligned(size)) {
|
||||
state.ctx->gpr.w0 = result::InvalidSize;
|
||||
state.logger->Warn("'size' {}: 0x{:X}", size ? "not page aligned" : "is zero", size);
|
||||
Logger::Warn("'size' {}: 0x{:X}", size ? "not page aligned" : "is zero", size);
|
||||
return;
|
||||
}
|
||||
|
||||
memory::Permission permission(static_cast<u8>(state.ctx->gpr.w3));
|
||||
if ((permission.w && !permission.r) || (permission.x && !permission.r)) {
|
||||
state.logger->Warn("'permission' invalid: {}{}{}", permission.r ? 'R' : '-', permission.w ? 'W' : '-', permission.x ? 'X' : '-');
|
||||
Logger::Warn("'permission' invalid: {}{}{}", permission.r ? 'R' : '-', permission.w ? 'W' : '-', permission.x ? 'X' : '-');
|
||||
state.ctx->gpr.w0 = result::InvalidNewMemoryPermission;
|
||||
return;
|
||||
}
|
||||
|
||||
state.logger->Debug("Mapping shared memory (0x{:X}) at 0x{:X} - 0x{:X} (0x{:X} bytes) ({}{}{})", handle, pointer, pointer + size, size, permission.r ? 'R' : '-', permission.w ? 'W' : '-', permission.x ? 'X' : '-');
|
||||
Logger::Debug("Mapping shared memory (0x{:X}) at 0x{:X} - 0x{:X} (0x{:X} bytes) ({}{}{})", handle, pointer, pointer + size, size, permission.r ? 'R' : '-', permission.w ? 'W' : '-', permission.x ? 'X' : '-');
|
||||
|
||||
object->Map(pointer, size, permission);
|
||||
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
} catch (const std::out_of_range &) {
|
||||
state.logger->Warn("'handle' invalid: 0x{:X}", static_cast<u32>(state.ctx->gpr.w0));
|
||||
Logger::Warn("'handle' invalid: 0x{:X}", static_cast<u32>(state.ctx->gpr.w0));
|
||||
state.ctx->gpr.w0 = result::InvalidHandle;
|
||||
}
|
||||
}
|
||||
@ -516,24 +516,24 @@ namespace skyline::kernel::svc {
|
||||
|
||||
if (!util::IsPageAligned(pointer)) {
|
||||
state.ctx->gpr.w0 = result::InvalidAddress;
|
||||
state.logger->Warn("'pointer' not page aligned: 0x{:X}", pointer);
|
||||
Logger::Warn("'pointer' not page aligned: 0x{:X}", pointer);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t size{state.ctx->gpr.x2};
|
||||
if (!util::IsPageAligned(size)) {
|
||||
state.ctx->gpr.w0 = result::InvalidSize;
|
||||
state.logger->Warn("'size' {}: 0x{:X}", size ? "not page aligned" : "is zero", size);
|
||||
Logger::Warn("'size' {}: 0x{:X}", size ? "not page aligned" : "is zero", size);
|
||||
return;
|
||||
}
|
||||
|
||||
state.logger->Debug("Unmapping shared memory (0x{:X}) at 0x{:X} - 0x{:X} (0x{:X} bytes)", handle, pointer, pointer + size, size);
|
||||
Logger::Debug("Unmapping shared memory (0x{:X}) at 0x{:X} - 0x{:X} (0x{:X} bytes)", handle, pointer, pointer + size, size);
|
||||
|
||||
object->Unmap(pointer, size);
|
||||
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
} catch (const std::out_of_range &) {
|
||||
state.logger->Warn("'handle' invalid: 0x{:X}", static_cast<u32>(state.ctx->gpr.w0));
|
||||
Logger::Warn("'handle' invalid: 0x{:X}", static_cast<u32>(state.ctx->gpr.w0));
|
||||
state.ctx->gpr.w0 = result::InvalidHandle;
|
||||
}
|
||||
}
|
||||
@ -542,26 +542,26 @@ namespace skyline::kernel::svc {
|
||||
auto pointer{reinterpret_cast<u8 *>(state.ctx->gpr.x1)};
|
||||
if (!util::IsPageAligned(pointer)) {
|
||||
state.ctx->gpr.w0 = result::InvalidAddress;
|
||||
state.logger->Warn("'pointer' not page aligned: 0x{:X}", pointer);
|
||||
Logger::Warn("'pointer' not page aligned: 0x{:X}", pointer);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t size{state.ctx->gpr.x2};
|
||||
if (!util::IsPageAligned(size)) {
|
||||
state.ctx->gpr.w0 = result::InvalidSize;
|
||||
state.logger->Warn("'size' {}: 0x{:X}", size ? "not page aligned" : "is zero", size);
|
||||
Logger::Warn("'size' {}: 0x{:X}", size ? "not page aligned" : "is zero", size);
|
||||
return;
|
||||
}
|
||||
|
||||
memory::Permission permission(static_cast<u8>(state.ctx->gpr.w3));
|
||||
if ((permission.w && !permission.r) || (permission.x && !permission.r)) {
|
||||
state.logger->Warn("'permission' invalid: {}{}{}", permission.r ? 'R' : '-', permission.w ? 'W' : '-', permission.x ? 'X' : '-');
|
||||
Logger::Warn("'permission' invalid: {}{}{}", permission.r ? 'R' : '-', permission.w ? 'W' : '-', permission.x ? 'X' : '-');
|
||||
state.ctx->gpr.w0 = result::InvalidNewMemoryPermission;
|
||||
return;
|
||||
}
|
||||
|
||||
auto tmem{state.process->NewHandle<type::KTransferMemory>(pointer, size, permission, permission.raw ? memory::states::TransferMemory : memory::states::TransferMemoryIsolated)};
|
||||
state.logger->Debug("Creating transfer memory (0x{:X}) at 0x{:X} - 0x{:X} (0x{:X} bytes) ({}{}{})", tmem.handle, pointer, pointer + size, size, permission.r ? 'R' : '-', permission.w ? 'W' : '-', permission.x ? 'X' : '-');
|
||||
Logger::Debug("Creating transfer memory (0x{:X}) at 0x{:X} - 0x{:X} (0x{:X} bytes) ({}{}{})", tmem.handle, pointer, pointer + size, size, permission.r ? 'R' : '-', permission.w ? 'W' : '-', permission.x ? 'X' : '-');
|
||||
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
state.ctx->gpr.w1 = tmem.handle;
|
||||
@ -571,10 +571,10 @@ namespace skyline::kernel::svc {
|
||||
KHandle handle{static_cast<KHandle>(state.ctx->gpr.w0)};
|
||||
try {
|
||||
state.process->CloseHandle(handle);
|
||||
state.logger->Debug("Closing 0x{:X}", handle);
|
||||
Logger::Debug("Closing 0x{:X}", handle);
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
} catch (const std::out_of_range &) {
|
||||
state.logger->Warn("'handle' invalid: 0x{:X}", handle);
|
||||
Logger::Warn("'handle' invalid: 0x{:X}", handle);
|
||||
state.ctx->gpr.w0 = result::InvalidHandle;
|
||||
}
|
||||
}
|
||||
@ -591,16 +591,16 @@ namespace skyline::kernel::svc {
|
||||
break;
|
||||
|
||||
default: {
|
||||
state.logger->Warn("'handle' type invalid: 0x{:X} ({})", handle, object->objectType);
|
||||
Logger::Warn("'handle' type invalid: 0x{:X} ({})", handle, object->objectType);
|
||||
state.ctx->gpr.w0 = result::InvalidHandle;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
state.logger->Debug("Resetting 0x{:X}", handle);
|
||||
Logger::Debug("Resetting 0x{:X}", handle);
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
} catch (const std::out_of_range &) {
|
||||
state.logger->Warn("'handle' invalid: 0x{:X}", handle);
|
||||
Logger::Warn("'handle' invalid: 0x{:X}", handle);
|
||||
state.ctx->gpr.w0 = result::InvalidHandle;
|
||||
return;
|
||||
}
|
||||
@ -630,7 +630,7 @@ namespace skyline::kernel::svc {
|
||||
break;
|
||||
|
||||
default: {
|
||||
state.logger->Debug("An invalid handle was supplied: 0x{:X}", handle);
|
||||
Logger::Debug("An invalid handle was supplied: 0x{:X}", handle);
|
||||
state.ctx->gpr.w0 = result::InvalidHandle;
|
||||
return;
|
||||
}
|
||||
@ -639,12 +639,12 @@ namespace skyline::kernel::svc {
|
||||
|
||||
i64 timeout{static_cast<i64>(state.ctx->gpr.x3)};
|
||||
if (waitHandles.size() == 1) {
|
||||
state.logger->Debug("Waiting on 0x{:X} for {}ns", waitHandles[0], timeout);
|
||||
} else if (Logger::LogLevel::Debug <= state.logger->configLevel) {
|
||||
Logger::Debug("Waiting on 0x{:X} for {}ns", waitHandles[0], timeout);
|
||||
} else if (Logger::LogLevel::Debug <= Logger::configLevel) {
|
||||
std::string handleString;
|
||||
for (const auto &handle : waitHandles)
|
||||
handleString += fmt::format("* 0x{:X}\n", handle);
|
||||
state.logger->Debug("Waiting on handles:\n{}Timeout: {}ns", handleString, timeout);
|
||||
Logger::Debug("Waiting on handles:\n{}Timeout: {}ns", handleString, timeout);
|
||||
}
|
||||
|
||||
TRACE_EVENT_FMT("kernel", waitHandles.size() == 1 ? "WaitSynchronization 0x{:X}" : "WaitSynchronizationMultiple 0x{:X}", waitHandles[0]);
|
||||
@ -659,7 +659,7 @@ namespace skyline::kernel::svc {
|
||||
u32 index{};
|
||||
for (const auto &object : objectTable) {
|
||||
if (object->signalled) {
|
||||
state.logger->Debug("Signalled 0x{:X}", waitHandles[index]);
|
||||
Logger::Debug("Signalled 0x{:X}", waitHandles[index]);
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
state.ctx->gpr.w1 = index;
|
||||
return;
|
||||
@ -668,7 +668,7 @@ namespace skyline::kernel::svc {
|
||||
}
|
||||
|
||||
if (timeout == 0) {
|
||||
state.logger->Debug("No handle is currently signalled");
|
||||
Logger::Debug("No handle is currently signalled");
|
||||
state.ctx->gpr.w0 = result::TimedOut;
|
||||
return;
|
||||
}
|
||||
@ -707,15 +707,15 @@ namespace skyline::kernel::svc {
|
||||
}
|
||||
|
||||
if (wakeObject) {
|
||||
state.logger->Debug("Signalled 0x{:X}", waitHandles[wakeIndex]);
|
||||
Logger::Debug("Signalled 0x{:X}", waitHandles[wakeIndex]);
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
state.ctx->gpr.w1 = wakeIndex;
|
||||
} else if (state.thread->cancelSync) {
|
||||
state.thread->cancelSync = false;
|
||||
state.logger->Debug("Wait has been cancelled");
|
||||
Logger::Debug("Wait has been cancelled");
|
||||
state.ctx->gpr.w0 = result::Cancelled;
|
||||
} else {
|
||||
state.logger->Debug("Wait has timed out");
|
||||
Logger::Debug("Wait has timed out");
|
||||
state.ctx->gpr.w0 = result::TimedOut;
|
||||
lock.unlock();
|
||||
state.scheduler->InsertThread(state.thread);
|
||||
@ -734,7 +734,7 @@ namespace skyline::kernel::svc {
|
||||
}
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
} catch (const std::out_of_range &) {
|
||||
state.logger->Warn("'handle' invalid: 0x{:X}", static_cast<u32>(state.ctx->gpr.w0));
|
||||
Logger::Warn("'handle' invalid: 0x{:X}", static_cast<u32>(state.ctx->gpr.w0));
|
||||
state.ctx->gpr.w0 = result::InvalidHandle;
|
||||
}
|
||||
}
|
||||
@ -742,22 +742,22 @@ namespace skyline::kernel::svc {
|
||||
void ArbitrateLock(const DeviceState &state) {
|
||||
auto mutex{reinterpret_cast<u32 *>(state.ctx->gpr.x1)};
|
||||
if (!util::IsWordAligned(mutex)) {
|
||||
state.logger->Warn("'mutex' not word aligned: 0x{:X}", mutex);
|
||||
Logger::Warn("'mutex' not word aligned: 0x{:X}", mutex);
|
||||
state.ctx->gpr.w0 = result::InvalidAddress;
|
||||
return;
|
||||
}
|
||||
|
||||
state.logger->Debug("Locking 0x{:X}", mutex);
|
||||
Logger::Debug("Locking 0x{:X}", mutex);
|
||||
|
||||
KHandle ownerHandle{state.ctx->gpr.w0};
|
||||
KHandle requesterHandle{state.ctx->gpr.w2};
|
||||
auto result{state.process->MutexLock(mutex, ownerHandle, requesterHandle)};
|
||||
if (result == Result{})
|
||||
state.logger->Debug("Locked 0x{:X}", mutex);
|
||||
Logger::Debug("Locked 0x{:X}", mutex);
|
||||
else if (result == result::InvalidCurrentMemory)
|
||||
result = Result{}; // If the mutex value isn't expected then it's still successful
|
||||
else if (result == result::InvalidHandle)
|
||||
state.logger->Warn("'ownerHandle' invalid: 0x{:X} (0x{:X})", ownerHandle, mutex);
|
||||
Logger::Warn("'ownerHandle' invalid: 0x{:X} (0x{:X})", ownerHandle, mutex);
|
||||
|
||||
state.ctx->gpr.w0 = result;
|
||||
}
|
||||
@ -765,14 +765,14 @@ namespace skyline::kernel::svc {
|
||||
void ArbitrateUnlock(const DeviceState &state) {
|
||||
auto mutex{reinterpret_cast<u32 *>(state.ctx->gpr.x0)};
|
||||
if (!util::IsWordAligned(mutex)) {
|
||||
state.logger->Warn("'mutex' not word aligned: 0x{:X}", mutex);
|
||||
Logger::Warn("'mutex' not word aligned: 0x{:X}", mutex);
|
||||
state.ctx->gpr.w0 = result::InvalidAddress;
|
||||
return;
|
||||
}
|
||||
|
||||
state.logger->Debug("Unlocking 0x{:X}", mutex);
|
||||
Logger::Debug("Unlocking 0x{:X}", mutex);
|
||||
state.process->MutexUnlock(mutex);
|
||||
state.logger->Debug("Unlocked 0x{:X}", mutex);
|
||||
Logger::Debug("Unlocked 0x{:X}", mutex);
|
||||
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
}
|
||||
@ -780,7 +780,7 @@ namespace skyline::kernel::svc {
|
||||
void WaitProcessWideKeyAtomic(const DeviceState &state) {
|
||||
auto mutex{reinterpret_cast<u32 *>(state.ctx->gpr.x0)};
|
||||
if (!util::IsWordAligned(mutex)) {
|
||||
state.logger->Warn("'mutex' not word aligned: 0x{:X}", mutex);
|
||||
Logger::Warn("'mutex' not word aligned: 0x{:X}", mutex);
|
||||
state.ctx->gpr.w0 = result::InvalidAddress;
|
||||
return;
|
||||
}
|
||||
@ -789,13 +789,13 @@ namespace skyline::kernel::svc {
|
||||
KHandle requesterHandle{state.ctx->gpr.w2};
|
||||
|
||||
i64 timeout{static_cast<i64>(state.ctx->gpr.x3)};
|
||||
state.logger->Debug("Waiting on 0x{:X} with 0x{:X} for {}ns", conditional, mutex, timeout);
|
||||
Logger::Debug("Waiting on 0x{:X} with 0x{:X} for {}ns", conditional, mutex, timeout);
|
||||
|
||||
auto result{state.process->ConditionalVariableWait(conditional, mutex, requesterHandle, timeout)};
|
||||
if (result == Result{})
|
||||
state.logger->Debug("Waited for 0x{:X} and reacquired 0x{:X}", conditional, mutex);
|
||||
Logger::Debug("Waited for 0x{:X} and reacquired 0x{:X}", conditional, mutex);
|
||||
else if (result == result::TimedOut)
|
||||
state.logger->Debug("Wait on 0x{:X} has timed out after {}ns", conditional, timeout);
|
||||
Logger::Debug("Wait on 0x{:X} has timed out after {}ns", conditional, timeout);
|
||||
state.ctx->gpr.w0 = result;
|
||||
}
|
||||
|
||||
@ -803,7 +803,7 @@ namespace skyline::kernel::svc {
|
||||
auto conditional{reinterpret_cast<u32 *>(state.ctx->gpr.x0)};
|
||||
i32 count{static_cast<i32>(state.ctx->gpr.w1)};
|
||||
|
||||
state.logger->Debug("Signalling 0x{:X} for {} waiters", conditional, count);
|
||||
Logger::Debug("Signalling 0x{:X} for {} waiters", conditional, count);
|
||||
state.process->ConditionalVariableSignal(conditional, count);
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
}
|
||||
@ -829,12 +829,12 @@ namespace skyline::kernel::svc {
|
||||
if (port.compare("sm:") >= 0) {
|
||||
handle = state.process->NewHandle<type::KSession>(std::static_pointer_cast<service::BaseService>(state.os->serviceManager.smUserInterface)).handle;
|
||||
} else {
|
||||
state.logger->Warn("Connecting to invalid port: '{}'", port);
|
||||
Logger::Warn("Connecting to invalid port: '{}'", port);
|
||||
state.ctx->gpr.w0 = result::NotFound;
|
||||
return;
|
||||
}
|
||||
|
||||
state.logger->Debug("Connecting to port '{}' at 0x{:X}", port, handle);
|
||||
Logger::Debug("Connecting to port '{}' at 0x{:X}", port, handle);
|
||||
|
||||
state.ctx->gpr.w1 = handle;
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
@ -850,7 +850,7 @@ namespace skyline::kernel::svc {
|
||||
KHandle handle{state.ctx->gpr.w1};
|
||||
size_t tid{state.process->GetHandle<type::KThread>(handle)->id};
|
||||
|
||||
state.logger->Debug("Handle: 0x{:X}, TID: {}", handle, tid);
|
||||
Logger::Debug("Handle: 0x{:X}, TID: {}", handle, tid);
|
||||
|
||||
state.ctx->gpr.x1 = tid;
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
@ -859,9 +859,9 @@ namespace skyline::kernel::svc {
|
||||
void Break(const DeviceState &state) {
|
||||
auto reason{state.ctx->gpr.x0};
|
||||
if (reason & (1ULL << 31)) {
|
||||
state.logger->Debug("Debugger is being engaged ({})", reason);
|
||||
Logger::Debug("Debugger is being engaged ({})", reason);
|
||||
} else {
|
||||
state.logger->Error("Exit Stack Trace ({}){}", reason, state.loader->GetStackTrace());
|
||||
Logger::Error("Exit Stack Trace ({}){}", reason, state.loader->GetStackTrace());
|
||||
if (state.thread->id)
|
||||
state.process->Kill(false);
|
||||
std::longjmp(state.thread->originalCtx, true);
|
||||
@ -874,7 +874,7 @@ namespace skyline::kernel::svc {
|
||||
if (string.back() == '\n')
|
||||
string.remove_suffix(1);
|
||||
|
||||
state.logger->Info("{}", string);
|
||||
Logger::Info("{}", string);
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
}
|
||||
|
||||
@ -1001,12 +1001,12 @@ namespace skyline::kernel::svc {
|
||||
break;
|
||||
|
||||
default:
|
||||
state.logger->Warn("Unimplemented case ID0: {}, ID1: {}", static_cast<u32>(info), id1);
|
||||
Logger::Warn("Unimplemented case ID0: {}, ID1: {}", static_cast<u32>(info), id1);
|
||||
state.ctx->gpr.w0 = result::InvalidEnumValue;
|
||||
return;
|
||||
}
|
||||
|
||||
state.logger->Debug("ID0: {}, ID1: {}, Out: 0x{:X}", static_cast<u32>(info), id1, out);
|
||||
Logger::Debug("ID0: {}, ID1: {}, Out: 0x{:X}", static_cast<u32>(info), id1, out);
|
||||
|
||||
state.ctx->gpr.x1 = out;
|
||||
state.ctx->gpr.w0 = Result{};
|
||||
@ -1088,7 +1088,7 @@ namespace skyline::kernel::svc {
|
||||
void WaitForAddress(const DeviceState &state) {
|
||||
auto address{reinterpret_cast<u32 *>(state.ctx->gpr.x0)};
|
||||
if (!util::IsWordAligned(address)) [[unlikely]] {
|
||||
state.logger->Warn("'address' not word aligned: 0x{:X}", address);
|
||||
Logger::Warn("'address' not word aligned: 0x{:X}", address);
|
||||
state.ctx->gpr.w0 = result::InvalidAddress;
|
||||
return;
|
||||
}
|
||||
@ -1104,14 +1104,14 @@ namespace skyline::kernel::svc {
|
||||
Result result;
|
||||
switch (arbitrationType) {
|
||||
case ArbitrationType::WaitIfLessThan:
|
||||
state.logger->Debug("Waiting on 0x{:X} if less than {} for {}ns", address, value, timeout);
|
||||
Logger::Debug("Waiting on 0x{:X} if less than {} for {}ns", address, value, timeout);
|
||||
result = state.process->WaitForAddress(address, value, timeout, [](u32 *address, u32 value) {
|
||||
return *address < value;
|
||||
});
|
||||
break;
|
||||
|
||||
case ArbitrationType::DecrementAndWaitIfLessThan:
|
||||
state.logger->Debug("Waiting on and decrementing 0x{:X} if less than {} for {}ns", address, value, timeout);
|
||||
Logger::Debug("Waiting on and decrementing 0x{:X} if less than {} for {}ns", address, value, timeout);
|
||||
result = state.process->WaitForAddress(address, value, timeout, [](u32 *address, u32 value) {
|
||||
u32 userValue{__atomic_load_n(address, __ATOMIC_SEQ_CST)};
|
||||
do {
|
||||
@ -1123,7 +1123,7 @@ namespace skyline::kernel::svc {
|
||||
break;
|
||||
|
||||
case ArbitrationType::WaitIfEqual:
|
||||
state.logger->Debug("Waiting on 0x{:X} if equal to {} for {}ns", address, value, timeout);
|
||||
Logger::Debug("Waiting on 0x{:X} if equal to {} for {}ns", address, value, timeout);
|
||||
result = state.process->WaitForAddress(address, value, timeout, [](u32 *address, u32 value) {
|
||||
return *address == value;
|
||||
});
|
||||
@ -1131,18 +1131,18 @@ namespace skyline::kernel::svc {
|
||||
|
||||
default:
|
||||
[[unlikely]]
|
||||
state.logger->Error("'arbitrationType' invalid: {}", arbitrationType);
|
||||
Logger::Error("'arbitrationType' invalid: {}", arbitrationType);
|
||||
state.ctx->gpr.w0 = result::InvalidEnumValue;
|
||||
return;
|
||||
}
|
||||
|
||||
if (result == Result{})
|
||||
[[likely]]
|
||||
state.logger->Debug("Waited on 0x{:X} successfully", address);
|
||||
Logger::Debug("Waited on 0x{:X} successfully", address);
|
||||
else if (result == result::TimedOut)
|
||||
state.logger->Debug("Wait on 0x{:X} has timed out after {}ns", address, timeout);
|
||||
Logger::Debug("Wait on 0x{:X} has timed out after {}ns", address, timeout);
|
||||
else if (result == result::InvalidState)
|
||||
state.logger->Debug("The value at 0x{:X} did not satisfy the arbitration condition", address);
|
||||
Logger::Debug("The value at 0x{:X} did not satisfy the arbitration condition", address);
|
||||
|
||||
state.ctx->gpr.w0 = result;
|
||||
}
|
||||
@ -1150,7 +1150,7 @@ namespace skyline::kernel::svc {
|
||||
void SignalToAddress(const DeviceState &state) {
|
||||
auto address{reinterpret_cast<u32 *>(state.ctx->gpr.x0)};
|
||||
if (!util::IsWordAligned(address)) [[unlikely]] {
|
||||
state.logger->Warn("'address' not word aligned: 0x{:X}", address);
|
||||
Logger::Warn("'address' not word aligned: 0x{:X}", address);
|
||||
state.ctx->gpr.w0 = result::InvalidAddress;
|
||||
return;
|
||||
}
|
||||
@ -1166,19 +1166,19 @@ namespace skyline::kernel::svc {
|
||||
Result result;
|
||||
switch (signalType) {
|
||||
case SignalType::Signal:
|
||||
state.logger->Debug("Signalling 0x{:X} for {} waiters", address, count);
|
||||
Logger::Debug("Signalling 0x{:X} for {} waiters", address, count);
|
||||
result = state.process->SignalToAddress(address, value, count);
|
||||
break;
|
||||
|
||||
case SignalType::SignalAndIncrementIfEqual:
|
||||
state.logger->Debug("Signalling 0x{:X} and incrementing if equal to {} for {} waiters", address, value, count);
|
||||
Logger::Debug("Signalling 0x{:X} and incrementing if equal to {} for {} waiters", address, value, count);
|
||||
result = state.process->SignalToAddress(address, value, count, [](u32 *address, u32 value, u32) {
|
||||
return __atomic_compare_exchange_n(address, &value, value + 1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
|
||||
});
|
||||
break;
|
||||
|
||||
case SignalType::SignalAndModifyBasedOnWaitingThreadCountIfEqual:
|
||||
state.logger->Debug("Signalling 0x{:X} and setting to waiting thread count if equal to {} for {} waiters", address, value, count);
|
||||
Logger::Debug("Signalling 0x{:X} and setting to waiting thread count if equal to {} for {} waiters", address, value, count);
|
||||
result = state.process->SignalToAddress(address, value, count, [](u32 *address, u32 value, u32 waiterCount) {
|
||||
return __atomic_compare_exchange_n(address, &value, waiterCount, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
|
||||
});
|
||||
@ -1186,16 +1186,16 @@ namespace skyline::kernel::svc {
|
||||
|
||||
default:
|
||||
[[unlikely]]
|
||||
state.logger->Error("'signalType' invalid: {}", signalType);
|
||||
Logger::Error("'signalType' invalid: {}", signalType);
|
||||
state.ctx->gpr.w0 = result::InvalidEnumValue;
|
||||
return;
|
||||
}
|
||||
|
||||
if (result == Result{})
|
||||
[[likely]]
|
||||
state.logger->Debug("Signalled 0x{:X} for {} successfully", address, count);
|
||||
Logger::Debug("Signalled 0x{:X} for {} successfully", address, count);
|
||||
else if (result == result::InvalidState)
|
||||
state.logger->Debug("The value at 0x{:X} did not satisfy the mutation condition", address);
|
||||
Logger::Debug("The value at 0x{:X} did not satisfy the mutation condition", address);
|
||||
|
||||
state.ctx->gpr.w0 = result;
|
||||
}
|
||||
|
@ -102,9 +102,9 @@ namespace skyline::kernel::type {
|
||||
constexpr memory::Permission UnborrowPermission{true, true, false};
|
||||
|
||||
if (mmap(guest.ptr, guest.size, UnborrowPermission.Get(), MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0) == MAP_FAILED)
|
||||
state.logger->Warn("An error occurred while remapping transfer memory as anonymous memory in guest: {}", strerror(errno));
|
||||
Logger::Warn("An error occurred while remapping transfer memory as anonymous memory in guest: {}", strerror(errno));
|
||||
else if (!host.Valid())
|
||||
state.logger->Warn("Expected host mapping of transfer memory to be valid during KTransferMemory destruction");
|
||||
Logger::Warn("Expected host mapping of transfer memory to be valid during KTransferMemory destruction");
|
||||
|
||||
std::memcpy(guest.ptr, host.ptr, host.size);
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace skyline::kernel::type {
|
||||
std::array<char, 16> threadName;
|
||||
pthread_getname_np(pthread, threadName.data(), threadName.size());
|
||||
pthread_setname_np(pthread, fmt::format("HOS-{}", id).c_str());
|
||||
state.logger->UpdateTag();
|
||||
Logger::UpdateTag();
|
||||
|
||||
if (!ctx.tpidrroEl0)
|
||||
ctx.tpidrroEl0 = parent->AllocateTlsSlot();
|
||||
@ -61,7 +61,7 @@ namespace skyline::kernel::type {
|
||||
|
||||
if (threadName[0] != 'H' || threadName[1] != 'O' || threadName[2] != 'S' || threadName[3] != '-') {
|
||||
pthread_setname_np(pthread, threadName.data());
|
||||
state.logger->UpdateTag();
|
||||
Logger::UpdateTag();
|
||||
}
|
||||
|
||||
return;
|
||||
@ -176,7 +176,7 @@ namespace skyline::kernel::type {
|
||||
|
||||
__builtin_unreachable();
|
||||
} catch (const std::exception &e) {
|
||||
state.logger->Error(e.what());
|
||||
Logger::Error(e.what());
|
||||
if (id) {
|
||||
signal::BlockSignal({SIGINT});
|
||||
state.process->Kill(false);
|
||||
@ -185,7 +185,7 @@ namespace skyline::kernel::type {
|
||||
std::longjmp(originalCtx, true);
|
||||
} catch (const signal::SignalException &e) {
|
||||
if (e.signal != SIGINT) {
|
||||
state.logger->Error(e.what());
|
||||
Logger::Error(e.what());
|
||||
if (id) {
|
||||
signal::BlockSignal({SIGINT});
|
||||
state.process->Kill(false);
|
||||
|
@ -27,16 +27,16 @@ namespace skyline::loader {
|
||||
auto size{patch.size + textSize + roSize + dataSize};
|
||||
|
||||
process->NewHandle<kernel::type::KPrivateMemory>(base, patch.size, memory::Permission{false, false, false}, memory::states::Reserved); // ---
|
||||
state.logger->Debug("Successfully mapped section .patch @ 0x{:X}, Size = 0x{:X}", base, patch.size);
|
||||
Logger::Debug("Successfully mapped section .patch @ 0x{:X}, Size = 0x{:X}", base, patch.size);
|
||||
|
||||
process->NewHandle<kernel::type::KPrivateMemory>(base + patch.size + executable.text.offset, textSize, memory::Permission{true, false, true}, memory::states::CodeStatic); // R-X
|
||||
state.logger->Debug("Successfully mapped section .text @ 0x{:X}, Size = 0x{:X}", base + patch.size + executable.text.offset, textSize);
|
||||
Logger::Debug("Successfully mapped section .text @ 0x{:X}, Size = 0x{:X}", base + patch.size + executable.text.offset, textSize);
|
||||
|
||||
process->NewHandle<kernel::type::KPrivateMemory>(base + patch.size + executable.ro.offset, roSize, memory::Permission{true, false, false}, memory::states::CodeStatic); // R--
|
||||
state.logger->Debug("Successfully mapped section .rodata @ 0x{:X}, Size = 0x{:X}", base + patch.size + executable.ro.offset, roSize);
|
||||
Logger::Debug("Successfully mapped section .rodata @ 0x{:X}, Size = 0x{:X}", base + patch.size + executable.ro.offset, roSize);
|
||||
|
||||
process->NewHandle<kernel::type::KPrivateMemory>(base + patch.size + executable.data.offset, dataSize, memory::Permission{true, true, false}, memory::states::CodeMutable); // RW-
|
||||
state.logger->Debug("Successfully mapped section .data + .bss @ 0x{:X}, Size = 0x{:X}", base + patch.size + executable.data.offset, dataSize);
|
||||
Logger::Debug("Successfully mapped section .data + .bss @ 0x{:X}, Size = 0x{:X}", base + patch.size + executable.data.offset, dataSize);
|
||||
|
||||
state.nce->PatchCode(executable.text.contents, reinterpret_cast<u32 *>(base), patch.size, patch.offsets);
|
||||
std::memcpy(base + patch.size + executable.text.offset, executable.text.contents.data(), textSize);
|
||||
|
@ -28,7 +28,7 @@ namespace skyline::loader {
|
||||
u8 *base{loadInfo.base};
|
||||
void *entry{loadInfo.entry};
|
||||
|
||||
state.logger->Info("Loaded 'rtld.nso' at 0x{:X} (.text @ 0x{:X})", base, entry);
|
||||
Logger::Info("Loaded 'rtld.nso' at 0x{:X} (.text @ 0x{:X})", base, entry);
|
||||
|
||||
for (const auto &nso : {"main", "subsdk0", "subsdk1", "subsdk2", "subsdk3", "subsdk4", "subsdk5", "subsdk6", "subsdk7", "sdk"}) {
|
||||
if (exeFs->FileExists(nso))
|
||||
@ -37,7 +37,7 @@ namespace skyline::loader {
|
||||
continue;
|
||||
|
||||
loadInfo = NsoLoader::LoadNso(loader, nsoFile, process, state, offset, nso + std::string(".nso"));
|
||||
state.logger->Info("Loaded '{}.nso' at 0x{:X} (.text @ 0x{:X})", nso, base + offset, loadInfo.entry);
|
||||
Logger::Info("Loaded '{}.nso' at 0x{:X} (.text @ 0x{:X})", nso, base + offset, loadInfo.entry);
|
||||
offset += loadInfo.size;
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ namespace skyline::loader {
|
||||
}
|
||||
|
||||
void *NcaLoader::LoadProcessData(const std::shared_ptr<kernel::type::KProcess> &process, const DeviceState &state) {
|
||||
process->npdm = vfs::NPDM(nca.exeFs->OpenFile("main.npdm"), state);
|
||||
process->npdm = vfs::NPDM(nca.exeFs->OpenFile("main.npdm"));
|
||||
return LoadExeFs(this, nca.exeFs, process, state);
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace skyline::loader {
|
||||
}
|
||||
|
||||
void *NspLoader::LoadProcessData(const std::shared_ptr<kernel::type::KProcess> &process, const DeviceState &state) {
|
||||
process->npdm = vfs::NPDM(programNca->exeFs->OpenFile("main.npdm"), state);
|
||||
process->npdm = vfs::NPDM(programNca->exeFs->OpenFile("main.npdm"));
|
||||
return NcaLoader::LoadExeFs(this, programNca->exeFs, process, state);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace skyline::loader {
|
||||
}
|
||||
|
||||
void *XciLoader::LoadProcessData(const std::shared_ptr<kernel::type::KProcess> &process, const DeviceState &state) {
|
||||
process->npdm = vfs::NPDM(programNca->exeFs->OpenFile("main.npdm"), state);
|
||||
process->npdm = vfs::NPDM(programNca->exeFs->OpenFile("main.npdm"));
|
||||
return NcaLoader::LoadExeFs(this, programNca->exeFs, process, state);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace skyline::nce {
|
||||
}
|
||||
} catch (const signal::SignalException &e) {
|
||||
if (e.signal != SIGINT) {
|
||||
state.logger->ErrorNoPrefix("{} (SVC: {})\nStack Trace:{}", e.what(), svc.name, state.loader->GetStackTrace(e.frames));
|
||||
Logger::ErrorNoPrefix("{} (SVC: {})\nStack Trace:{}", e.what(), svc.name, state.loader->GetStackTrace(e.frames));
|
||||
if (state.thread->id) {
|
||||
signal::BlockSignal({SIGINT});
|
||||
state.process->Kill(false);
|
||||
@ -56,9 +56,9 @@ namespace skyline::nce {
|
||||
std::longjmp(state.thread->originalCtx, true);
|
||||
} catch (const std::exception &e) {
|
||||
if (svc)
|
||||
state.logger->ErrorNoPrefix("{} (SVC: {})\nStack Trace:{}", e.what(), svc.name, state.loader->GetStackTrace());
|
||||
Logger::ErrorNoPrefix("{} (SVC: {})\nStack Trace:{}", e.what(), svc.name, state.loader->GetStackTrace());
|
||||
else
|
||||
state.logger->ErrorNoPrefix("{} (SVC: 0x{:X})\nStack Trace:{}", e.what(), svcId, state.loader->GetStackTrace());
|
||||
Logger::ErrorNoPrefix("{} (SVC: 0x{:X})\nStack Trace:{}", e.what(), svcId, state.loader->GetStackTrace());
|
||||
|
||||
if (state.thread->id) {
|
||||
signal::BlockSignal({SIGINT});
|
||||
@ -87,7 +87,7 @@ namespace skyline::nce {
|
||||
for (u8 index{}; index < (sizeof(mcontext_t::regs) / sizeof(u64)); index += 2)
|
||||
cpuContext += fmt::format("\n X{:<2}: 0x{:<16X} X{:<2}: 0x{:X}", index, mctx.regs[index], index + 1, mctx.regs[index + 1]);
|
||||
|
||||
state.logger->Error("Thread #{} has crashed due to signal: {}\nStack Trace:{}\nCPU Context:{}", state.thread->id, strsignal(signal), trace, cpuContext);
|
||||
Logger::Error("Thread #{} has crashed due to signal: {}\nStack Trace:{}\nCPU Context:{}", state.thread->id, strsignal(signal), trace, cpuContext);
|
||||
|
||||
if (state.thread->id) {
|
||||
signal::BlockSignal({SIGINT});
|
||||
|
@ -54,7 +54,7 @@ namespace skyline::kernel {
|
||||
process->InitializeHeapTls();
|
||||
auto thread{process->CreateThread(entry)};
|
||||
if (thread) {
|
||||
state.logger->Debug("Starting main HOS thread");
|
||||
Logger::Debug("Starting main HOS thread");
|
||||
thread->Start(true);
|
||||
process->Kill(true, true, true);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace skyline::service::am {
|
||||
stateChangeEvent->Signal();
|
||||
|
||||
KHandle handle{state.process->InsertItem(stateChangeEvent)};
|
||||
state.logger->Debug("Applet State Change Event Handle: 0x{:X}", handle);
|
||||
Logger::Debug("Applet State Change Event Handle: 0x{:X}", handle);
|
||||
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
|
@ -103,7 +103,7 @@ namespace skyline::service::am {
|
||||
if (width > MaximumFbWidth || height > MaximumFbHeight || !util::IsAligned(transferMemorySize, RequiredFbAlignment))
|
||||
return result::InvalidParameters;
|
||||
|
||||
state.logger->Debug("Dimensions: ({}, {}) Transfer Memory Size: {}", width, height, transferMemorySize);
|
||||
Logger::Debug("Dimensions: ({}, {}) Transfer Memory Size: {}", width, height, transferMemorySize);
|
||||
|
||||
return {};
|
||||
}
|
||||
@ -122,19 +122,19 @@ namespace skyline::service::am {
|
||||
if (y < 0 || x < 0 || width < 1 || height < 1)
|
||||
return result::InvalidParameters;
|
||||
|
||||
state.logger->Debug("Position: ({}, {}) Dimensions: ({}, {}) Origin mode: {}", x, y, width, height, static_cast<i32>(originMode));
|
||||
Logger::Debug("Position: ({}, {}) Dimensions: ({}, {}) Origin mode: {}", x, y, width, height, static_cast<i32>(originMode));
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IApplicationFunctions::SetApplicationCopyrightVisibility(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
u8 visiblity{request.Pop<u8>()};
|
||||
state.logger->Debug("Visiblity: {}", visiblity);
|
||||
Logger::Debug("Visiblity: {}", visiblity);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IApplicationFunctions::GetGpuErrorDetectedSystemEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto handle{state.process->InsertItem(gpuErrorEvent)};
|
||||
state.logger->Debug("GPU Error Event Handle: 0x{:X}", handle);
|
||||
Logger::Debug("GPU Error Event Handle: 0x{:X}", handle);
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
}
|
||||
|
@ -13,13 +13,13 @@ namespace skyline::service::am {
|
||||
|
||||
ICommonStateGetter::ICommonStateGetter(const DeviceState &state, ServiceManager &manager) : messageEvent(std::make_shared<type::KEvent>(state, false)), BaseService(state, manager) {
|
||||
operationMode = static_cast<OperationMode>(state.settings->operationMode);
|
||||
state.logger->Info("Switch to mode: {}", static_cast<bool>(operationMode) ? "Docked" : "Handheld");
|
||||
Logger::Info("Switch to mode: {}", static_cast<bool>(operationMode) ? "Docked" : "Handheld");
|
||||
QueueMessage(Message::FocusStateChange);
|
||||
}
|
||||
|
||||
Result ICommonStateGetter::GetEventHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto handle{state.process->InsertItem(messageEvent)};
|
||||
state.logger->Debug("Applet Event Handle: 0x{:X}", handle);
|
||||
Logger::Debug("Applet Event Handle: 0x{:X}", handle);
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace skyline::service::am {
|
||||
libraryAppletLaunchableEvent->Signal();
|
||||
|
||||
KHandle handle{state.process->InsertItem(libraryAppletLaunchableEvent)};
|
||||
state.logger->Debug("Library Applet Launchable Event Handle: 0x{:X}", handle);
|
||||
Logger::Debug("Library Applet Launchable Event Handle: 0x{:X}", handle);
|
||||
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
@ -57,7 +57,7 @@ namespace skyline::service::am {
|
||||
|
||||
Result ISelfController::CreateManagedDisplayLayer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto layerId{hosbinder->CreateLayer(hosbinder::DisplayId::Default)};
|
||||
state.logger->Debug("Creating Managed Layer #{} on 'Default' Display", layerId);
|
||||
Logger::Debug("Creating Managed Layer #{} on 'Default' Display", layerId);
|
||||
response.Push(layerId);
|
||||
return {};
|
||||
}
|
||||
@ -70,7 +70,7 @@ namespace skyline::service::am {
|
||||
|
||||
Result ISelfController::GetAccumulatedSuspendedTickChangedEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto handle{state.process->InsertItem(accumulatedSuspendedTickChangedEvent)};
|
||||
state.logger->Debug("Accumulated Suspended Tick Event Handle: 0x{:X}", handle);
|
||||
Logger::Debug("Accumulated Suspended Tick Event Handle: 0x{:X}", handle);
|
||||
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
|
@ -10,7 +10,7 @@ namespace skyline::service::apm {
|
||||
auto mode{request.Pop<u32>()};
|
||||
auto config{request.Pop<u32>()};
|
||||
performanceConfig.at(mode) = config;
|
||||
state.logger->Info("Performance configuration set to 0x{:X} ({})", config, mode ? "Docked" : "Handheld");
|
||||
Logger::Info("Performance configuration set to 0x{:X} ({})", config, mode ? "Docked" : "Handheld");
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace skyline::service::audio {
|
||||
|
||||
Result IAudioDevice::QueryAudioDeviceSystemEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto handle{state.process->InsertItem(systemEvent)};
|
||||
state.logger->Debug("Audio Device System Event Handle: 0x{:X}", handle);
|
||||
Logger::Debug("Audio Device System Event Handle: 0x{:X}", handle);
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
}
|
||||
|
@ -23,13 +23,13 @@ namespace skyline::service::audio {
|
||||
}
|
||||
|
||||
Result IAudioOut::StartAudioOut(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
state.logger->Debug("Start playback");
|
||||
Logger::Debug("Start playback");
|
||||
track->Start();
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IAudioOut::StopAudioOut(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
state.logger->Debug("Stop playback");
|
||||
Logger::Debug("Stop playback");
|
||||
track->Stop();
|
||||
return {};
|
||||
}
|
||||
@ -44,7 +44,7 @@ namespace skyline::service::audio {
|
||||
} &data{request.inputBuf.at(0).as<Data>()};
|
||||
auto tag{request.Pop<u64>()};
|
||||
|
||||
state.logger->Debug("Appending buffer at 0x{:X}, Size: 0x{:X}", data.sampleBuffer, data.sampleSize);
|
||||
Logger::Debug("Appending buffer at 0x{:X}, Size: 0x{:X}", data.sampleBuffer, data.sampleSize);
|
||||
|
||||
span samples(data.sampleBuffer, data.sampleSize / sizeof(i16));
|
||||
if (sampleRate != constant::SampleRate) {
|
||||
@ -59,7 +59,7 @@ namespace skyline::service::audio {
|
||||
|
||||
Result IAudioOut::RegisterBufferEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto handle{state.process->InsertItem(releaseEvent)};
|
||||
state.logger->Debug("Buffer Release Event Handle: 0x{:X}", handle);
|
||||
Logger::Debug("Buffer Release Event Handle: 0x{:X}", handle);
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace skyline::service::audio {
|
||||
auto sampleRate{request.Pop<u32>()};
|
||||
auto channelCount{static_cast<u16>(request.Pop<u32>())};
|
||||
|
||||
state.logger->Debug("Opening an IAudioOut with sample rate: {}, channel count: {}", sampleRate, channelCount);
|
||||
Logger::Debug("Opening an IAudioOut with sample rate: {}, channel count: {}", sampleRate, channelCount);
|
||||
|
||||
sampleRate = sampleRate ? sampleRate : constant::SampleRate;
|
||||
channelCount = channelCount ? channelCount : constant::ChannelCount;
|
||||
|
@ -173,7 +173,7 @@ namespace skyline::service::audio::IAudioRenderer {
|
||||
|
||||
Result IAudioRenderer::QuerySystemEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto handle{state.process->InsertItem(systemEvent)};
|
||||
state.logger->Debug("System Event Handle: 0x{:X}", handle);
|
||||
Logger::Debug("System Event Handle: 0x{:X}", handle);
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ namespace skyline::service::audio {
|
||||
Result IAudioRendererManager::OpenAudioRenderer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
IAudioRenderer::AudioRendererParameters params{request.Pop<IAudioRenderer::AudioRendererParameters>()};
|
||||
|
||||
state.logger->Debug("Opening a rev {} IAudioRenderer with sample rate: {}, voice count: {}, effect count: {}", IAudioRenderer::ExtractVersionFromRevision(params.revision), params.sampleRate, params.voiceCount, params.effectCount);
|
||||
Logger::Debug("Opening a rev {} IAudioRenderer with sample rate: {}, voice count: {}, effect count: {}", IAudioRenderer::ExtractVersionFromRevision(params.revision), params.sampleRate, params.voiceCount, params.effectCount);
|
||||
|
||||
manager.RegisterService(std::make_shared<IAudioRenderer::IAudioRenderer>(state, manager, params), session, response);
|
||||
|
||||
@ -78,7 +78,7 @@ namespace skyline::service::audio {
|
||||
|
||||
size = util::AlignUp(size, 0x1000);
|
||||
|
||||
state.logger->Debug("Work buffer size: 0x{:X}", size);
|
||||
Logger::Debug("Work buffer size: 0x{:X}", size);
|
||||
response.Push<u64>(size);
|
||||
return {};
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ namespace skyline::service {
|
||||
ServiceFunctionDescriptor function;
|
||||
try {
|
||||
function = GetServiceFunction(request.payload->value);
|
||||
state.logger->DebugNoPrefix("Service: {}", function.name);
|
||||
Logger::DebugNoPrefix("Service: {}", function.name);
|
||||
} catch (const std::out_of_range &) {
|
||||
state.logger->Warn("Cannot find function in service '{0}': 0x{1:X} ({1})", GetName(), static_cast<u32>(request.payload->value));
|
||||
Logger::Warn("Cannot find function in service '{0}': 0x{1:X} ({1})", GetName(), static_cast<u32>(request.payload->value));
|
||||
return {};
|
||||
}
|
||||
TRACE_EVENT("service", perfetto::StaticString{function.name});
|
||||
|
@ -19,7 +19,7 @@ namespace skyline::service::codec {
|
||||
u32 workBufferSize{request.Pop<u32>()};
|
||||
KHandle workBuffer{request.copyHandles.at(0)};
|
||||
|
||||
state.logger->Debug("Creating Opus decoder: Sample rate: {}, Channel count: {}, Work buffer handle: 0x{:X} (Size: 0x{:X})", sampleRate, channelCount, workBuffer, workBufferSize);
|
||||
Logger::Debug("Creating Opus decoder: Sample rate: {}, Channel count: {}, Work buffer handle: 0x{:X} (Size: 0x{:X})", sampleRate, channelCount, workBuffer, workBufferSize);
|
||||
|
||||
manager.RegisterService(std::make_shared<IHardwareOpusDecoder>(state, manager, sampleRate, channelCount, workBufferSize, workBuffer), session, response);
|
||||
return {};
|
||||
|
@ -11,7 +11,7 @@ namespace skyline::service::friends {
|
||||
|
||||
Result INotificationService::GetEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
KHandle handle{state.process->InsertItem(notificationEvent)};
|
||||
state.logger->Debug("Friend Notification Event Handle: 0x{:X}", handle);
|
||||
Logger::Debug("Friend Notification Event Handle: 0x{:X}", handle);
|
||||
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
|
@ -16,12 +16,12 @@ namespace skyline::service::fssrv {
|
||||
auto size{request.Pop<i64>()};
|
||||
|
||||
if (offset < 0) {
|
||||
state.logger->Warn("Trying to read a file with a negative offset");
|
||||
Logger::Warn("Trying to read a file with a negative offset");
|
||||
return result::InvalidOffset;
|
||||
}
|
||||
|
||||
if (size < 0) {
|
||||
state.logger->Warn("Trying to read a file with a negative size");
|
||||
Logger::Warn("Trying to read a file with a negative size");
|
||||
return result::InvalidSize;
|
||||
}
|
||||
|
||||
@ -36,22 +36,22 @@ namespace skyline::service::fssrv {
|
||||
auto size{request.Pop<i64>()};
|
||||
|
||||
if (offset < 0) {
|
||||
state.logger->Warn("Trying to write to a file with a negative offset");
|
||||
Logger::Warn("Trying to write to a file with a negative offset");
|
||||
return result::InvalidOffset;
|
||||
}
|
||||
|
||||
if (size < 0) {
|
||||
state.logger->Warn("Trying to write to a file with a negative size");
|
||||
Logger::Warn("Trying to write to a file with a negative size");
|
||||
return result::InvalidSize;
|
||||
}
|
||||
|
||||
if (request.inputBuf.at(0).size() < size) {
|
||||
state.logger->Warn("The input buffer is not large enough to fit the requested size");
|
||||
Logger::Warn("The input buffer is not large enough to fit the requested size");
|
||||
return result::InvalidSize;
|
||||
}
|
||||
|
||||
if (backing->Write(request.inputBuf.at(0), static_cast<size_t>(offset)) != size) {
|
||||
state.logger->Warn("Failed to write all data to the backing");
|
||||
Logger::Warn("Failed to write all data to the backing");
|
||||
return result::UnexpectedFailure;
|
||||
}
|
||||
|
||||
|
@ -12,12 +12,12 @@ namespace skyline::service::fssrv {
|
||||
auto size{request.Pop<i64>()};
|
||||
|
||||
if (offset < 0) {
|
||||
state.logger->Warn("Trying to read a file with a negative offset");
|
||||
Logger::Warn("Trying to read a file with a negative offset");
|
||||
return result::InvalidOffset;
|
||||
}
|
||||
|
||||
if (size < 0) {
|
||||
state.logger->Warn("Trying to read a file with a negative size");
|
||||
Logger::Warn("Trying to read a file with a negative size");
|
||||
return result::InvalidSize;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ namespace skyline::service::glue {
|
||||
|
||||
Result ITimeZoneService::GetDeviceLocationNameOperationEventReadableHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto handle{state.process->InsertItem(locationNameUpdateEvent)};
|
||||
state.logger->Debug("Location Name Update Event Handle: 0x{:X}", handle);
|
||||
Logger::Debug("Location Name Update Event Handle: 0x{:X}", handle);
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace skyline::service::hid {
|
||||
|
||||
Result IAppletResource::GetSharedMemoryHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto handle{state.process->InsertItem<type::KSharedMemory>(state.input->kHid)};
|
||||
state.logger->Debug("HID Shared Memory Handle: 0x{:X}", handle);
|
||||
Logger::Debug("HID Shared Memory Handle: 0x{:X}", handle);
|
||||
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
|
@ -31,7 +31,7 @@ namespace skyline::service::hid {
|
||||
state.input->npad.styles = styleSet;
|
||||
state.input->npad.Update();
|
||||
|
||||
state.logger->Debug("Controller Support:\nPro-Controller: {}\nJoy-Con: Handheld: {}, Dual: {}, L: {}, R: {}\nGameCube: {}\nPokeBall: {}\nNES: {}, NES Handheld: {}, SNES: {}", static_cast<bool>(styleSet.proController), static_cast<bool>(styleSet.joyconHandheld), static_cast<bool>(styleSet.joyconDual), static_cast<bool>(styleSet.joyconLeft), static_cast<bool>
|
||||
Logger::Debug("Controller Support:\nPro-Controller: {}\nJoy-Con: Handheld: {}, Dual: {}, L: {}, R: {}\nGameCube: {}\nPokeBall: {}\nNES: {}, NES Handheld: {}, SNES: {}", static_cast<bool>(styleSet.proController), static_cast<bool>(styleSet.joyconHandheld), static_cast<bool>(styleSet.joyconDual), static_cast<bool>(styleSet.joyconLeft), static_cast<bool>
|
||||
(styleSet.joyconRight), static_cast<bool>(styleSet.gamecube), static_cast<bool>(styleSet.palma), static_cast<bool>(styleSet.nes), static_cast<bool>(styleSet.nesHandheld), static_cast<bool>(styleSet.snes));
|
||||
return {};
|
||||
}
|
||||
@ -63,7 +63,7 @@ namespace skyline::service::hid {
|
||||
auto id{request.Pop<NpadId>()};
|
||||
auto handle{state.process->InsertItem(state.input->npad.at(id).updateEvent)};
|
||||
|
||||
state.logger->Debug("Npad {} Style Set Update Event Handle: 0x{:X}", id, handle);
|
||||
Logger::Debug("Npad {} Style Set Update Event Handle: 0x{:X}", id, handle);
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
}
|
||||
@ -147,7 +147,7 @@ namespace skyline::service::hid {
|
||||
auto &device{state.input->npad.at(handle.id)};
|
||||
if (device.type == handle.GetType()) {
|
||||
const auto &value{request.Pop<NpadVibrationValue>()};
|
||||
state.logger->Debug("Vibration - Handle: 0x{:02X} (0b{:05b}), Vibration: {:.2f}@{:.2f}Hz, {:.2f}@{:.2f}Hz", static_cast<u8>(handle.id), static_cast<u8>(handle.type), value.amplitudeLow, value.frequencyLow, value.amplitudeHigh, value.frequencyHigh);
|
||||
Logger::Debug("Vibration - Handle: 0x{:02X} (0b{:05b}), Vibration: {:.2f}@{:.2f}Hz, {:.2f}@{:.2f}Hz", static_cast<u8>(handle.id), static_cast<u8>(handle.type), value.amplitudeLow, value.frequencyLow, value.amplitudeHigh, value.frequencyHigh);
|
||||
device.VibrateSingle(handle.isRight, value);
|
||||
}
|
||||
|
||||
@ -165,13 +165,13 @@ namespace skyline::service::hid {
|
||||
auto &device{state.input->npad.at(handle.id)};
|
||||
if (device.type == handle.GetType()) {
|
||||
if (i + 1 != handles.size() && handles[i + 1].id == handle.id && handles[i + 1].isRight && !handle.isRight) {
|
||||
state.logger->Debug("Vibration #{}&{} - Handle: 0x{:02X} (0b{:05b}), Vibration: {:.2f}@{:.2f}Hz, {:.2f}@{:.2f}Hz - {:.2f}@{:.2f}Hz, {:.2f}@{:.2f}Hz", i, i + 1, static_cast<u8>(handle.id), static_cast<u8>(handle.type), values[i].amplitudeLow, values[i].frequencyLow, values[i].amplitudeHigh, values[i].frequencyHigh, values[i + 1].amplitudeLow, values[i + 1].frequencyLow, values[i + 1]
|
||||
Logger::Debug("Vibration #{}&{} - Handle: 0x{:02X} (0b{:05b}), Vibration: {:.2f}@{:.2f}Hz, {:.2f}@{:.2f}Hz - {:.2f}@{:.2f}Hz, {:.2f}@{:.2f}Hz", i, i + 1, static_cast<u8>(handle.id), static_cast<u8>(handle.type), values[i].amplitudeLow, values[i].frequencyLow, values[i].amplitudeHigh, values[i].frequencyHigh, values[i + 1].amplitudeLow, values[i + 1].frequencyLow, values[i + 1]
|
||||
.amplitudeHigh, values[i + 1].frequencyHigh);
|
||||
device.Vibrate(values[i], values[i + 1]);
|
||||
i++;
|
||||
} else {
|
||||
const auto &value{values[i]};
|
||||
state.logger->Debug("Vibration #{} - Handle: 0x{:02X} (0b{:05b}), Vibration: {:.2f}@{:.2f}Hz, {:.2f}@{:.2f}Hz", i, static_cast<u8>(handle.id), static_cast<u8>(handle.type), value.amplitudeLow, value.frequencyLow, value.amplitudeHigh, value.frequencyHigh);
|
||||
Logger::Debug("Vibration #{} - Handle: 0x{:02X} (0b{:05b}), Vibration: {:.2f}@{:.2f}Hz, {:.2f}@{:.2f}Hz", i, static_cast<u8>(handle.id), static_cast<u8>(handle.type), value.amplitudeLow, value.frequencyLow, value.amplitudeHigh, value.frequencyHigh);
|
||||
device.VibrateSingle(handle.isRight, value);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace skyline::service::hosbinder {
|
||||
AndroidStatus GraphicBufferProducer::RequestBuffer(i32 slot, GraphicBuffer *&buffer) {
|
||||
std::scoped_lock lock(mutex);
|
||||
if (slot < 0 || slot >= queue.size()) [[unlikely]] {
|
||||
state.logger->Warn("#{} was out of range", slot);
|
||||
Logger::Warn("#{} was out of range", slot);
|
||||
return AndroidStatus::BadValue;
|
||||
}
|
||||
|
||||
@ -38,20 +38,20 @@ namespace skyline::service::hosbinder {
|
||||
bufferSlot.wasBufferRequested = true;
|
||||
buffer = bufferSlot.graphicBuffer.get();
|
||||
|
||||
state.logger->Debug("#{}", slot);
|
||||
Logger::Debug("#{}", slot);
|
||||
return AndroidStatus::Ok;
|
||||
}
|
||||
|
||||
AndroidStatus GraphicBufferProducer::SetBufferCount(i32 count) {
|
||||
std::scoped_lock lock(mutex);
|
||||
if (count >= MaxSlotCount) [[unlikely]] {
|
||||
state.logger->Warn("Setting buffer count too high: {} (Max: {})", count, MaxSlotCount);
|
||||
Logger::Warn("Setting buffer count too high: {} (Max: {})", count, MaxSlotCount);
|
||||
return AndroidStatus::BadValue;
|
||||
}
|
||||
|
||||
for (auto it{queue.begin()}; it != queue.end(); it++) {
|
||||
if (it->state == BufferState::Dequeued) {
|
||||
state.logger->Warn("Cannot set buffer count as #{} is dequeued", std::distance(queue.begin(), it));
|
||||
Logger::Warn("Cannot set buffer count as #{} is dequeued", std::distance(queue.begin(), it));
|
||||
return AndroidStatus::BadValue;
|
||||
}
|
||||
}
|
||||
@ -74,7 +74,7 @@ namespace skyline::service::hosbinder {
|
||||
slot.graphicBuffer = nullptr;
|
||||
}
|
||||
} else if (preallocatedBufferCount < count) {
|
||||
state.logger->Warn("Setting the active slot count ({}) higher than the amount of slots with preallocated buffers ({})", count, preallocatedBufferCount);
|
||||
Logger::Warn("Setting the active slot count ({}) higher than the amount of slots with preallocated buffers ({})", count, preallocatedBufferCount);
|
||||
}
|
||||
|
||||
activeSlotCount = static_cast<u8>(count);
|
||||
@ -85,7 +85,7 @@ namespace skyline::service::hosbinder {
|
||||
|
||||
AndroidStatus GraphicBufferProducer::DequeueBuffer(bool async, u32 width, u32 height, AndroidPixelFormat format, u32 usage, i32 &slot, std::optional<AndroidFence> &fence) {
|
||||
if ((width && !height) || (!width && height)) {
|
||||
state.logger->Warn("Dimensions {}x{} should be uniformly zero or non-zero", width, height);
|
||||
Logger::Warn("Dimensions {}x{} should be uniformly zero or non-zero", width, height);
|
||||
return AndroidStatus::BadValue;
|
||||
}
|
||||
|
||||
@ -114,14 +114,14 @@ namespace skyline::service::hosbinder {
|
||||
} else if (async) {
|
||||
return AndroidStatus::WouldBlock;
|
||||
} else if (dequeuedSlotCount == queue.size()) {
|
||||
state.logger->Warn("Client attempting to dequeue more buffers when all buffers are dequeued by the client: {}", dequeuedSlotCount);
|
||||
Logger::Warn("Client attempting to dequeue more buffers when all buffers are dequeued by the client: {}", dequeuedSlotCount);
|
||||
return AndroidStatus::InvalidOperation;
|
||||
} else {
|
||||
size_t index{};
|
||||
std::string bufferString;
|
||||
for (auto &bufferSlot : queue)
|
||||
bufferString += util::Format("\n#{} - State: {}, Has Graphic Buffer: {}, Frame Number: {}", ++index, ToString(bufferSlot.state), bufferSlot.graphicBuffer != nullptr, bufferSlot.frameNumber);
|
||||
state.logger->Warn("Cannot find any free buffers to dequeue:{}", bufferString);
|
||||
Logger::Warn("Cannot find any free buffers to dequeue:{}", bufferString);
|
||||
return AndroidStatus::InvalidOperation;
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ namespace skyline::service::hosbinder {
|
||||
auto &handle{buffer->graphicBuffer->graphicHandle};
|
||||
auto &surface{handle.surfaces.front()};
|
||||
if (handle.format != format || surface.width != width || surface.height != height || (buffer->graphicBuffer->usage & usage) != usage) {
|
||||
state.logger->Warn("Buffer which has been dequeued isn't compatible with the supplied parameters: Dimensions: {}x{}={}x{}, Format: {}={}, Usage: 0x{:X}=0x{:X}", width, height, surface.width, surface.height, ToString(format), ToString(buffer->graphicBuffer->format), usage, buffer->graphicBuffer->usage);
|
||||
Logger::Warn("Buffer which has been dequeued isn't compatible with the supplied parameters: Dimensions: {}x{}={}x{}, Format: {}={}, Usage: 0x{:X}=0x{:X}", width, height, surface.width, surface.height, ToString(format), ToString(buffer->graphicBuffer->format), usage, buffer->graphicBuffer->usage);
|
||||
// Nintendo doesn't deallocate the slot which was picked in here and reallocate it as a compatible buffer
|
||||
// This is related to the comment above, Nintendo only allocates buffers on the client side
|
||||
return AndroidStatus::NoInit;
|
||||
@ -146,23 +146,23 @@ namespace skyline::service::hosbinder {
|
||||
buffer->state = BufferState::Dequeued;
|
||||
fence = AndroidFence{}; // We just let the presentation engine return a buffer which is ready to be written into, there is no need for further synchronization
|
||||
|
||||
state.logger->Debug("#{} - Dimensions: {}x{}, Format: {}, Usage: 0x{:X}, Is Async: {}", slot, width, height, ToString(format), usage, async);
|
||||
Logger::Debug("#{} - Dimensions: {}x{}, Format: {}, Usage: 0x{:X}, Is Async: {}", slot, width, height, ToString(format), usage, async);
|
||||
return AndroidStatus::Ok;
|
||||
}
|
||||
|
||||
AndroidStatus GraphicBufferProducer::DetachBuffer(i32 slot) {
|
||||
std::scoped_lock lock(mutex);
|
||||
if (slot < 0 || slot >= queue.size()) [[unlikely]] {
|
||||
state.logger->Warn("#{} was out of range", slot);
|
||||
Logger::Warn("#{} was out of range", slot);
|
||||
return AndroidStatus::BadValue;
|
||||
}
|
||||
|
||||
auto &bufferSlot{queue[static_cast<size_t>(slot)]};
|
||||
if (bufferSlot.state != BufferState::Dequeued) [[unlikely]] {
|
||||
state.logger->Warn("#{} was '{}' instead of being dequeued", slot, ToString(bufferSlot.state));
|
||||
Logger::Warn("#{} was '{}' instead of being dequeued", slot, ToString(bufferSlot.state));
|
||||
return AndroidStatus::BadValue;
|
||||
} else if (!bufferSlot.wasBufferRequested) [[unlikely]] {
|
||||
state.logger->Warn("#{} was detached prior to being requested", slot);
|
||||
Logger::Warn("#{} was detached prior to being requested", slot);
|
||||
return AndroidStatus::BadValue;
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ namespace skyline::service::hosbinder {
|
||||
|
||||
bufferEvent->Signal();
|
||||
|
||||
state.logger->Debug("#{}", slot);
|
||||
Logger::Debug("#{}", slot);
|
||||
return AndroidStatus::Ok;
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ namespace skyline::service::hosbinder {
|
||||
|
||||
bufferEvent->Signal();
|
||||
|
||||
state.logger->Debug("#{}", std::distance(queue.begin(), bufferSlot));
|
||||
Logger::Debug("#{}", std::distance(queue.begin(), bufferSlot));
|
||||
return AndroidStatus::Ok;
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ namespace skyline::service::hosbinder {
|
||||
}
|
||||
|
||||
if (bufferSlot == queue.end()) {
|
||||
state.logger->Warn("Could not find any free slots to attach the graphic buffer to");
|
||||
Logger::Warn("Could not find any free slots to attach the graphic buffer to");
|
||||
return AndroidStatus::NoMemory;
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ namespace skyline::service::hosbinder {
|
||||
preallocatedBufferCount = static_cast<u8>(std::count_if(queue.begin(), queue.end(), [](const auto &slot) { return slot.graphicBuffer && slot.isPreallocated; }));
|
||||
activeSlotCount = static_cast<u8>(std::count_if(queue.begin(), queue.end(), [](const auto &slot) { return slot.graphicBuffer != nullptr; }));
|
||||
|
||||
state.logger->Debug("#{} - Dimensions: {}x{} [Stride: {}], Format: {}, Layout: {}, {}: {}, Usage: 0x{:X}, NvMap {}: {}, Buffer Start/End: 0x{:X} -> 0x{:X}", slot, surface.width, surface.height, handle.stride, ToString(handle.format), ToString(surface.layout), surface.layout == NvSurfaceLayout::Blocklinear ? "Block Height" : "Pitch", surface.layout == NvSurfaceLayout::Blocklinear ? 1U << surface.blockHeightLog2 : surface.pitch, graphicBuffer.usage, surface.nvmapHandle ? "Handle" : "ID", surface.nvmapHandle ? surface.nvmapHandle : handle.nvmapId, surface.offset, surface.offset + surface.size);
|
||||
Logger::Debug("#{} - Dimensions: {}x{} [Stride: {}], Format: {}, Layout: {}, {}: {}, Usage: 0x{:X}, NvMap {}: {}, Buffer Start/End: 0x{:X} -> 0x{:X}", slot, surface.width, surface.height, handle.stride, ToString(handle.format), ToString(surface.layout), surface.layout == NvSurfaceLayout::Blocklinear ? "Block Height" : "Pitch", surface.layout == NvSurfaceLayout::Blocklinear ? 1U << surface.blockHeightLog2 : surface.pitch, graphicBuffer.usage, surface.nvmapHandle ? "Handle" : "ID", surface.nvmapHandle ? surface.nvmapHandle : handle.nvmapId, surface.offset, surface.offset + surface.size);
|
||||
return AndroidStatus::Ok;
|
||||
}
|
||||
|
||||
@ -263,28 +263,28 @@ namespace skyline::service::hosbinder {
|
||||
break;
|
||||
|
||||
default:
|
||||
state.logger->Warn("{} is not a valid scaling mode", static_cast<u32>(scalingMode));
|
||||
Logger::Warn("{} is not a valid scaling mode", static_cast<u32>(scalingMode));
|
||||
return AndroidStatus::BadValue;
|
||||
}
|
||||
|
||||
std::scoped_lock lock(mutex);
|
||||
if (slot < 0 || slot >= queue.size()) [[unlikely]] {
|
||||
state.logger->Warn("#{} was out of range", slot);
|
||||
Logger::Warn("#{} was out of range", slot);
|
||||
return AndroidStatus::BadValue;
|
||||
}
|
||||
|
||||
auto &buffer{queue[static_cast<size_t>(slot)]};
|
||||
if (buffer.state != BufferState::Dequeued) [[unlikely]] {
|
||||
state.logger->Warn("#{} was '{}' instead of being dequeued", slot, ToString(buffer.state));
|
||||
Logger::Warn("#{} was '{}' instead of being dequeued", slot, ToString(buffer.state));
|
||||
return AndroidStatus::BadValue;
|
||||
} else if (!buffer.wasBufferRequested) [[unlikely]] {
|
||||
state.logger->Warn("#{} was queued prior to being requested", slot);
|
||||
Logger::Warn("#{} was queued prior to being requested", slot);
|
||||
buffer.wasBufferRequested = true; // Switch ignores this and doesn't return an error, certain homebrew ends up depending on this behavior
|
||||
}
|
||||
|
||||
auto graphicBuffer{*buffer.graphicBuffer};
|
||||
if (graphicBuffer.width < (crop.right - crop.left) || graphicBuffer.height < (crop.bottom - crop.top)) [[unlikely]] {
|
||||
state.logger->Warn("Crop was out of range for surface buffer: ({}-{})x({}-{}) > {}x{}", crop.left, crop.right, crop.top, crop.bottom, graphicBuffer.width, graphicBuffer.height);
|
||||
Logger::Warn("Crop was out of range for surface buffer: ({}-{})x({}-{}) > {}x{}", crop.left, crop.right, crop.top, crop.bottom, graphicBuffer.width, graphicBuffer.height);
|
||||
return AndroidStatus::BadValue;
|
||||
}
|
||||
|
||||
@ -400,20 +400,20 @@ namespace skyline::service::hosbinder {
|
||||
transformHint = state.gpu->presentation.GetTransformHint();
|
||||
pendingBufferCount = GetPendingBufferCount();
|
||||
|
||||
state.logger->Debug("#{} - {}Timestamp: {}, Crop: ({}-{})x({}-{}), Scale Mode: {}, Transform: {} [Sticky: {}], Swap Interval: {}, Is Async: {}", slot, isAutoTimestamp ? "Auto " : "", timestamp, crop.left, crop.right, crop.top, crop.bottom, ToString(scalingMode), ToString(transform), ToString(stickyTransform), swapInterval, async);
|
||||
Logger::Debug("#{} - {}Timestamp: {}, Crop: ({}-{})x({}-{}), Scale Mode: {}, Transform: {} [Sticky: {}], Swap Interval: {}, Is Async: {}", slot, isAutoTimestamp ? "Auto " : "", timestamp, crop.left, crop.right, crop.top, crop.bottom, ToString(scalingMode), ToString(transform), ToString(stickyTransform), swapInterval, async);
|
||||
return AndroidStatus::Ok;
|
||||
}
|
||||
|
||||
void GraphicBufferProducer::CancelBuffer(i32 slot, const AndroidFence &fence) {
|
||||
std::scoped_lock lock(mutex);
|
||||
if (slot < 0 || slot >= queue.size()) [[unlikely]] {
|
||||
state.logger->Warn("#{} was out of range", slot);
|
||||
Logger::Warn("#{} was out of range", slot);
|
||||
return;
|
||||
}
|
||||
|
||||
auto &buffer{queue[static_cast<size_t>(slot)]};
|
||||
if (buffer.state != BufferState::Dequeued) [[unlikely]] {
|
||||
state.logger->Warn("#{} is not owned by the producer as it is '{}' instead of being dequeued", slot, ToString(buffer.state));
|
||||
Logger::Warn("#{} is not owned by the producer as it is '{}' instead of being dequeued", slot, ToString(buffer.state));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -423,7 +423,7 @@ namespace skyline::service::hosbinder {
|
||||
buffer.frameNumber = 0;
|
||||
bufferEvent->Signal();
|
||||
|
||||
state.logger->Debug("#{}", slot);
|
||||
Logger::Debug("#{}", slot);
|
||||
}
|
||||
|
||||
AndroidStatus GraphicBufferProducer::Query(NativeWindowQuery query, u32 &out) {
|
||||
@ -467,18 +467,18 @@ namespace skyline::service::hosbinder {
|
||||
}
|
||||
|
||||
default:
|
||||
state.logger->Warn("Query not supported: {}", static_cast<u32>(query));
|
||||
Logger::Warn("Query not supported: {}", static_cast<u32>(query));
|
||||
return AndroidStatus::BadValue;
|
||||
}
|
||||
|
||||
state.logger->Debug("{}: {}", ToString(query), out);
|
||||
Logger::Debug("{}: {}", ToString(query), out);
|
||||
return AndroidStatus::Ok;
|
||||
}
|
||||
|
||||
AndroidStatus GraphicBufferProducer::Connect(NativeWindowApi api, bool producerControlledByApp, u32 &width, u32 &height, NativeWindowTransform &transformHint, u32 &pendingBufferCount) {
|
||||
std::scoped_lock lock(mutex);
|
||||
if (connectedApi != NativeWindowApi::None) [[unlikely]] {
|
||||
state.logger->Warn("Already connected to API '{}' while connection to '{}' is requested", ToString(connectedApi), ToString(api));
|
||||
Logger::Warn("Already connected to API '{}' while connection to '{}' is requested", ToString(connectedApi), ToString(api));
|
||||
return AndroidStatus::BadValue;
|
||||
}
|
||||
|
||||
@ -490,7 +490,7 @@ namespace skyline::service::hosbinder {
|
||||
break;
|
||||
|
||||
default:
|
||||
state.logger->Warn("Unknown API: {}", static_cast<u32>(api));
|
||||
Logger::Warn("Unknown API: {}", static_cast<u32>(api));
|
||||
return AndroidStatus::BadValue;
|
||||
}
|
||||
|
||||
@ -500,7 +500,7 @@ namespace skyline::service::hosbinder {
|
||||
transformHint = state.gpu->presentation.GetTransformHint();
|
||||
pendingBufferCount = GetPendingBufferCount();
|
||||
|
||||
state.logger->Debug("API: {}, Producer Controlled By App: {}, Default Dimensions: {}x{}, Transform Hint: {}, Pending Buffer Count: {}", ToString(api), producerControlledByApp, width, height, ToString(transformHint), pendingBufferCount);
|
||||
Logger::Debug("API: {}, Producer Controlled By App: {}, Default Dimensions: {}x{}, Transform Hint: {}, Pending Buffer Count: {}", ToString(api), producerControlledByApp, width, height, ToString(transformHint), pendingBufferCount);
|
||||
return AndroidStatus::Ok;
|
||||
}
|
||||
|
||||
@ -515,12 +515,12 @@ namespace skyline::service::hosbinder {
|
||||
break;
|
||||
|
||||
default:
|
||||
state.logger->Warn("Unknown API: {}", static_cast<u32>(api));
|
||||
Logger::Warn("Unknown API: {}", static_cast<u32>(api));
|
||||
return AndroidStatus::BadValue;
|
||||
}
|
||||
|
||||
if (api != connectedApi) {
|
||||
state.logger->Warn("Disconnecting from API '{}' while connected to '{}'", ToString(api), ToString(connectedApi));
|
||||
Logger::Warn("Disconnecting from API '{}' while connected to '{}'", ToString(api), ToString(connectedApi));
|
||||
return AndroidStatus::BadValue;
|
||||
}
|
||||
|
||||
@ -533,14 +533,14 @@ namespace skyline::service::hosbinder {
|
||||
slot.graphicBuffer = nullptr;
|
||||
}
|
||||
|
||||
state.logger->Debug("API: {}", ToString(api));
|
||||
Logger::Debug("API: {}", ToString(api));
|
||||
return AndroidStatus::Ok;
|
||||
}
|
||||
|
||||
AndroidStatus GraphicBufferProducer::SetPreallocatedBuffer(i32 slot, const GraphicBuffer *graphicBuffer) {
|
||||
std::scoped_lock lock(mutex);
|
||||
if (slot < 0 || slot >= MaxSlotCount) [[unlikely]] {
|
||||
state.logger->Warn("#{} was out of range", slot);
|
||||
Logger::Warn("#{} was out of range", slot);
|
||||
return AndroidStatus::BadValue;
|
||||
}
|
||||
|
||||
@ -573,9 +573,9 @@ namespace skyline::service::hosbinder {
|
||||
else if (surface.layout == NvSurfaceLayout::Tiled)
|
||||
throw exception("Legacy 16Bx16 tiled surfaces are not supported");
|
||||
|
||||
state.logger->Debug("#{} - Dimensions: {}x{} [Stride: {}], Format: {}, Layout: {}, {}: {}, Usage: 0x{:X}, NvMap {}: {}, Buffer Start/End: 0x{:X} -> 0x{:X}", slot, surface.width, surface.height, handle.stride, ToString(handle.format), ToString(surface.layout), surface.layout == NvSurfaceLayout::Blocklinear ? "Block Height" : "Pitch", surface.layout == NvSurfaceLayout::Blocklinear ? 1U << surface.blockHeightLog2 : surface.pitch, graphicBuffer->usage, surface.nvmapHandle ? "Handle" : "ID", surface.nvmapHandle ? surface.nvmapHandle : handle.nvmapId, surface.offset, surface.offset + surface.size);
|
||||
Logger::Debug("#{} - Dimensions: {}x{} [Stride: {}], Format: {}, Layout: {}, {}: {}, Usage: 0x{:X}, NvMap {}: {}, Buffer Start/End: 0x{:X} -> 0x{:X}", slot, surface.width, surface.height, handle.stride, ToString(handle.format), ToString(surface.layout), surface.layout == NvSurfaceLayout::Blocklinear ? "Block Height" : "Pitch", surface.layout == NvSurfaceLayout::Blocklinear ? 1U << surface.blockHeightLog2 : surface.pitch, graphicBuffer->usage, surface.nvmapHandle ? "Handle" : "ID", surface.nvmapHandle ? surface.nvmapHandle : handle.nvmapId, surface.offset, surface.offset + surface.size);
|
||||
} else {
|
||||
state.logger->Debug("#{} - No GraphicBuffer", slot);
|
||||
Logger::Debug("#{} - No GraphicBuffer", slot);
|
||||
}
|
||||
|
||||
preallocatedBufferCount = static_cast<u8>(std::count_if(queue.begin(), queue.end(), [](const BufferSlot &slot) { return slot.graphicBuffer && slot.isPreallocated; }));
|
||||
|
@ -45,7 +45,7 @@ namespace skyline::service::hosbinder {
|
||||
layerStrongReferenceCount = value;
|
||||
|
||||
if (layerStrongReferenceCount < 0) {
|
||||
state.logger->Warn("Strong reference count is lower than 0: {} + {} = {}", (layerStrongReferenceCount - value), value, layerStrongReferenceCount);
|
||||
Logger::Warn("Strong reference count is lower than 0: {} + {} = {}", (layerStrongReferenceCount - value), value, layerStrongReferenceCount);
|
||||
layerStrongReferenceCount = 0;
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ namespace skyline::service::hosbinder {
|
||||
layerWeakReferenceCount += value;
|
||||
|
||||
if (layerWeakReferenceCount < 0) {
|
||||
state.logger->Warn("Weak reference count is lower than 0: {} + {} = {}", (layerWeakReferenceCount - value), value, layerWeakReferenceCount);
|
||||
Logger::Warn("Weak reference count is lower than 0: {} + {} = {}", (layerWeakReferenceCount - value), value, layerWeakReferenceCount);
|
||||
layerWeakReferenceCount = 0;
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ namespace skyline::service::hosbinder {
|
||||
layer.reset();
|
||||
}
|
||||
|
||||
state.logger->Debug("Reference Change: {} {} reference (S{} W{})", value, isStrong ? "strong" : "weak", layerStrongReferenceCount, layerWeakReferenceCount);
|
||||
Logger::Debug("Reference Change: {} {} reference (S{} W{})", value, isStrong ? "strong" : "weak", layerStrongReferenceCount, layerWeakReferenceCount);
|
||||
|
||||
return {};
|
||||
}
|
||||
@ -79,7 +79,7 @@ namespace skyline::service::hosbinder {
|
||||
throw exception("Getting unknown handle from binder object: 0x{:X}", handleId);
|
||||
|
||||
KHandle handle{state.process->InsertItem(layer->bufferEvent)};
|
||||
state.logger->Debug("Display Buffer Event Handle: 0x{:X}", handle);
|
||||
Logger::Debug("Display Buffer Event Handle: 0x{:X}", handle);
|
||||
response.copyHandles.push_back(handle);
|
||||
|
||||
return {};
|
||||
|
@ -122,7 +122,7 @@ namespace skyline::service::lm {
|
||||
if (logMessage.dropCount)
|
||||
message << " (Dropped Messages: " << logMessage.time << ')';
|
||||
|
||||
state.logger->Write(hostLevel, message.str());
|
||||
Logger::Write(hostLevel, message.str());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -53,13 +53,13 @@ namespace skyline::service::mmnv {
|
||||
for (auto &req : requests) {
|
||||
if (req && req->module == module) {
|
||||
req->freqHz = freqHz;
|
||||
state.logger->Debug("Set frequency for module {}: {} Hz", static_cast<u32>(module), freqHz);
|
||||
Logger::Debug("Set frequency for module {}: {} Hz", static_cast<u32>(module), freqHz);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
// This doesn't return any errors in HOS
|
||||
state.logger->Warn("Tried to set frequency to {} Hz for unregistered module {}", freqHz, static_cast<u32>(module));
|
||||
Logger::Warn("Tried to set frequency to {} Hz for unregistered module {}", freqHz, static_cast<u32>(module));
|
||||
|
||||
return {};
|
||||
}
|
||||
@ -70,14 +70,14 @@ namespace skyline::service::mmnv {
|
||||
std::lock_guard lock(requestsMutex);
|
||||
for (auto &req : requests) {
|
||||
if (req && req->module == module) {
|
||||
state.logger->Debug("Get frequency for module {}: {} Hz", static_cast<u32>(module), req->freqHz);
|
||||
Logger::Debug("Get frequency for module {}: {} Hz", static_cast<u32>(module), req->freqHz);
|
||||
response.Push<u32>(req->freqHz);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
// This doesn't return any errors in HOS
|
||||
state.logger->Warn("Tried to get frequency of unregistered module {}", static_cast<u32>(module));
|
||||
Logger::Warn("Tried to get frequency of unregistered module {}", static_cast<u32>(module));
|
||||
response.Push<u32>(0);
|
||||
return {};
|
||||
}
|
||||
@ -114,13 +114,13 @@ namespace skyline::service::mmnv {
|
||||
auto &req{requests[id]};
|
||||
if (req) {
|
||||
req->freqHz = freqHz;
|
||||
state.logger->Debug("Set frequency for request {}: {} Hz", id, freqHz);
|
||||
Logger::Debug("Set frequency for request {}: {} Hz", id, freqHz);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
// This doesn't return any errors in HOS
|
||||
state.logger->Warn("Tried to set frequency for unregistered request {}", id);
|
||||
Logger::Warn("Tried to set frequency for unregistered request {}", id);
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -131,14 +131,14 @@ namespace skyline::service::mmnv {
|
||||
if (id < requests.size()) {
|
||||
auto &req{requests[id]};
|
||||
if (req) {
|
||||
state.logger->Debug("Get frequency for request {}: {} Hz", id, req->freqHz);
|
||||
Logger::Debug("Get frequency for request {}: {} Hz", id, req->freqHz);
|
||||
response.Push<u32>(req->freqHz);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
// This doesn't return any errors in HOS
|
||||
state.logger->Warn("Tried to get frequency of unregistered request {}", id);
|
||||
Logger::Warn("Tried to get frequency of unregistered request {}", id);
|
||||
response.Push<u32>(0);
|
||||
return {};
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ namespace skyline::service::nifm {
|
||||
|
||||
Result IRequest::GetSystemEventReadableHandles(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto handle{state.process->InsertItem(event0)};
|
||||
state.logger->Debug("Request Event 0 Handle: 0x{:X}", handle);
|
||||
Logger::Debug("Request Event 0 Handle: 0x{:X}", handle);
|
||||
response.copyHandles.push_back(handle);
|
||||
|
||||
handle = state.process->InsertItem(event1);
|
||||
state.logger->Debug("Request Event 1 Handle: 0x{:X}", handle);
|
||||
Logger::Debug("Request Event 1 Handle: 0x{:X}", handle);
|
||||
response.copyHandles.push_back(handle);
|
||||
|
||||
return {};
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#define NVRESULT(x) [&response, this](NvResult err) { \
|
||||
if (err != NvResult::Success) \
|
||||
state.logger->Debug("IOCTL Failed: 0x{:X}", err); \
|
||||
Logger::Debug("IOCTL Failed: 0x{:X}", err); \
|
||||
\
|
||||
response.Push<NvResult>(err); \
|
||||
return Result{}; \
|
||||
@ -73,7 +73,7 @@ namespace skyline::service::nvdrv {
|
||||
|
||||
Result INvDrvServices::Close(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto fd{request.Pop<FileDescriptor>()};
|
||||
state.logger->Debug("Closing NVDRV device ({})", fd);
|
||||
Logger::Debug("Closing NVDRV device ({})", fd);
|
||||
|
||||
driver.CloseDevice(fd);
|
||||
|
||||
@ -93,7 +93,7 @@ namespace skyline::service::nvdrv {
|
||||
if (event != nullptr) {
|
||||
auto handle{state.process->InsertItem<type::KEvent>(event)};
|
||||
|
||||
state.logger->Debug("FD: {}, Event ID: {}, Handle: 0x{:X}", fd, eventId, handle);
|
||||
Logger::Debug("FD: {}, Event ID: {}, Handle: 0x{:X}", fd, eventId, handle);
|
||||
response.copyHandles.push_back(handle);
|
||||
|
||||
return NVRESULT(NvResult::Success);
|
||||
|
@ -164,7 +164,7 @@ namespace skyline::service::nvdrv::core {
|
||||
|
||||
std::scoped_lock lock(handleDesc->mutex);
|
||||
if (--handleDesc->pins < 0) {
|
||||
state.logger->Warn("Pin count imbalance detected!");
|
||||
Logger::Warn("Pin count imbalance detected!");
|
||||
} else if (!handleDesc->pins) {
|
||||
std::scoped_lock queueLock(unmapQueueLock);
|
||||
|
||||
@ -184,10 +184,10 @@ namespace skyline::service::nvdrv::core {
|
||||
|
||||
if (internalSession) {
|
||||
if (--handleDesc->internalDupes < 0)
|
||||
state.logger->Warn("Internal duplicate count imbalance detected!");
|
||||
Logger::Warn("Internal duplicate count imbalance detected!");
|
||||
} else {
|
||||
if (--handleDesc->dupes < 0) {
|
||||
state.logger->Warn("User duplicate count imbalance detected!");
|
||||
Logger::Warn("User duplicate count imbalance detected!");
|
||||
} else if (handleDesc->dupes == 0) {
|
||||
// Force unmap the handle
|
||||
if (handleDesc->pinVirtAddress) {
|
||||
@ -200,11 +200,11 @@ namespace skyline::service::nvdrv::core {
|
||||
}
|
||||
|
||||
// Try to remove the shared ptr to the handle from the map, if nothing else is using the handle
|
||||
// then it will now be freed when `handleDesc` goes out of scope
|
||||
// then it will now be freed when `h` goes out of scope
|
||||
if (TryRemoveHandle(*handleDesc))
|
||||
state.logger->Debug("Removed nvmap handle: {}", handle);
|
||||
Logger::Debug("Removed nvmap handle: {}", handle);
|
||||
else
|
||||
state.logger->Debug("Tried to free nvmap handle: {} but didn't as it still has duplicates", handle);
|
||||
Logger::Debug("Tried to free nvmap handle: {} but didn't as it still has duplicates", handle);
|
||||
|
||||
freeInfo = {
|
||||
.address = handleDesc->address,
|
||||
@ -217,7 +217,7 @@ namespace skyline::service::nvdrv::core {
|
||||
|
||||
// Handle hasn't been freed from memory, set address to 0 to mark that the handle wasn't freed
|
||||
if (!hWeak.expired()) {
|
||||
state.logger->Debug("nvmap handle: {} wasn't freed as it is still in use", handle);
|
||||
Logger::Debug("nvmap handle: {} wasn't freed as it is still in use", handle);
|
||||
freeInfo.address = 0;
|
||||
}
|
||||
|
||||
|
@ -32,14 +32,14 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
std::scoped_lock channelLock(gpuCh.channelMutex);
|
||||
|
||||
if (gpuCh.asCtx) {
|
||||
state.logger->Warn("Attempting to bind multiple ASes to a single GPU channel");
|
||||
Logger::Warn("Attempting to bind multiple ASes to a single GPU channel");
|
||||
return PosixResult::InvalidArgument;
|
||||
}
|
||||
|
||||
gpuCh.asCtx = asCtx;
|
||||
gpuCh.asAllocator = vm.smallPageAllocator;
|
||||
} catch (const std::out_of_range &e) {
|
||||
state.logger->Warn("Attempting to bind AS to an invalid channel: {}", channelFd);
|
||||
Logger::Warn("Attempting to bind AS to an invalid channel: {}", channelFd);
|
||||
return PosixResult::InvalidArgument;
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
}
|
||||
|
||||
PosixResult AsGpu::AllocSpace(In<u32> pages, In<u32> pageSize, In<MappingFlags> flags, InOut<u64> offset) {
|
||||
state.logger->Debug("pages: 0x{:X}, pageSize: 0x{:X}, flags: ( fixed: {}, sparse: {} ), offset: 0x{:X}",
|
||||
Logger::Debug("pages: 0x{:X}, pageSize: 0x{:X}, flags: ( fixed: {}, sparse: {} ), offset: 0x{:X}",
|
||||
pages, pageSize, flags.fixed, flags.sparse, offset);
|
||||
|
||||
std::scoped_lock lock(mutex);
|
||||
@ -108,7 +108,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
}
|
||||
|
||||
PosixResult AsGpu::FreeSpace(In<u64> offset, In<u32> pages, In<u32> pageSize) {
|
||||
state.logger->Debug("offset: 0x{:X}, pages: 0x{:X}, pageSize: 0x{:X}", offset, pages, pageSize);
|
||||
Logger::Debug("offset: 0x{:X}, pages: 0x{:X}, pageSize: 0x{:X}", offset, pages, pageSize);
|
||||
|
||||
std::scoped_lock lock(mutex);
|
||||
|
||||
@ -141,7 +141,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
}
|
||||
|
||||
PosixResult AsGpu::UnmapBuffer(In<u64> offset) {
|
||||
state.logger->Debug("offset: 0x{:X}", offset);
|
||||
Logger::Debug("offset: 0x{:X}", offset);
|
||||
|
||||
std::scoped_lock lock(mutex);
|
||||
|
||||
@ -167,7 +167,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
|
||||
mappingMap.erase(offset);
|
||||
} catch (const std::out_of_range &e) {
|
||||
state.logger->Warn("Couldn't find region to unmap at 0x{:X}", offset);
|
||||
Logger::Warn("Couldn't find region to unmap at 0x{:X}", offset);
|
||||
}
|
||||
|
||||
return PosixResult::Success;
|
||||
@ -176,7 +176,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
PosixResult AsGpu::MapBufferEx(In<MappingFlags> flags, In<u32> kind,
|
||||
In<core::NvMap::Handle::Id> handle, In<u64> bufferOffset,
|
||||
In<u64> mappingSize, InOut<u64> offset) {
|
||||
state.logger->Debug("flags: ( fixed: {}, remap: {} ), kind: {}, handle: {}, bufferOffset: 0x{:X}, mappingSize: 0x{:X}, offset: 0x{:X}",
|
||||
Logger::Debug("flags: ( fixed: {}, remap: {} ), kind: {}, handle: {}, bufferOffset: 0x{:X}, mappingSize: 0x{:X}, offset: 0x{:X}",
|
||||
flags.fixed, flags.remap, kind, handle, bufferOffset, mappingSize, offset);
|
||||
|
||||
std::scoped_lock lock(mutex);
|
||||
@ -190,7 +190,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
auto mapping{mappingMap.at(offset)};
|
||||
|
||||
if (mapping->size < mappingSize) {
|
||||
state.logger->Warn("Cannot remap a partially mapped GPU address space region: 0x{:X}", offset);
|
||||
Logger::Warn("Cannot remap a partially mapped GPU address space region: 0x{:X}", offset);
|
||||
return PosixResult::InvalidArgument;
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
|
||||
return PosixResult::Success;
|
||||
} catch (const std::out_of_range &e) {
|
||||
state.logger->Warn("Cannot remap an unmapped GPU address space region: 0x{:X}", offset);
|
||||
Logger::Warn("Cannot remap an unmapped GPU address space region: 0x{:X}", offset);
|
||||
return PosixResult::InvalidArgument;
|
||||
}
|
||||
}
|
||||
@ -248,7 +248,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
mappingMap[offset] = mapping;
|
||||
}
|
||||
|
||||
state.logger->Debug("Mapped to 0x{:X}", offset);
|
||||
Logger::Debug("Mapped to 0x{:X}", offset);
|
||||
|
||||
return PosixResult::Success;
|
||||
}
|
||||
@ -288,17 +288,17 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
if (vm.initialised)
|
||||
throw exception("Cannot initialise an address space twice!");
|
||||
|
||||
state.logger->Debug("bigPageSize: 0x{:X}, asFd: {}, flags: 0x{:X}, vaRangeStart: 0x{:X}, vaRangeEnd: 0x{:X}, vaRangeSplit: 0x{:X}",
|
||||
Logger::Debug("bigPageSize: 0x{:X}, asFd: {}, flags: 0x{:X}, vaRangeStart: 0x{:X}, vaRangeEnd: 0x{:X}, vaRangeSplit: 0x{:X}",
|
||||
bigPageSize, asFd, flags, vaRangeStart, vaRangeEnd, vaRangeSplit);
|
||||
|
||||
if (bigPageSize) {
|
||||
if (!std::has_single_bit(bigPageSize)) {
|
||||
state.logger->Error("Non power-of-2 big page size: 0x{:X}!", bigPageSize);
|
||||
Logger::Error("Non power-of-2 big page size: 0x{:X}!", bigPageSize);
|
||||
return PosixResult::InvalidArgument;
|
||||
}
|
||||
|
||||
if (!(bigPageSize & VM::SupportedBigPageSizes)) {
|
||||
state.logger->Error("Unsupported big page size: 0x{:X}!", bigPageSize);
|
||||
Logger::Error("Unsupported big page size: 0x{:X}!", bigPageSize);
|
||||
return PosixResult::InvalidArgument;
|
||||
}
|
||||
|
||||
@ -342,12 +342,12 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
auto alloc{allocationMap.upper_bound(virtAddr)};
|
||||
|
||||
if (alloc-- == allocationMap.begin() || (virtAddr - alloc->first) + size > alloc->second.size) {
|
||||
state.logger->Warn("Cannot remap into an unallocated region!");
|
||||
Logger::Warn("Cannot remap into an unallocated region!");
|
||||
return PosixResult::InvalidArgument;
|
||||
}
|
||||
|
||||
if (!alloc->second.sparse) {
|
||||
state.logger->Warn("Cannot remap a non-sparse mapping!");
|
||||
Logger::Warn("Cannot remap a non-sparse mapping!");
|
||||
return PosixResult::InvalidArgument;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
}
|
||||
|
||||
PosixResult Ctrl::SyncpointWaitEventImpl(In<Fence> fence, In<i32> timeout, InOut<SyncpointEventValue> value, bool allocate) {
|
||||
state.logger->Debug("fence: ( id: {}, threshold: {} ), timeout: {}, value: {}, allocate: {}",
|
||||
Logger::Debug("fence: ( id: {}, threshold: {} ), timeout: {}, value: {}, allocate: {}",
|
||||
fence.id, fence.threshold, timeout, value.val, allocate);
|
||||
|
||||
if (fence.id >= soc::host1x::SyncpointCount)
|
||||
@ -80,7 +80,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
if (fence.threshold == 0) {
|
||||
// oss-nvjpg waits on syncpoint 0 during initialisation without reserving it, this is technically valid with a zero threshold but could also be a sign of a bug on our side in other cases, hence the warn
|
||||
if (!core.syncpointManager.IsSyncpointAllocated(fence.id))
|
||||
state.logger->Warn("Tried to wait on an unreserved syncpoint with no threshold");
|
||||
Logger::Warn("Tried to wait on an unreserved syncpoint with no threshold");
|
||||
|
||||
return PosixResult::Success;
|
||||
}
|
||||
@ -121,7 +121,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
return PosixResult::InvalidArgument;
|
||||
|
||||
if (!event->IsInUse()) {
|
||||
state.logger->Debug("Waiting on syncpoint event: {} with fence: ({}, {})", slot, fence.id, fence.threshold);
|
||||
Logger::Debug("Waiting on syncpoint event: {} with fence: ({}, {})", slot, fence.id, fence.threshold);
|
||||
event->RegisterWaiter(state.soc->host1x, fence);
|
||||
|
||||
value.val = 0;
|
||||
@ -159,7 +159,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
}
|
||||
|
||||
PosixResult Ctrl::SyncpointClearEventWait(In<SyncpointEventValue> value) {
|
||||
state.logger->Debug("slot: {}", value.slot);
|
||||
Logger::Debug("slot: {}", value.slot);
|
||||
|
||||
u16 slot{value.slot};
|
||||
if (slot >= SyncpointEventCount)
|
||||
@ -172,7 +172,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
return PosixResult::InvalidArgument;
|
||||
|
||||
if (event->state.exchange(SyncpointEvent::State::Cancelling) == SyncpointEvent::State::Waiting) {
|
||||
state.logger->Debug("Cancelling waiting syncpoint event: {}", slot);
|
||||
Logger::Debug("Cancelling waiting syncpoint event: {}", slot);
|
||||
event->Cancel(state.soc->host1x);
|
||||
core.syncpointManager.UpdateMin(event->fence.id);
|
||||
}
|
||||
@ -192,7 +192,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
}
|
||||
|
||||
PosixResult Ctrl::SyncpointAllocateEvent(In<u32> slot) {
|
||||
state.logger->Debug("slot: {}", slot);
|
||||
Logger::Debug("slot: {}", slot);
|
||||
|
||||
if (slot >= SyncpointEventCount)
|
||||
return PosixResult::InvalidArgument;
|
||||
@ -210,14 +210,14 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
}
|
||||
|
||||
PosixResult Ctrl::SyncpointFreeEvent(In<u32> slot) {
|
||||
state.logger->Debug("slot: {}", slot);
|
||||
Logger::Debug("slot: {}", slot);
|
||||
|
||||
std::lock_guard lock(syncpointEventMutex);
|
||||
return SyncpointFreeEventLocked(slot);
|
||||
}
|
||||
|
||||
PosixResult Ctrl::SyncpointFreeEventBatch(In<u64> bitmask) {
|
||||
state.logger->Debug("bitmask: 0x{:X}", bitmask);
|
||||
Logger::Debug("bitmask: 0x{:X}", bitmask);
|
||||
|
||||
auto err{PosixResult::Success};
|
||||
|
||||
|
@ -66,12 +66,12 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
}
|
||||
|
||||
PosixResult GpuChannel::SetNvmapFd(In<FileDescriptor> fd) {
|
||||
state.logger->Debug("fd: {}", fd);
|
||||
Logger::Debug("fd: {}", fd);
|
||||
return PosixResult::Success;
|
||||
}
|
||||
|
||||
PosixResult GpuChannel::SetTimeout(In<u32> timeout) {
|
||||
state.logger->Debug("timeout: {}", timeout);
|
||||
Logger::Debug("timeout: {}", timeout);
|
||||
return PosixResult::Success;
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
InOut<SubmitGpfifoFlags> flags,
|
||||
InOut<Fence> fence,
|
||||
span<soc::gm20b::GpEntry> gpEntries) {
|
||||
state.logger->Debug("userAddress: 0x{:X}, numEntries: {},"
|
||||
Logger::Debug("userAddress: 0x{:X}, numEntries: {},"
|
||||
"flags ( fenceWait: {}, fenceIncrement: {}, hwFormat: {}, suppressWfi: {}, incrementWithValue: {}),"
|
||||
"fence ( id: {}, threshold: {} )",
|
||||
userAddress, numEntries,
|
||||
@ -137,36 +137,36 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
}
|
||||
|
||||
PosixResult GpuChannel::AllocObjCtx(In<u32> classId, In<u32> flags, Out<u64> objId) {
|
||||
state.logger->Debug("classId: 0x{:X}, flags: 0x{:X}", classId, flags);
|
||||
Logger::Debug("classId: 0x{:X}, flags: 0x{:X}", classId, flags);
|
||||
return PosixResult::Success;
|
||||
}
|
||||
|
||||
PosixResult GpuChannel::ZcullBind(In<u64> gpuVa, In<u32> mode) {
|
||||
state.logger->Debug("gpuVa: 0x{:X}, mode: {}", gpuVa, mode);
|
||||
Logger::Debug("gpuVa: 0x{:X}, mode: {}", gpuVa, mode);
|
||||
return PosixResult::Success;
|
||||
}
|
||||
|
||||
PosixResult GpuChannel::SetErrorNotifier(In<u64> offset, In<u64> size, In<u32> mem) {
|
||||
state.logger->Debug("offset: 0x{:X}, size: 0x{:X}, mem: 0x{:X}", offset, size, mem);
|
||||
Logger::Debug("offset: 0x{:X}, size: 0x{:X}, mem: 0x{:X}", offset, size, mem);
|
||||
return PosixResult::Success;
|
||||
}
|
||||
|
||||
PosixResult GpuChannel::SetPriority(In<u32> priority) {
|
||||
state.logger->Debug("priority: {}", priority);
|
||||
Logger::Debug("priority: {}", priority);
|
||||
return PosixResult::Success;
|
||||
}
|
||||
|
||||
PosixResult GpuChannel::AllocGpfifoEx2(In<u32> numEntries, In<u32> numJobs, In<u32> flags, Out<Fence> fence) {
|
||||
state.logger->Debug("numEntries: {}, numJobs: {}, flags: 0x{:X}", numEntries, numJobs, flags);
|
||||
Logger::Debug("numEntries: {}, numJobs: {}, flags: 0x{:X}", numEntries, numJobs, flags);
|
||||
|
||||
std::scoped_lock lock(channelMutex);
|
||||
if (!asCtx || !asAllocator) {
|
||||
state.logger->Warn("Trying to allocate a channel without a bound address space");
|
||||
Logger::Warn("Trying to allocate a channel without a bound address space");
|
||||
return PosixResult::InvalidArgument;
|
||||
}
|
||||
|
||||
if (channelCtx) {
|
||||
state.logger->Warn("Trying to allocate a channel twice!");
|
||||
Logger::Warn("Trying to allocate a channel twice!");
|
||||
return PosixResult::FileExists;
|
||||
}
|
||||
|
||||
@ -192,12 +192,12 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
}
|
||||
|
||||
PosixResult GpuChannel::SetTimeslice(In<u32> timeslice) {
|
||||
state.logger->Debug("timeslice: {}", timeslice);
|
||||
Logger::Debug("timeslice: {}", timeslice);
|
||||
return PosixResult::Success;
|
||||
}
|
||||
|
||||
PosixResult GpuChannel::SetUserData(In<u64> userData) {
|
||||
state.logger->Debug("userData: 0x{:X}", userData);
|
||||
Logger::Debug("userData: 0x{:X}", userData);
|
||||
channelUserData = userData;
|
||||
return PosixResult::Success;
|
||||
}
|
||||
|
@ -17,14 +17,14 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
}
|
||||
|
||||
PosixResult Host1xChannel::SetNvmapFd(In<FileDescriptor> fd) {
|
||||
state.logger->Debug("fd: {}", fd);
|
||||
Logger::Debug("fd: {}", fd);
|
||||
return PosixResult::Success;
|
||||
}
|
||||
|
||||
PosixResult Host1xChannel::Submit(span<SubmitCmdBuf> cmdBufs,
|
||||
span<SubmitReloc> relocs, span<u32> relocShifts,
|
||||
span<SubmitSyncpointIncr> syncpointIncrs, span<u32> fenceThresholds) {
|
||||
state.logger->Debug("numCmdBufs: {}, numRelocs: {}, numSyncpointIncrs: {}, numFenceThresholds: {}",
|
||||
Logger::Debug("numCmdBufs: {}, numRelocs: {}, numSyncpointIncrs: {}, numFenceThresholds: {}",
|
||||
cmdBufs.size(), relocs.size(), syncpointIncrs.size(), fenceThresholds.size());
|
||||
|
||||
if (fenceThresholds.size() > syncpointIncrs.size())
|
||||
@ -49,7 +49,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
throw exception("Invalid handle passed for a command buffer!");
|
||||
|
||||
u64 gatherAddress{handleDesc->address + cmdBuf.offset};
|
||||
state.logger->Debug("Submit gather, CPU address: 0x{:X}, words: 0x{:X}", gatherAddress, cmdBuf.words);
|
||||
Logger::Debug("Submit gather, CPU address: 0x{:X}, words: 0x{:X}", gatherAddress, cmdBuf.words);
|
||||
|
||||
span gather(reinterpret_cast<u32 *>(gatherAddress), cmdBuf.words);
|
||||
state.soc->host1x.channels[static_cast<size_t>(channelType)].Push(gather);
|
||||
@ -59,7 +59,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
}
|
||||
|
||||
PosixResult Host1xChannel::GetSyncpoint(In<u32> channelSyncpointIdx, Out<u32> syncpointId) {
|
||||
state.logger->Debug("channelSyncpointIdx: {}", channelSyncpointIdx);
|
||||
Logger::Debug("channelSyncpointIdx: {}", channelSyncpointIdx);
|
||||
|
||||
if (channelSyncpointIdx > 0)
|
||||
throw exception("Multiple channel syncpoints are unimplemented!");
|
||||
@ -68,39 +68,39 @@ namespace skyline::service::nvdrv::device::nvhost {
|
||||
if (!id)
|
||||
throw exception("Requested syncpoint for a channel with none specified!");
|
||||
|
||||
state.logger->Debug("syncpointId: {}", id);
|
||||
Logger::Debug("syncpointId: {}", id);
|
||||
syncpointId = id;
|
||||
return PosixResult::Success;
|
||||
}
|
||||
|
||||
PosixResult Host1xChannel::GetWaitBase(In<core::ChannelType> pChannelType, Out<u32> waitBase) {
|
||||
state.logger->Debug("channelType: {}", static_cast<u32>(pChannelType));
|
||||
Logger::Debug("channelType: {}", static_cast<u32>(pChannelType));
|
||||
waitBase = 0;
|
||||
return PosixResult::Success;
|
||||
}
|
||||
|
||||
PosixResult Host1xChannel::SetSubmitTimeout(In<u32> timeout) {
|
||||
state.logger->Debug("timeout: {}", timeout);
|
||||
Logger::Debug("timeout: {}", timeout);
|
||||
return PosixResult::Success;
|
||||
}
|
||||
|
||||
PosixResult Host1xChannel::MapBuffer(u8 compressed, span<BufferHandle> handles) {
|
||||
state.logger->Debug("compressed: {}", compressed);
|
||||
Logger::Debug("compressed: {}", compressed);
|
||||
|
||||
for (auto &bufferHandle : handles) {
|
||||
bufferHandle.address = core.nvMap.PinHandle(bufferHandle.handle);
|
||||
state.logger->Debug("handle: {}, address: 0x{:X}", bufferHandle.handle, bufferHandle.address);
|
||||
Logger::Debug("handle: {}, address: 0x{:X}", bufferHandle.handle, bufferHandle.address);
|
||||
}
|
||||
|
||||
return PosixResult::Success;
|
||||
}
|
||||
|
||||
PosixResult Host1xChannel::UnmapBuffer(u8 compressed, span<BufferHandle> handles) {
|
||||
state.logger->Debug("compressed: {}", compressed);
|
||||
Logger::Debug("compressed: {}", compressed);
|
||||
|
||||
for (auto &bufferHandle : handles) {
|
||||
core.nvMap.UnpinHandle(bufferHandle.handle);
|
||||
state.logger->Debug("handle: {}", bufferHandle.handle);
|
||||
Logger::Debug("handle: {}", bufferHandle.handle);
|
||||
}
|
||||
|
||||
return PosixResult::Success;
|
||||
|
@ -13,14 +13,14 @@ namespace skyline::service::nvdrv::device {
|
||||
if (handleDesc) {
|
||||
(*handleDesc)->origSize = size; // Orig size is the unaligned size
|
||||
handle = (*handleDesc)->id;
|
||||
state.logger->Debug("handle: {}, size: 0x{:X}", (*handleDesc)->id, size);
|
||||
Logger::Debug("handle: {}, size: 0x{:X}", (*handleDesc)->id, size);
|
||||
}
|
||||
|
||||
return handleDesc;
|
||||
}
|
||||
|
||||
PosixResult NvMap::FromId(In<NvMapCore::Handle::Id> id, Out<NvMapCore::Handle::Id> handle) {
|
||||
state.logger->Debug("id: {}", id);
|
||||
Logger::Debug("id: {}", id);
|
||||
|
||||
// Handles and IDs are always the same value in nvmap however IDs can be used globally given the right permissions.
|
||||
// Since we don't plan on ever supporting multiprocess we can skip implementing handle refs and so this function just does simple validation and passes through the handle id.
|
||||
@ -41,7 +41,7 @@ namespace skyline::service::nvdrv::device {
|
||||
PosixResult NvMap::Alloc(In<NvMapCore::Handle::Id> handle,
|
||||
In<u32> heapMask, In<NvMapCore::Handle::Flags> flags,
|
||||
InOut<u32> align, In<u8> kind, In<u64> address) {
|
||||
state.logger->Debug("handle: {}, flags: ( mapUncached: {}, keepUncachedAfterFree: {} ), align: 0x{:X}, kind: {}, address: 0x{:X}",
|
||||
Logger::Debug("handle: {}, flags: ( mapUncached: {}, keepUncachedAfterFree: {} ), align: 0x{:X}, kind: {}, address: 0x{:X}",
|
||||
handle, flags.mapUncached, flags.keepUncachedAfterFree, align, kind, address);
|
||||
|
||||
if (!handle) [[unlikely]]
|
||||
@ -64,7 +64,7 @@ namespace skyline::service::nvdrv::device {
|
||||
PosixResult NvMap::Free(In<NvMapCore::Handle::Id> handle,
|
||||
Out<u64> address, Out<u32> size,
|
||||
Out<NvMapCore::Handle::Flags> flags) {
|
||||
state.logger->Debug("handle: {}", handle);
|
||||
Logger::Debug("handle: {}", handle);
|
||||
|
||||
if (!handle) [[unlikely]]
|
||||
return PosixResult::Success;
|
||||
@ -74,14 +74,14 @@ namespace skyline::service::nvdrv::device {
|
||||
size = static_cast<u32>(freeInfo->size);
|
||||
flags = NvMapCore::Handle::Flags{ .mapUncached = freeInfo->wasUncached };
|
||||
} else {
|
||||
state.logger->Debug("Handle not freed");
|
||||
Logger::Debug("Handle not freed");
|
||||
}
|
||||
|
||||
return PosixResult::Success;
|
||||
}
|
||||
|
||||
PosixResult NvMap::Param(In<NvMapCore::Handle::Id> handle, In<HandleParameterType> param, Out<u32> result) {
|
||||
state.logger->Debug("handle: {}, param: {}", handle, param);
|
||||
Logger::Debug("handle: {}, param: {}", handle, param);
|
||||
|
||||
if (!handle)
|
||||
return PosixResult::InvalidArgument;
|
||||
@ -119,7 +119,7 @@ namespace skyline::service::nvdrv::device {
|
||||
}
|
||||
|
||||
PosixResult NvMap::GetId(Out<NvMapCore::Handle::Id> id, In<NvMapCore::Handle::Id> handle) {
|
||||
state.logger->Debug("handle: {}", handle);
|
||||
Logger::Debug("handle: {}", handle);
|
||||
|
||||
// See the comment in FromId for extra info on this function
|
||||
if (!handle) [[unlikely]]
|
||||
|
@ -13,7 +13,7 @@ namespace skyline::service::nvdrv {
|
||||
Driver::Driver(const DeviceState &state) : state(state), core(state) {}
|
||||
|
||||
NvResult Driver::OpenDevice(std::string_view path, FileDescriptor fd, const SessionContext &ctx) {
|
||||
state.logger->Debug("Opening NvDrv device ({}): {}", fd, path);
|
||||
Logger::Debug("Opening NvDrv device ({}): {}", fd, path);
|
||||
auto pathHash{util::Hash(path)};
|
||||
|
||||
#define DEVICE_SWITCH(cases) \
|
||||
@ -84,7 +84,7 @@ namespace skyline::service::nvdrv {
|
||||
}
|
||||
|
||||
NvResult Driver::Ioctl(FileDescriptor fd, IoctlDescriptor cmd, span<u8> buffer) {
|
||||
state.logger->Debug("fd: {}, cmd: 0x{:X}, device: {}", fd, cmd.raw, devices.at(fd)->GetName());
|
||||
Logger::Debug("fd: {}, cmd: 0x{:X}, device: {}", fd, cmd.raw, devices.at(fd)->GetName());
|
||||
|
||||
try {
|
||||
std::shared_lock lock(deviceMutex);
|
||||
@ -95,7 +95,7 @@ namespace skyline::service::nvdrv {
|
||||
}
|
||||
|
||||
NvResult Driver::Ioctl2(FileDescriptor fd, IoctlDescriptor cmd, span<u8> buffer, span<u8> inlineBuffer) {
|
||||
state.logger->Debug("fd: {}, cmd: 0x{:X}, device: {}", fd, cmd.raw, devices.at(fd)->GetName());
|
||||
Logger::Debug("fd: {}, cmd: 0x{:X}, device: {}", fd, cmd.raw, devices.at(fd)->GetName());
|
||||
|
||||
try {
|
||||
std::shared_lock lock(deviceMutex);
|
||||
@ -106,7 +106,7 @@ namespace skyline::service::nvdrv {
|
||||
}
|
||||
|
||||
NvResult Driver::Ioctl3(FileDescriptor fd, IoctlDescriptor cmd, span<u8> buffer, span<u8> inlineBuffer) {
|
||||
state.logger->Debug("fd: {}, cmd: 0x{:X}, device: {}", fd, cmd.raw, devices.at(fd)->GetName());
|
||||
Logger::Debug("fd: {}, cmd: 0x{:X}, device: {}", fd, cmd.raw, devices.at(fd)->GetName());
|
||||
|
||||
try {
|
||||
std::shared_lock lock(deviceMutex);
|
||||
@ -121,12 +121,12 @@ namespace skyline::service::nvdrv {
|
||||
std::unique_lock lock(deviceMutex);
|
||||
devices.erase(fd);
|
||||
} catch (const std::out_of_range &) {
|
||||
state.logger->Warn("Trying to close invalid fd: {}");
|
||||
Logger::Warn("Trying to close invalid fd: {}");
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<kernel::type::KEvent> Driver::QueryEvent(FileDescriptor fd, u32 eventId) {
|
||||
state.logger->Debug("fd: {}, eventId: 0x{:X}, device: {}", fd, eventId, devices.at(fd)->GetName());
|
||||
Logger::Debug("fd: {}, eventId: 0x{:X}, device: {}", fd, eventId, devices.at(fd)->GetName());
|
||||
|
||||
try {
|
||||
std::shared_lock lock(deviceMutex);
|
||||
|
@ -120,7 +120,7 @@ namespace skyline::service {
|
||||
handle = state.process->NewHandle<type::KSession>(serviceObject).handle;
|
||||
response.moveHandles.push_back(handle);
|
||||
}
|
||||
state.logger->Debug("Service has been created: \"{}\" (0x{:X})", serviceObject->GetName(), handle);
|
||||
Logger::Debug("Service has been created: \"{}\" (0x{:X})", serviceObject->GetName(), handle);
|
||||
return serviceObject;
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ namespace skyline::service {
|
||||
response.moveHandles.push_back(handle);
|
||||
}
|
||||
|
||||
state.logger->Debug("Service has been registered: \"{}\" (0x{:X})", serviceObject->GetName(), handle);
|
||||
Logger::Debug("Service has been registered: \"{}\" (0x{:X})", serviceObject->GetName(), handle);
|
||||
}
|
||||
|
||||
void ServiceManager::CloseSession(KHandle handle) {
|
||||
@ -161,8 +161,8 @@ namespace skyline::service {
|
||||
void ServiceManager::SyncRequestHandler(KHandle handle) {
|
||||
TRACE_EVENT("kernel", "ServiceManager::SyncRequestHandler");
|
||||
auto session{state.process->GetHandle<type::KSession>(handle)};
|
||||
state.logger->Verbose("----IPC Start----");
|
||||
state.logger->Verbose("Handle is 0x{:X}", handle);
|
||||
Logger::Verbose("----IPC Start----");
|
||||
Logger::Verbose("Handle is 0x{:X}", handle);
|
||||
|
||||
if (session->isOpen) {
|
||||
ipc::IpcRequest request(session->isDomain, state);
|
||||
@ -199,7 +199,7 @@ namespace skyline::service {
|
||||
|
||||
case ipc::CommandType::Control:
|
||||
case ipc::CommandType::ControlWithContext:
|
||||
state.logger->Debug("Control IPC Message: 0x{:X}", request.payload->value);
|
||||
Logger::Debug("Control IPC Message: 0x{:X}", request.payload->value);
|
||||
switch (static_cast<ipc::ControlCommand>(request.payload->value)) {
|
||||
case ipc::ControlCommand::ConvertCurrentObjectToDomain:
|
||||
response.Push(session->ConvertDomain());
|
||||
@ -221,15 +221,15 @@ namespace skyline::service {
|
||||
break;
|
||||
|
||||
case ipc::CommandType::Close:
|
||||
state.logger->Debug("Closing Session");
|
||||
Logger::Debug("Closing Session");
|
||||
CloseSession(handle);
|
||||
break;
|
||||
default:
|
||||
throw exception("Unimplemented IPC message type: {}", static_cast<u16>(request.header->type));
|
||||
}
|
||||
} else {
|
||||
state.logger->Warn("svcSendSyncRequest called on closed handle: 0x{:X}", handle);
|
||||
Logger::Warn("svcSendSyncRequest called on closed handle: 0x{:X}", handle);
|
||||
}
|
||||
state.logger->Verbose("====IPC End====");
|
||||
Logger::Verbose("====IPC End====");
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace skyline::service::sm {
|
||||
return {};
|
||||
} catch (std::out_of_range &) {
|
||||
std::string_view stringName(span(reinterpret_cast<char *>(&name), sizeof(u64)).as_string(true));
|
||||
state.logger->Warn("Service has not been implemented: \"{}\"", stringName);
|
||||
Logger::Warn("Service has not been implemented: \"{}\"", stringName);
|
||||
return result::InvalidServiceName;
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace skyline::service::timesrv {
|
||||
}
|
||||
|
||||
auto handle{state.process->InsertItem(operationEvent)};
|
||||
state.logger->Debug("ISystemClock Operation Event Handle: 0x{:X}", handle);
|
||||
Logger::Debug("ISystemClock Operation Event Handle: 0x{:X}", handle);
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
}
|
||||
|
@ -42,14 +42,14 @@ namespace skyline::service::visrv {
|
||||
|
||||
Result IApplicationDisplayService::OpenDisplay(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto displayName(request.PopString());
|
||||
state.logger->Debug("Opening display: {}", displayName);
|
||||
Logger::Debug("Opening display: {}", displayName);
|
||||
response.Push(hosbinder->OpenDisplay(displayName));
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::CloseDisplay(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto displayId{request.Pop<hosbinder::DisplayId>()};
|
||||
state.logger->Debug("Closing display: {}", hosbinder::ToString(displayId));
|
||||
Logger::Debug("Closing display: {}", hosbinder::ToString(displayId));
|
||||
hosbinder->CloseDisplay(displayId);
|
||||
return {};
|
||||
}
|
||||
@ -57,7 +57,7 @@ namespace skyline::service::visrv {
|
||||
Result IApplicationDisplayService::OpenLayer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto displayName{request.PopString(0x40)};
|
||||
auto layerId{request.Pop<u64>()};
|
||||
state.logger->Debug("Opening layer #{} on display: {}", layerId, displayName);
|
||||
Logger::Debug("Opening layer #{} on display: {}", layerId, displayName);
|
||||
|
||||
auto displayId{hosbinder->OpenDisplay(displayName)};
|
||||
auto parcel{hosbinder->OpenLayer(displayId, layerId)};
|
||||
@ -68,7 +68,7 @@ namespace skyline::service::visrv {
|
||||
|
||||
Result IApplicationDisplayService::CloseLayer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
u64 layerId{request.Pop<u64>()};
|
||||
state.logger->Debug("Closing layer #{}", layerId);
|
||||
Logger::Debug("Closing layer #{}", layerId);
|
||||
hosbinder->CloseLayer(layerId);
|
||||
return {};
|
||||
}
|
||||
@ -76,13 +76,13 @@ namespace skyline::service::visrv {
|
||||
Result IApplicationDisplayService::SetLayerScalingMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto scalingMode{request.Pop<u64>()};
|
||||
auto layerId{request.Pop<u64>()};
|
||||
state.logger->Debug("Setting Layer Scaling mode to '{}' for layer {}", scalingMode, layerId);
|
||||
Logger::Debug("Setting Layer Scaling mode to '{}' for layer {}", scalingMode, layerId);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IApplicationDisplayService::GetDisplayVsyncEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
KHandle handle{state.process->InsertItem(state.gpu->presentation.vsyncEvent)};
|
||||
state.logger->Debug("V-Sync Event Handle: 0x{:X}", handle);
|
||||
Logger::Debug("V-Sync Event Handle: 0x{:X}", handle);
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace skyline::service::visrv {
|
||||
auto layerId{hosbinder->CreateLayer(displayId)};
|
||||
response.Push(layerId);
|
||||
|
||||
state.logger->Debug("Creating Stray Layer #{} on Display: {}", layerId, hosbinder::ToString(displayId));
|
||||
Logger::Debug("Creating Stray Layer #{} on Display: {}", layerId, hosbinder::ToString(displayId));
|
||||
|
||||
auto parcel{hosbinder->OpenLayer(displayId, layerId)};
|
||||
response.Push<u64>(parcel.WriteParcel(request.outputBuf.at(0)));
|
||||
@ -25,7 +25,7 @@ namespace skyline::service::visrv {
|
||||
|
||||
Result IDisplayService::DestroyStrayLayer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto layerId{request.Pop<u64>()};
|
||||
state.logger->Debug("Destroying Stray Layer #{}", layerId);
|
||||
Logger::Debug("Destroying Stray Layer #{}", layerId);
|
||||
|
||||
hosbinder->CloseLayer(layerId);
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace skyline::service::visrv {
|
||||
auto displayId{request.Pop<hosbinder::DisplayId>()};
|
||||
|
||||
auto layerId{hosbinder->CreateLayer(displayId)};
|
||||
state.logger->Debug("Creating Managed Layer #{} on Display: {}", layerId, hosbinder::ToString(displayId));
|
||||
Logger::Debug("Creating Managed Layer #{} on Display: {}", layerId, hosbinder::ToString(displayId));
|
||||
response.Push(layerId);
|
||||
|
||||
return {};
|
||||
@ -20,7 +20,7 @@ namespace skyline::service::visrv {
|
||||
|
||||
Result IManagerDisplayService::DestroyManagedLayer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto layerId{request.Pop<u64>()};
|
||||
state.logger->Debug("Destroying Managed Layer #{}", layerId);
|
||||
Logger::Debug("Destroying Managed Layer #{}", layerId);
|
||||
hosbinder->DestroyLayer(layerId);
|
||||
return {};
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ namespace skyline::soc::gm20b {
|
||||
* @brief Calls an engine method with the given parameters
|
||||
*/
|
||||
void CallMethod(u32 method, u32 argument, bool lastCall) {
|
||||
state.logger->Warn("Called method in unimplemented engine: 0x{:X} args: 0x{:X}", method, argument);
|
||||
Logger::Warn("Called method in unimplemented engine: 0x{:X} args: 0x{:X}", method, argument);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace skyline::soc::gm20b::engine {
|
||||
GPFIFO::GPFIFO(const DeviceState &state, ChannelContext &channelCtx) : Engine(state), channelCtx(channelCtx) {}
|
||||
|
||||
void GPFIFO::CallMethod(u32 method, u32 argument, bool lastCall) {
|
||||
state.logger->Debug("Called method in GPFIFO: 0x{:X} args: 0x{:X}", method, argument);
|
||||
Logger::Debug("Called method in GPFIFO: 0x{:X} args: 0x{:X}", method, argument);
|
||||
|
||||
registers.raw[method] = argument;
|
||||
|
||||
@ -27,11 +27,11 @@ namespace skyline::soc::gm20b::engine {
|
||||
switch (method) {
|
||||
GPFIFO_STRUCT_CASE(syncpoint, action, {
|
||||
if (action.operation == Registers::SyncpointOperation::Incr) {
|
||||
state.logger->Debug("Increment syncpoint: {}", +action.index);
|
||||
Logger::Debug("Increment syncpoint: {}", +action.index);
|
||||
channelCtx.executor.Execute();
|
||||
state.soc->host1x.syncpoints.at(action.index).Increment();
|
||||
} else if (action.operation == Registers::SyncpointOperation::Wait) {
|
||||
state.logger->Debug("Wait syncpoint: {}, thresh: {}", +action.index, registers.syncpoint.payload);
|
||||
Logger::Debug("Wait syncpoint: {}, thresh: {}", +action.index, registers.syncpoint.payload);
|
||||
|
||||
// Wait forever for another channel to increment
|
||||
state.soc->host1x.syncpoints.at(action.index).Wait(registers.syncpoint.payload, std::chrono::steady_clock::duration::max());
|
||||
|
@ -76,7 +76,7 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
||||
}
|
||||
|
||||
void Maxwell3D::CallMethod(u32 method, u32 argument, bool lastCall) {
|
||||
state.logger->Debug("Called method in Maxwell 3D: 0x{:X} args: 0x{:X}", method, argument);
|
||||
Logger::Debug("Called method in Maxwell 3D: 0x{:X} args: 0x{:X}", method, argument);
|
||||
|
||||
// Methods that are greater than the register size are for macro control
|
||||
if (method >= RegisterCount) [[unlikely]] {
|
||||
@ -248,7 +248,7 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
||||
})
|
||||
|
||||
MAXWELL3D_CASE(syncpointAction, {
|
||||
state.logger->Debug("Increment syncpoint: {}", static_cast<u16>(syncpointAction.id));
|
||||
Logger::Debug("Increment syncpoint: {}", static_cast<u16>(syncpointAction.id));
|
||||
channelCtx.executor.Execute();
|
||||
state.soc->host1x.syncpoints.at(syncpointAction.id).Increment();
|
||||
})
|
||||
@ -270,14 +270,14 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
||||
break;
|
||||
|
||||
default:
|
||||
state.logger->Warn("Unsupported semaphore counter type: 0x{:X}", static_cast<u8>(info.counterType));
|
||||
Logger::Warn("Unsupported semaphore counter type: 0x{:X}", static_cast<u8>(info.counterType));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
state.logger->Warn("Unsupported semaphore operation: 0x{:X}", static_cast<u8>(info.op));
|
||||
Logger::Warn("Unsupported semaphore operation: 0x{:X}", static_cast<u8>(info.op));
|
||||
break;
|
||||
}
|
||||
})
|
||||
|
@ -73,7 +73,7 @@ namespace skyline::soc::gm20b {
|
||||
constexpr u32 TwoDSubChannel{3};
|
||||
constexpr u32 CopySubChannel{4}; // HW forces a memory flush on a switch from this subchannel to others
|
||||
|
||||
state.logger->Debug("Called GPU method - method: 0x{:X} argument: 0x{:X} subchannel: 0x{:X} last: {}", method, argument, subChannel, lastCall);
|
||||
Logger::Debug("Called GPU method - method: 0x{:X} argument: 0x{:X} subchannel: 0x{:X} last: {}", method, argument, subChannel, lastCall);
|
||||
|
||||
if (method < engine::GPFIFO::RegisterCount) {
|
||||
gpfifoEngine.CallMethod(method, argument, lastCall);
|
||||
@ -107,7 +107,7 @@ namespace skyline::soc::gm20b {
|
||||
case GpEntry::Opcode::Nop:
|
||||
return;
|
||||
default:
|
||||
state.logger->Warn("Unsupported GpEntry control opcode used: {}", static_cast<u8>(gpEntry.opcode));
|
||||
Logger::Warn("Unsupported GpEntry control opcode used: {}", static_cast<u8>(gpEntry.opcode));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -220,17 +220,17 @@ namespace skyline::soc::gm20b {
|
||||
signal::SetSignalHandler({SIGINT, SIGILL, SIGTRAP, SIGBUS, SIGFPE, SIGSEGV}, signal::ExceptionalSignalHandler);
|
||||
|
||||
gpEntries.Process([this](GpEntry gpEntry) {
|
||||
state.logger->Debug("Processing pushbuffer: 0x{:X}, Size: 0x{:X}", gpEntry.Address(), +gpEntry.size);
|
||||
Logger::Debug("Processing pushbuffer: 0x{:X}, Size: 0x{:X}", gpEntry.Address(), +gpEntry.size);
|
||||
Process(gpEntry);
|
||||
});
|
||||
} catch (const signal::SignalException &e) {
|
||||
if (e.signal != SIGINT) {
|
||||
state.logger->Error("{}\nStack Trace:{}", e.what(), state.loader->GetStackTrace(e.frames));
|
||||
Logger::Error("{}\nStack Trace:{}", e.what(), state.loader->GetStackTrace(e.frames));
|
||||
signal::BlockSignal({SIGINT});
|
||||
state.process->Kill(false);
|
||||
}
|
||||
} catch (const std::exception &e) {
|
||||
state.logger->Error(e.what());
|
||||
Logger::Error(e.what());
|
||||
signal::BlockSignal({SIGINT});
|
||||
state.process->Kill(false);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "host1x.h"
|
||||
|
||||
namespace skyline::soc::host1x {
|
||||
Host1xClass::Host1xClass(const DeviceState &state, SyncpointSet &syncpoints) : state(state), syncpoints(syncpoints) {}
|
||||
Host1xClass::Host1xClass(SyncpointSet &syncpoints) : syncpoints(syncpoints) {}
|
||||
|
||||
void Host1xClass::CallMethod(u32 method, u32 argument) {
|
||||
constexpr static u32 LoadSyncpointPayload32MethodId{0x4E}; //!< See '14.3.2.12 32-Bit Sync Point Comparison Methods' in TRM
|
||||
@ -17,7 +17,7 @@ namespace skyline::soc::host1x {
|
||||
IncrementSyncpointMethod incrSyncpoint{.raw = argument};
|
||||
|
||||
// incrSyncpoint.condition doesn't matter for Host1x class increments
|
||||
state.logger->Debug("Increment syncpoint: {}", incrSyncpoint.index);
|
||||
Logger::Debug("Increment syncpoint: {}", incrSyncpoint.index);
|
||||
syncpoints.at(incrSyncpoint.index).Increment();
|
||||
break;
|
||||
}
|
||||
@ -28,14 +28,14 @@ namespace skyline::soc::host1x {
|
||||
|
||||
case WaitSyncpoint32MethodId: {
|
||||
u32 syncpointId{static_cast<u8>(argument)};
|
||||
state.logger->Debug("Wait syncpoint: {}, thresh: {}", syncpointId, syncpointPayload);
|
||||
Logger::Debug("Wait syncpoint: {}, thresh: {}", syncpointId, syncpointPayload);
|
||||
|
||||
syncpoints.at(syncpointId).Wait(syncpointPayload, std::chrono::steady_clock::duration::max());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
state.logger->Error("Unknown host1x class method called: 0x{:X}", method);
|
||||
Logger::Error("Unknown host1x class method called: 0x{:X}", method);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -12,12 +12,11 @@ namespace skyline::soc::host1x {
|
||||
*/
|
||||
class Host1xClass {
|
||||
private:
|
||||
const DeviceState &state;
|
||||
SyncpointSet &syncpoints;
|
||||
u32 syncpointPayload{}; //!< Holds the current payload for the 32-bit syncpoint comparison methods
|
||||
|
||||
public:
|
||||
Host1xClass(const DeviceState &state, SyncpointSet &syncpoints);
|
||||
Host1xClass(SyncpointSet &syncpoints);
|
||||
|
||||
void CallMethod(u32 method, u32 argument);
|
||||
};
|
||||
|
@ -4,11 +4,10 @@
|
||||
#include "nvdec.h"
|
||||
|
||||
namespace skyline::soc::host1x {
|
||||
NvDecClass::NvDecClass(const DeviceState &state, std::function<void()> opDoneCallback)
|
||||
: state(state),
|
||||
opDoneCallback(std::move(opDoneCallback)) {}
|
||||
NvDecClass::NvDecClass(std::function<void()> opDoneCallback)
|
||||
: opDoneCallback(std::move(opDoneCallback)) {}
|
||||
|
||||
void NvDecClass::CallMethod(u32 method, u32 argument) {
|
||||
state.logger->Warn("Unknown NVDEC class method called: 0x{:X} argument: 0x{:X}", method, argument);
|
||||
Logger::Warn("Unknown NVDEC class method called: 0x{:X} argument: 0x{:X}", method, argument);
|
||||
}
|
||||
}
|
||||
|
@ -11,11 +11,10 @@ namespace skyline::soc::host1x {
|
||||
*/
|
||||
class NvDecClass {
|
||||
private:
|
||||
const DeviceState &state;
|
||||
std::function<void()> opDoneCallback;
|
||||
|
||||
public:
|
||||
NvDecClass(const DeviceState &state, std::function<void()> opDoneCallback);
|
||||
NvDecClass(std::function<void()> opDoneCallback);
|
||||
|
||||
void CallMethod(u32 method, u32 argument);
|
||||
};
|
||||
|
@ -4,11 +4,10 @@
|
||||
#include "vic.h"
|
||||
|
||||
namespace skyline::soc::host1x {
|
||||
VicClass::VicClass(const DeviceState &state, std::function<void()> opDoneCallback)
|
||||
: state(state),
|
||||
opDoneCallback(std::move(opDoneCallback)) {}
|
||||
VicClass::VicClass(std::function<void()> opDoneCallback)
|
||||
: opDoneCallback(std::move(opDoneCallback)) {}
|
||||
|
||||
void VicClass::CallMethod(u32 method, u32 argument) {
|
||||
state.logger->Warn("Unknown VIC class method called: 0x{:X} argument: 0x{:X}", method, argument);
|
||||
Logger::Warn("Unknown VIC class method called: 0x{:X} argument: 0x{:X}", method, argument);
|
||||
}
|
||||
}
|
||||
|
@ -11,11 +11,10 @@ namespace skyline::soc::host1x {
|
||||
*/
|
||||
class VicClass {
|
||||
private:
|
||||
const DeviceState &state;
|
||||
std::function<void()> opDoneCallback;
|
||||
|
||||
public:
|
||||
VicClass(const DeviceState &state, std::function<void()> opDoneCallback);
|
||||
VicClass(std::function<void()> opDoneCallback);
|
||||
|
||||
void CallMethod(u32 method, u32 argument);
|
||||
};
|
||||
|
@ -44,10 +44,10 @@ namespace skyline::soc::host1x {
|
||||
};
|
||||
static_assert(sizeof(ChannelCommandFifoMethodHeader) == sizeof(u32));
|
||||
|
||||
ChannelCommandFifo::ChannelCommandFifo(const DeviceState &state, SyncpointSet &syncpoints) : state(state), gatherQueue(GatherQueueSize), host1XClass(state, syncpoints), nvDecClass(state, syncpoints), vicClass(state, syncpoints) {}
|
||||
ChannelCommandFifo::ChannelCommandFifo(const DeviceState &state, SyncpointSet &syncpoints) : state(state), gatherQueue(GatherQueueSize), host1XClass(syncpoints), nvDecClass(syncpoints), vicClass(syncpoints) {}
|
||||
|
||||
void ChannelCommandFifo::Send(ClassId targetClass, u32 method, u32 argument) {
|
||||
state.logger->Verbose("Calling method in class: 0x{:X}, method: 0x{:X}, argument: 0x{:X}", targetClass, method, argument);
|
||||
Logger::Verbose("Calling method in class: 0x{:X}, method: 0x{:X}, argument: 0x{:X}", targetClass, method, argument);
|
||||
|
||||
switch (targetClass) {
|
||||
case ClassId::Host1x:
|
||||
@ -60,7 +60,7 @@ namespace skyline::soc::host1x {
|
||||
vicClass.CallMethod(method, argument);
|
||||
break;
|
||||
default:
|
||||
state.logger->Error("Sending method to unimplemented class: 0x{:X}", targetClass);
|
||||
Logger::Error("Sending method to unimplemented class: 0x{:X}", targetClass);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -118,17 +118,17 @@ namespace skyline::soc::host1x {
|
||||
signal::SetSignalHandler({SIGINT, SIGILL, SIGTRAP, SIGBUS, SIGFPE, SIGSEGV}, signal::ExceptionalSignalHandler);
|
||||
|
||||
gatherQueue.Process([this](span<u32> gather) {
|
||||
state.logger->Debug("Processing pushbuffer: 0x{:X}, size: 0x{:X}", gather.data(), gather.size());
|
||||
Logger::Debug("Processing pushbuffer: 0x{:X}, size: 0x{:X}", gather.data(), gather.size());
|
||||
Process(gather);
|
||||
});
|
||||
} catch (const signal::SignalException &e) {
|
||||
if (e.signal != SIGINT) {
|
||||
state.logger->Error("{}\nStack Trace:{}", e.what(), state.loader->GetStackTrace(e.frames));
|
||||
Logger::Error("{}\nStack Trace:{}", e.what(), state.loader->GetStackTrace(e.frames));
|
||||
signal::BlockSignal({SIGINT});
|
||||
state.process->Kill(false);
|
||||
}
|
||||
} catch (const std::exception &e) {
|
||||
state.logger->Error(e.what());
|
||||
Logger::Error(e.what());
|
||||
signal::BlockSignal({SIGINT});
|
||||
state.process->Kill(false);
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ namespace skyline::soc::host1x {
|
||||
template<typename ClassType>
|
||||
class TegraHostInterface {
|
||||
private:
|
||||
const DeviceState &state;
|
||||
SyncpointSet &syncpoints;
|
||||
ClassType deviceClass; //!< The device class behind the THI, such as NVDEC or VIC
|
||||
|
||||
@ -31,15 +30,14 @@ namespace skyline::soc::host1x {
|
||||
u32 syncpointId{incrQueue.front()};
|
||||
incrQueue.pop();
|
||||
|
||||
state.logger->Debug("Increment syncpoint: {}", syncpointId);
|
||||
Logger::Debug("Increment syncpoint: {}", syncpointId);
|
||||
syncpoints.at(syncpointId).Increment();
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
TegraHostInterface(const DeviceState &state, SyncpointSet &syncpoints)
|
||||
: state(state),
|
||||
deviceClass(state, [&] { SubmitPendingIncrs(); }),
|
||||
TegraHostInterface(SyncpointSet &syncpoints)
|
||||
: deviceClass([&] { SubmitPendingIncrs(); }),
|
||||
syncpoints(syncpoints) {}
|
||||
|
||||
void CallMethod(u32 method, u32 argument) {
|
||||
@ -52,16 +50,16 @@ namespace skyline::soc::host1x {
|
||||
|
||||
switch (incrSyncpoint.condition) {
|
||||
case IncrementSyncpointMethod::Condition::Immediate:
|
||||
state.logger->Debug("Increment syncpoint: {}", incrSyncpoint.index);
|
||||
Logger::Debug("Increment syncpoint: {}", incrSyncpoint.index);
|
||||
syncpoints.at(incrSyncpoint.index).Increment();
|
||||
break;
|
||||
case IncrementSyncpointMethod::Condition::OpDone:
|
||||
state.logger->Debug("Queue syncpoint for OpDone: {}", incrSyncpoint.index);
|
||||
Logger::Debug("Queue syncpoint for OpDone: {}", incrSyncpoint.index);
|
||||
incrQueue.push(incrSyncpoint.index);
|
||||
|
||||
SubmitPendingIncrs(); // FIXME: immediately submit the incrs as classes are not yet implemented
|
||||
default:
|
||||
state.logger->Warn("Unimplemented syncpoint condition: {}", static_cast<u8>(incrSyncpoint.condition));
|
||||
Logger::Warn("Unimplemented syncpoint condition: {}", static_cast<u8>(incrSyncpoint.condition));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -73,7 +71,7 @@ namespace skyline::soc::host1x {
|
||||
deviceClass.CallMethod(storedMethod, argument);
|
||||
break;
|
||||
default:
|
||||
state.logger->Error("Unknown THI method called: 0x{:X}, argument: 0x{:X}", method, argument);
|
||||
Logger::Error("Unknown THI method called: 0x{:X}, argument: 0x{:X}", method, argument);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace skyline::vfs {
|
||||
};
|
||||
}
|
||||
|
||||
NPDM::NPDM(const std::shared_ptr<vfs::Backing> &backing, const DeviceState &state) {
|
||||
NPDM::NPDM(const std::shared_ptr<vfs::Backing> &backing) {
|
||||
meta = backing->Read<NpdmMeta>();
|
||||
if (meta.magic != MetaMagic)
|
||||
throw exception("NPDM Meta Magic isn't correct: 0x{:X} (\"META\" = 0x{:X})", meta.magic, MetaMagic);
|
||||
@ -77,6 +77,6 @@ namespace skyline::vfs {
|
||||
if (!threadInfo.coreMask.test(meta.idealCore))
|
||||
throw exception("NPDM Ideal Core isn't valid: {} ({})", meta.idealCore, threadInfo.coreMask);
|
||||
|
||||
state.logger->Debug("NPDM Metadata:\nTitle: ID: {:X}, Version: {}\nMain Thread: Priority: {}, Stack Size: 0x{:X}\nScheduler: Ideal Core: {}, Core Mask: {}, Priority: {} - {}\nKernel Version: v{}.{}", aci0.programId, meta.version, meta.mainThreadPriority, meta.mainThreadStackSize, meta.idealCore, threadInfo.coreMask, threadInfo.priority.min, threadInfo.priority.max, kernelVersion.majorVersion, kernelVersion.minorVersion);
|
||||
Logger::Debug("NPDM Metadata:\nTitle: ID: {:X}, Version: {}\nMain Thread: Priority: {}, Stack Size: 0x{:X}\nScheduler: Ideal Core: {}, Core Mask: {}, Priority: {} - {}\nKernel Version: v{}.{}", aci0.programId, meta.version, meta.mainThreadPriority, meta.mainThreadStackSize, meta.idealCore, threadInfo.coreMask, threadInfo.priority.min, threadInfo.priority.max, kernelVersion.majorVersion, kernelVersion.minorVersion);
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ namespace skyline {
|
||||
public:
|
||||
NPDM();
|
||||
|
||||
NPDM(const std::shared_ptr<vfs::Backing> &backing, const DeviceState &state);
|
||||
NPDM(const std::shared_ptr<vfs::Backing> &backing);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user