Reduce log levels for some FS functions and stub cache svcs (#51)

This commit is contained in:
PabloMK7 2024-04-05 13:49:36 +02:00 committed by GitHub
parent 7fc382479d
commit 775ceac27d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 51 additions and 15 deletions

View file

@ -128,14 +128,14 @@ public:
LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point); LOG_CRITICAL(Service_FS, "(unreachable) Invalid mount point {}", mount_point);
return ResultFileNotFound; return ResultFileNotFound;
case PathParser::PathNotFound: case PathParser::PathNotFound:
LOG_ERROR(Service_FS, "Path not found {}", full_path); LOG_DEBUG(Service_FS, "Path not found {}", full_path);
return ResultPathNotFound; return ResultPathNotFound;
case PathParser::FileInPath: case PathParser::FileInPath:
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
LOG_ERROR(Service_FS, "Unexpected file or directory in {}", full_path); LOG_DEBUG(Service_FS, "Unexpected file or directory in {}", full_path);
return ResultUnexpectedFileOrDirectory; return ResultUnexpectedFileOrDirectory;
case PathParser::NotFound: case PathParser::NotFound:
LOG_ERROR(Service_FS, "{} not found", full_path); LOG_DEBUG(Service_FS, "{} not found", full_path);
return ResultFileNotFound; return ResultFileNotFound;
case PathParser::FileFound: case PathParser::FileFound:
break; // Expected 'success' case break; // Expected 'success' case

View file

@ -83,14 +83,14 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& pa
return ResultNotFound; return ResultNotFound;
case PathParser::PathNotFound: case PathParser::PathNotFound:
case PathParser::FileInPath: case PathParser::FileInPath:
LOG_ERROR(Service_FS, "Path not found {}", full_path); LOG_DEBUG(Service_FS, "Path not found {}", full_path);
return ResultNotFound; return ResultNotFound;
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
LOG_ERROR(Service_FS, "{} is not a file", full_path); LOG_DEBUG(Service_FS, "{} is not a file", full_path);
return ResultUnexpectedFileOrDirectorySdmc; return ResultUnexpectedFileOrDirectorySdmc;
case PathParser::NotFound: case PathParser::NotFound:
if (!mode.create_flag) { if (!mode.create_flag) {
LOG_ERROR(Service_FS, "Non-existing file {} can't be open without mode create.", LOG_DEBUG(Service_FS, "Non-existing file {} can't be open without mode create.",
full_path); full_path);
return ResultNotFound; return ResultNotFound;
} else { } else {
@ -348,10 +348,10 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SDMCArchive::OpenDirectory(const Pa
case PathParser::PathNotFound: case PathParser::PathNotFound:
case PathParser::NotFound: case PathParser::NotFound:
case PathParser::FileFound: case PathParser::FileFound:
LOG_ERROR(Service_FS, "{} not found", full_path); LOG_DEBUG(Service_FS, "{} not found", full_path);
return ResultNotFound; return ResultNotFound;
case PathParser::FileInPath: case PathParser::FileInPath:
LOG_ERROR(Service_FS, "Unexpected file in path {}", full_path); LOG_DEBUG(Service_FS, "Unexpected file in path {}", full_path);
return ResultUnexpectedFileOrDirectorySdmc; return ResultUnexpectedFileOrDirectorySdmc;
case PathParser::DirectoryFound: case PathParser::DirectoryFound:
break; // Expected 'success' case break; // Expected 'success' case

View file

@ -396,6 +396,9 @@ private:
s64 nano_seconds); s64 nano_seconds);
Result ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_count, Result ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_count,
Handle reply_target); Handle reply_target);
Result InvalidateProcessDataCache(Handle process_handle, VAddr address, u32 size);
Result StoreProcessDataCache(Handle process_handle, VAddr address, u32 size);
Result FlushProcessDataCache(Handle process_handle, VAddr address, u32 size);
Result CreateAddressArbiter(Handle* out_handle); Result CreateAddressArbiter(Handle* out_handle);
Result ArbitrateAddress(Handle handle, u32 address, u32 type, u32 value, s64 nanoseconds); Result ArbitrateAddress(Handle handle, u32 address, u32 type, u32 value, s64 nanoseconds);
void Break(u8 break_reason); void Break(u8 break_reason);
@ -1019,6 +1022,39 @@ Result SVC::ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_count,
return ResultSuccess; return ResultSuccess;
} }
/// Invalidates the specified cache range (stubbed as we do not emulate cache).
Result SVC::InvalidateProcessDataCache(Handle process_handle, VAddr address, u32 size) {
const std::shared_ptr<Process> process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(process_handle);
R_UNLESS(process, ResultInvalidHandle);
LOG_DEBUG(Kernel_SVC, "called address=0x{:08X}, size=0x{:08X}", address, size);
return ResultSuccess;
}
/// Stores the specified cache range (stubbed as we do not emulate cache).
Result SVC::StoreProcessDataCache(Handle process_handle, VAddr address, u32 size) {
const std::shared_ptr<Process> process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(process_handle);
R_UNLESS(process, ResultInvalidHandle);
LOG_DEBUG(Kernel_SVC, "called address=0x{:08X}, size=0x{:08X}", address, size);
return ResultSuccess;
}
/// Flushes the specified cache range (stubbed as we do not emulate cache).
Result SVC::FlushProcessDataCache(Handle process_handle, VAddr address, u32 size) {
const std::shared_ptr<Process> process =
kernel.GetCurrentProcess()->handle_table.Get<Process>(process_handle);
R_UNLESS(process, ResultInvalidHandle);
LOG_DEBUG(Kernel_SVC, "called address=0x{:08X}, size=0x{:08X}", address, size);
return ResultSuccess;
}
/// Create an address arbiter (to allocate access to shared resources) /// Create an address arbiter (to allocate access to shared resources)
Result SVC::CreateAddressArbiter(Handle* out_handle) { Result SVC::CreateAddressArbiter(Handle* out_handle) {
// Update address arbiter count in resource limit. // Update address arbiter count in resource limit.
@ -2157,9 +2193,9 @@ const std::array<SVC::FunctionDef, 180> SVC::SVC_Table{{
{0x4F, &SVC::Wrap<&SVC::ReplyAndReceive>, "ReplyAndReceive"}, {0x4F, &SVC::Wrap<&SVC::ReplyAndReceive>, "ReplyAndReceive"},
{0x50, nullptr, "BindInterrupt"}, {0x50, nullptr, "BindInterrupt"},
{0x51, nullptr, "UnbindInterrupt"}, {0x51, nullptr, "UnbindInterrupt"},
{0x52, nullptr, "InvalidateProcessDataCache"}, {0x52, &SVC::Wrap<&SVC::InvalidateProcessDataCache>, "InvalidateProcessDataCache"},
{0x53, nullptr, "StoreProcessDataCache"}, {0x53, &SVC::Wrap<&SVC::StoreProcessDataCache>, "StoreProcessDataCache"},
{0x54, nullptr, "FlushProcessDataCache"}, {0x54, &SVC::Wrap<&SVC::FlushProcessDataCache>, "FlushProcessDataCache"},
{0x55, nullptr, "StartInterProcessDma"}, {0x55, nullptr, "StartInterProcessDma"},
{0x56, nullptr, "StopDma"}, {0x56, nullptr, "StopDma"},
{0x57, nullptr, "GetDmaState"}, {0x57, nullptr, "GetDmaState"},

View file

@ -62,7 +62,7 @@ void File::Read(Kernel::HLERequestContext& ctx) {
const FileSessionSlot* file = GetSessionData(ctx.Session()); const FileSessionSlot* file = GetSessionData(ctx.Session());
if (file->subfile && length > file->size) { if (file->subfile && length > file->size) {
LOG_WARNING(Service_FS, "Trying to read beyond the subfile size, truncating"); LOG_DEBUG(Service_FS, "Trying to read beyond the subfile size, truncating");
length = static_cast<u32>(file->size); length = static_cast<u32>(file->size);
} }
@ -70,7 +70,7 @@ void File::Read(Kernel::HLERequestContext& ctx) {
offset += file->offset; offset += file->offset;
if (offset + length > backend->GetSize()) { if (offset + length > backend->GetSize()) {
LOG_ERROR(Service_FS, LOG_DEBUG(Service_FS,
"Reading from out of bounds offset=0x{:x} length=0x{:08X} file_size=0x{:x}", "Reading from out of bounds offset=0x{:x} length=0x{:08X} file_size=0x{:x}",
offset, length, backend->GetSize()); offset, length, backend->GetSize());
} }

View file

@ -121,7 +121,7 @@ void FS_USER::OpenFileDirectly(Kernel::HLERequestContext& ctx) {
rb.PushMoveObjects(file->Connect()); rb.PushMoveObjects(file->Connect());
} else { } else {
rb.PushMoveObjects<Kernel::Object>(nullptr); rb.PushMoveObjects<Kernel::Object>(nullptr);
LOG_ERROR(Service_FS, "failed to get a handle for file {} mode={} attributes={}", LOG_DEBUG(Service_FS, "failed to get a handle for file {} mode={} attributes={}",
file_path.DebugStr(), mode.hex, attributes); file_path.DebugStr(), mode.hex, attributes);
} }
@ -301,7 +301,7 @@ void FS_USER::OpenDirectory(Kernel::HLERequestContext& ctx) {
directory->ClientConnected(server); directory->ClientConnected(server);
rb.PushMoveObjects(client); rb.PushMoveObjects(client);
} else { } else {
LOG_ERROR(Service_FS, "failed to get a handle for directory type={} size={} data={}", LOG_DEBUG(Service_FS, "failed to get a handle for directory type={} size={} data={}",
dirname_type, dirname_size, dir_path.DebugStr()); dirname_type, dirname_size, dir_path.DebugStr());
rb.PushMoveObjects<Kernel::Object>(nullptr); rb.PushMoveObjects<Kernel::Object>(nullptr);
} }