diff options
| author | 2015-04-09 00:11:03 -0700 | |
|---|---|---|
| committer | 2015-04-27 23:07:08 -0700 | |
| commit | c3a480160e3f9a7bbdf4c29e937fedb7159ecbcc (patch) | |
| tree | f1a8070e19193c0f93c20eb0544512251e3d9609 | |
| parent | Merge pull request #689 from lioncash/format (diff) | |
| download | yuzu-c3a480160e3f9a7bbdf4c29e937fedb7159ecbcc.tar.gz yuzu-c3a480160e3f9a7bbdf4c29e937fedb7159ecbcc.tar.xz yuzu-c3a480160e3f9a7bbdf4c29e937fedb7159ecbcc.zip | |
Services/Loader: Use more sensible log formats for certain functions
along with more info being logged.
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/cfg/cfg.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/dsp_dsp.cpp | 26 | ||||
| -rw-r--r-- | src/core/loader/ncch.cpp | 33 | ||||
| -rw-r--r-- | src/core/loader/ncch.h | 18 |
4 files changed, 59 insertions, 22 deletions
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index fe1245fe8..6af0352ac 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp | |||
| @@ -53,12 +53,12 @@ ResultCode GetConfigInfoBlock(u32 block_id, u32 size, u32 flag, u8* output) { | |||
| 53 | }); | 53 | }); |
| 54 | 54 | ||
| 55 | if (itr == std::end(config->block_entries)) { | 55 | if (itr == std::end(config->block_entries)) { |
| 56 | LOG_ERROR(Service_CFG, "Config block %u with flags %u was not found", block_id, flag); | 56 | LOG_ERROR(Service_CFG, "Config block 0x%X with flags %u and size %u was not found", block_id, flag, size); |
| 57 | return ResultCode(ErrorDescription::NotFound, ErrorModule::Config, ErrorSummary::WrongArgument, ErrorLevel::Permanent); | 57 | return ResultCode(ErrorDescription::NotFound, ErrorModule::Config, ErrorSummary::WrongArgument, ErrorLevel::Permanent); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | if (itr->size != size) { | 60 | if (itr->size != size) { |
| 61 | LOG_ERROR(Service_CFG, "Invalid size %u for config block %u with flags %u", size, block_id, flag); | 61 | LOG_ERROR(Service_CFG, "Invalid size %u for config block 0x%X with flags %u", size, block_id, flag); |
| 62 | return ResultCode(ErrorDescription::InvalidSize, ErrorModule::Config, ErrorSummary::WrongArgument, ErrorLevel::Permanent); | 62 | return ResultCode(ErrorDescription::InvalidSize, ErrorModule::Config, ErrorSummary::WrongArgument, ErrorLevel::Permanent); |
| 63 | } | 63 | } |
| 64 | 64 | ||
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp index f16f84e67..4d6c70f4d 100644 --- a/src/core/hle/service/dsp_dsp.cpp +++ b/src/core/hle/service/dsp_dsp.cpp | |||
| @@ -42,7 +42,7 @@ static void ConvertProcessAddressFromDspDram(Service::Interface* self) { | |||
| 42 | cmd_buff[1] = 0; // No error | 42 | cmd_buff[1] = 0; // No error |
| 43 | cmd_buff[2] = (addr << 1) + (Memory::DSP_MEMORY_VADDR + 0x40000); | 43 | cmd_buff[2] = (addr << 1) + (Memory::DSP_MEMORY_VADDR + 0x40000); |
| 44 | 44 | ||
| 45 | LOG_WARNING(Service_DSP, "(STUBBED) called with address %u", addr); | 45 | LOG_WARNING(Service_DSP, "(STUBBED) called with address 0x%08X", addr); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | /** | 48 | /** |
| @@ -60,12 +60,19 @@ static void ConvertProcessAddressFromDspDram(Service::Interface* self) { | |||
| 60 | static void LoadComponent(Service::Interface* self) { | 60 | static void LoadComponent(Service::Interface* self) { |
| 61 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 61 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 62 | 62 | ||
| 63 | u32 size = cmd_buff[1]; | ||
| 64 | u32 unk1 = cmd_buff[2]; | ||
| 65 | u32 unk2 = cmd_buff[3]; | ||
| 66 | u32 new_size = cmd_buff[4]; | ||
| 67 | u32 buffer = cmd_buff[5]; | ||
| 68 | |||
| 63 | cmd_buff[1] = 0; // No error | 69 | cmd_buff[1] = 0; // No error |
| 64 | cmd_buff[2] = 1; // Pretend that we actually loaded the DSP firmware | 70 | cmd_buff[2] = 1; // Pretend that we actually loaded the DSP firmware |
| 65 | 71 | ||
| 66 | // TODO(bunnei): Implement real DSP firmware loading | 72 | // TODO(bunnei): Implement real DSP firmware loading |
| 67 | 73 | ||
| 68 | LOG_WARNING(Service_DSP, "(STUBBED) called"); | 74 | LOG_WARNING(Service_DSP, "(STUBBED) called size=0x%X, unk1=0x%08X, unk2=0x%08X, new_size=0x%X, buffer=0x%08X", |
| 75 | size, unk1, unk2, new_size, buffer); | ||
| 69 | } | 76 | } |
| 70 | 77 | ||
| 71 | /** | 78 | /** |
| @@ -106,7 +113,7 @@ static void FlushDataCache(Service::Interface* self) { | |||
| 106 | 113 | ||
| 107 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | 114 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error |
| 108 | 115 | ||
| 109 | LOG_DEBUG(Service_DSP, "(STUBBED) called address=0x%08X, size=0x%08X, process=0x%08X", | 116 | LOG_DEBUG(Service_DSP, "(STUBBED) called address=0x%08X, size=0x%X, process=0x%08X", |
| 110 | address, size, process); | 117 | address, size, process); |
| 111 | } | 118 | } |
| 112 | 119 | ||
| @@ -122,6 +129,10 @@ static void FlushDataCache(Service::Interface* self) { | |||
| 122 | static void RegisterInterruptEvents(Service::Interface* self) { | 129 | static void RegisterInterruptEvents(Service::Interface* self) { |
| 123 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 130 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 124 | 131 | ||
| 132 | u32 param0 = cmd_buff[1]; | ||
| 133 | u32 param1 = cmd_buff[2]; | ||
| 134 | u32 event_handle = cmd_buff[4]; | ||
| 135 | |||
| 125 | auto evt = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]); | 136 | auto evt = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]); |
| 126 | if (evt != nullptr) { | 137 | if (evt != nullptr) { |
| 127 | interrupt_event = evt; | 138 | interrupt_event = evt; |
| @@ -133,7 +144,7 @@ static void RegisterInterruptEvents(Service::Interface* self) { | |||
| 133 | cmd_buff[1] = -1; | 144 | cmd_buff[1] = -1; |
| 134 | } | 145 | } |
| 135 | 146 | ||
| 136 | LOG_WARNING(Service_DSP, "(STUBBED) called"); | 147 | LOG_WARNING(Service_DSP, "(STUBBED) called param0=%u, param1=%u, event_handle=0x%08X", param0, param1, event_handle); |
| 137 | } | 148 | } |
| 138 | 149 | ||
| 139 | /** | 150 | /** |
| @@ -174,7 +185,7 @@ static void WriteProcessPipe(Service::Interface* self) { | |||
| 174 | 185 | ||
| 175 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | 186 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error |
| 176 | 187 | ||
| 177 | LOG_WARNING(Service_DSP, "(STUBBED) called number=%u, size=0x%08X, new_size=0x%08X, buffer=0x%08X", | 188 | LOG_WARNING(Service_DSP, "(STUBBED) called number=%u, size=0x%X, new_size=0x%X, buffer=0x%08X", |
| 178 | number, size, new_size, buffer); | 189 | number, size, new_size, buffer); |
| 179 | } | 190 | } |
| 180 | 191 | ||
| @@ -192,6 +203,8 @@ static void WriteProcessPipe(Service::Interface* self) { | |||
| 192 | static void ReadPipeIfPossible(Service::Interface* self) { | 203 | static void ReadPipeIfPossible(Service::Interface* self) { |
| 193 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 204 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 194 | 205 | ||
| 206 | u32 unk1 = cmd_buff[1]; | ||
| 207 | u32 unk2 = cmd_buff[2]; | ||
| 195 | u32 size = cmd_buff[3] & 0xFFFF;// Lower 16 bits are size | 208 | u32 size = cmd_buff[3] & 0xFFFF;// Lower 16 bits are size |
| 196 | VAddr addr = cmd_buff[0x41]; | 209 | VAddr addr = cmd_buff[0x41]; |
| 197 | 210 | ||
| @@ -217,7 +230,8 @@ static void ReadPipeIfPossible(Service::Interface* self) { | |||
| 217 | cmd_buff[1] = 0; // No error | 230 | cmd_buff[1] = 0; // No error |
| 218 | cmd_buff[2] = (read_pipe_count - initial_size) * sizeof(u16); | 231 | cmd_buff[2] = (read_pipe_count - initial_size) * sizeof(u16); |
| 219 | 232 | ||
| 220 | LOG_WARNING(Service_DSP, "(STUBBED) called size=0x%08X, buffer=0x%08X", size, addr); | 233 | LOG_WARNING(Service_DSP, "(STUBBED) called unk1=0x%08X, unk2=0x%08X, size=0x%X, buffer=0x%08X", |
| 234 | unk1, unk2, size, addr); | ||
| 221 | } | 235 | } |
| 222 | 236 | ||
| 223 | /** | 237 | /** |
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index aaaa4d650..4efed78bf 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp | |||
| @@ -198,20 +198,33 @@ ResultStatus AppLoader_NCCH::Load() { | |||
| 198 | if (file->ReadBytes(&exheader_header, sizeof(ExHeader_Header)) != sizeof(ExHeader_Header)) | 198 | if (file->ReadBytes(&exheader_header, sizeof(ExHeader_Header)) != sizeof(ExHeader_Header)) |
| 199 | return ResultStatus::Error; | 199 | return ResultStatus::Error; |
| 200 | 200 | ||
| 201 | is_compressed = (exheader_header.codeset_info.flags.flag & 1) == 1; | 201 | is_compressed = (exheader_header.codeset_info.flags.flag & 1) == 1; |
| 202 | entry_point = exheader_header.codeset_info.text.address; | 202 | entry_point = exheader_header.codeset_info.text.address; |
| 203 | 203 | code_size = exheader_header.codeset_info.text.code_size; | |
| 204 | LOG_INFO(Loader, "Name: %s", exheader_header.codeset_info.name); | 204 | stack_size = exheader_header.codeset_info.stack_size; |
| 205 | LOG_DEBUG(Loader, "Code compressed: %s", is_compressed ? "yes" : "no"); | 205 | bss_size = exheader_header.codeset_info.bss_size; |
| 206 | LOG_DEBUG(Loader, "Entry point: 0x%08X", entry_point); | 206 | core_version = exheader_header.arm11_system_local_caps.core_version; |
| 207 | priority = exheader_header.arm11_system_local_caps.priority; | ||
| 208 | resource_limit_category = exheader_header.arm11_system_local_caps.resource_limit_category; | ||
| 209 | |||
| 210 | LOG_INFO(Loader, "Name: %s" , exheader_header.codeset_info.name); | ||
| 211 | LOG_DEBUG(Loader, "Code compressed: %s" , is_compressed ? "yes" : "no"); | ||
| 212 | LOG_DEBUG(Loader, "Entry point: 0x%08X", entry_point); | ||
| 213 | LOG_DEBUG(Loader, "Code size: 0x%08X", code_size); | ||
| 214 | LOG_DEBUG(Loader, "Stack size: 0x%08X", stack_size); | ||
| 215 | LOG_DEBUG(Loader, "Bss size: 0x%08X", bss_size); | ||
| 216 | LOG_DEBUG(Loader, "Core version: %d" , core_version); | ||
| 217 | LOG_DEBUG(Loader, "Thread priority: 0x%X" , priority); | ||
| 218 | LOG_DEBUG(Loader, "Resource limit descriptor: 0x%08X", exheader_header.arm11_system_local_caps.resource_limit_descriptor); | ||
| 219 | LOG_DEBUG(Loader, "Resource limit category: %d" , resource_limit_category); | ||
| 207 | 220 | ||
| 208 | // Read ExeFS... | 221 | // Read ExeFS... |
| 209 | 222 | ||
| 210 | exefs_offset = ncch_header.exefs_offset * kBlockSize; | 223 | exefs_offset = ncch_header.exefs_offset * kBlockSize; |
| 211 | u32 exefs_size = ncch_header.exefs_size * kBlockSize; | 224 | u32 exefs_size = ncch_header.exefs_size * kBlockSize; |
| 212 | 225 | ||
| 213 | LOG_DEBUG(Loader, "ExeFS offset: 0x%08X", exefs_offset); | 226 | LOG_DEBUG(Loader, "ExeFS offset: 0x%08X", exefs_offset); |
| 214 | LOG_DEBUG(Loader, "ExeFS size: 0x%08X", exefs_size); | 227 | LOG_DEBUG(Loader, "ExeFS size: 0x%08X", exefs_size); |
| 215 | 228 | ||
| 216 | file->Seek(exefs_offset + ncch_offset, SEEK_SET); | 229 | file->Seek(exefs_offset + ncch_offset, SEEK_SET); |
| 217 | if (file->ReadBytes(&exefs_header, sizeof(ExeFs_Header)) != sizeof(ExeFs_Header)) | 230 | if (file->ReadBytes(&exefs_header, sizeof(ExeFs_Header)) != sizeof(ExeFs_Header)) |
| @@ -247,8 +260,8 @@ ResultStatus AppLoader_NCCH::ReadRomFS(std::vector<u8>& buffer) const { | |||
| 247 | u32 romfs_offset = ncch_offset + (ncch_header.romfs_offset * kBlockSize) + 0x1000; | 260 | u32 romfs_offset = ncch_offset + (ncch_header.romfs_offset * kBlockSize) + 0x1000; |
| 248 | u32 romfs_size = (ncch_header.romfs_size * kBlockSize) - 0x1000; | 261 | u32 romfs_size = (ncch_header.romfs_size * kBlockSize) - 0x1000; |
| 249 | 262 | ||
| 250 | LOG_DEBUG(Loader, "RomFS offset: 0x%08X", romfs_offset); | 263 | LOG_DEBUG(Loader, "RomFS offset: 0x%08X", romfs_offset); |
| 251 | LOG_DEBUG(Loader, "RomFS size: 0x%08X", romfs_size); | 264 | LOG_DEBUG(Loader, "RomFS size: 0x%08X", romfs_size); |
| 252 | 265 | ||
| 253 | buffer.resize(romfs_size); | 266 | buffer.resize(romfs_size); |
| 254 | 267 | ||
diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index f6f670060..3dd151dbd 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h | |||
| @@ -43,6 +43,8 @@ struct NCCH_Header { | |||
| 43 | u8 romfs_super_block_hash[0x20]; | 43 | u8 romfs_super_block_hash[0x20]; |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | static_assert(sizeof(NCCH_Header) == 0x200, "NCCH header structure size is wrong"); | ||
| 47 | |||
| 46 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 48 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 47 | // ExeFS (executable file system) headers | 49 | // ExeFS (executable file system) headers |
| 48 | 50 | ||
| @@ -77,11 +79,11 @@ struct ExHeader_CodeSetInfo { | |||
| 77 | u8 name[8]; | 79 | u8 name[8]; |
| 78 | ExHeader_SystemInfoFlags flags; | 80 | ExHeader_SystemInfoFlags flags; |
| 79 | ExHeader_CodeSegmentInfo text; | 81 | ExHeader_CodeSegmentInfo text; |
| 80 | u8 stacksize[4]; | 82 | u32 stack_size; |
| 81 | ExHeader_CodeSegmentInfo ro; | 83 | ExHeader_CodeSegmentInfo ro; |
| 82 | u8 reserved[4]; | 84 | u8 reserved[4]; |
| 83 | ExHeader_CodeSegmentInfo data; | 85 | ExHeader_CodeSegmentInfo data; |
| 84 | u8 bsssize[4]; | 86 | u32 bss_size; |
| 85 | }; | 87 | }; |
| 86 | 88 | ||
| 87 | struct ExHeader_DependencyList{ | 89 | struct ExHeader_DependencyList{ |
| @@ -107,9 +109,9 @@ struct ExHeader_ARM11_SystemLocalCaps{ | |||
| 107 | u32 core_version; | 109 | u32 core_version; |
| 108 | u8 flags[3]; | 110 | u8 flags[3]; |
| 109 | u8 priority; | 111 | u8 priority; |
| 110 | u8 resource_limit_descriptor[0x16][2]; | 112 | u8 resource_limit_descriptor[0x10][2]; |
| 111 | ExHeader_StorageInfo storage_info; | 113 | ExHeader_StorageInfo storage_info; |
| 112 | u8 service_access_control[0x32][8]; | 114 | u8 service_access_control[0x20][8]; |
| 113 | u8 ex_service_access_control[0x2][8]; | 115 | u8 ex_service_access_control[0x2][8]; |
| 114 | u8 reserved[0xf]; | 116 | u8 reserved[0xf]; |
| 115 | u8 resource_limit_category; | 117 | u8 resource_limit_category; |
| @@ -141,6 +143,8 @@ struct ExHeader_Header{ | |||
| 141 | } access_desc; | 143 | } access_desc; |
| 142 | }; | 144 | }; |
| 143 | 145 | ||
| 146 | static_assert(sizeof(ExHeader_Header) == 0x800, "ExHeader structure size is wrong"); | ||
| 147 | |||
| 144 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 148 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 145 | // Loader namespace | 149 | // Loader namespace |
| 146 | 150 | ||
| @@ -224,6 +228,12 @@ private: | |||
| 224 | bool is_compressed = false; | 228 | bool is_compressed = false; |
| 225 | 229 | ||
| 226 | u32 entry_point = 0; | 230 | u32 entry_point = 0; |
| 231 | u32 code_size = 0; | ||
| 232 | u32 stack_size = 0; | ||
| 233 | u32 bss_size = 0; | ||
| 234 | u32 core_version = 0; | ||
| 235 | u8 priority = 0; | ||
| 236 | u8 resource_limit_category = 0; | ||
| 227 | u32 ncch_offset = 0; // Offset to NCCH header, can be 0 or after NCSD header | 237 | u32 ncch_offset = 0; // Offset to NCCH header, can be 0 or after NCSD header |
| 228 | u32 exefs_offset = 0; | 238 | u32 exefs_offset = 0; |
| 229 | 239 | ||