diff options
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/file_sys/program_metadata.cpp | 6 | ||||
| -rw-r--r-- | src/core/file_sys/program_metadata.h | 9 | ||||
| -rw-r--r-- | src/core/hle/service/glue/ectx.cpp | 22 | ||||
| -rw-r--r-- | src/core/hle/service/glue/ectx.h | 21 | ||||
| -rw-r--r-- | src/core/hle/service/glue/glue.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/lm/lm.cpp | 13 | ||||
| -rw-r--r-- | src/core/loader/kip.cpp | 3 |
8 files changed, 70 insertions, 10 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 532e418b0..04cf3f5b9 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -377,6 +377,8 @@ add_library(core STATIC | |||
| 377 | hle/service/glue/arp.h | 377 | hle/service/glue/arp.h |
| 378 | hle/service/glue/bgtc.cpp | 378 | hle/service/glue/bgtc.cpp |
| 379 | hle/service/glue/bgtc.h | 379 | hle/service/glue/bgtc.h |
| 380 | hle/service/glue/ectx.cpp | ||
| 381 | hle/service/glue/ectx.h | ||
| 380 | hle/service/glue/errors.h | 382 | hle/service/glue/errors.h |
| 381 | hle/service/glue/glue.cpp | 383 | hle/service/glue/glue.cpp |
| 382 | hle/service/glue/glue.h | 384 | hle/service/glue/glue.h |
diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp index 9cf49bf44..83b83a044 100644 --- a/src/core/file_sys/program_metadata.cpp +++ b/src/core/file_sys/program_metadata.cpp | |||
| @@ -58,7 +58,8 @@ Loader::ResultStatus ProgramMetadata::Load(VirtualFile file) { | |||
| 58 | result.LoadManual( | 58 | result.LoadManual( |
| 59 | true /*is_64_bit*/, FileSys::ProgramAddressSpaceType::Is39Bit /*address_space*/, | 59 | true /*is_64_bit*/, FileSys::ProgramAddressSpaceType::Is39Bit /*address_space*/, |
| 60 | 0x2c /*main_thread_prio*/, 0 /*main_thread_core*/, 0x00100000 /*main_thread_stack_size*/, | 60 | 0x2c /*main_thread_prio*/, 0 /*main_thread_core*/, 0x00100000 /*main_thread_stack_size*/, |
| 61 | {}, 0xFFFFFFFFFFFFFFFF /*filesystem_permissions*/, {} /*capabilities*/); | 61 | 0 /*title_id*/, 0xFFFFFFFFFFFFFFFF /*filesystem_permissions*/, |
| 62 | 0x1FE00000 /*system_resource_size*/, {} /*capabilities*/); | ||
| 62 | 63 | ||
| 63 | return result; | 64 | return result; |
| 64 | } | 65 | } |
| @@ -66,7 +67,7 @@ Loader::ResultStatus ProgramMetadata::Load(VirtualFile file) { | |||
| 66 | void ProgramMetadata::LoadManual(bool is_64_bit, ProgramAddressSpaceType address_space, | 67 | void ProgramMetadata::LoadManual(bool is_64_bit, ProgramAddressSpaceType address_space, |
| 67 | s32 main_thread_prio, u32 main_thread_core, | 68 | s32 main_thread_prio, u32 main_thread_core, |
| 68 | u32 main_thread_stack_size, u64 title_id, | 69 | u32 main_thread_stack_size, u64 title_id, |
| 69 | u64 filesystem_permissions, | 70 | u64 filesystem_permissions, u32 system_resource_size, |
| 70 | KernelCapabilityDescriptors capabilities) { | 71 | KernelCapabilityDescriptors capabilities) { |
| 71 | npdm_header.has_64_bit_instructions.Assign(is_64_bit); | 72 | npdm_header.has_64_bit_instructions.Assign(is_64_bit); |
| 72 | npdm_header.address_space_type.Assign(address_space); | 73 | npdm_header.address_space_type.Assign(address_space); |
| @@ -75,6 +76,7 @@ void ProgramMetadata::LoadManual(bool is_64_bit, ProgramAddressSpaceType address | |||
| 75 | npdm_header.main_stack_size = main_thread_stack_size; | 76 | npdm_header.main_stack_size = main_thread_stack_size; |
| 76 | aci_header.title_id = title_id; | 77 | aci_header.title_id = title_id; |
| 77 | aci_file_access.permissions = filesystem_permissions; | 78 | aci_file_access.permissions = filesystem_permissions; |
| 79 | npdm_header.system_resource_size = system_resource_size; | ||
| 78 | aci_kernel_capabilities = std ::move(capabilities); | 80 | aci_kernel_capabilities = std ::move(capabilities); |
| 79 | } | 81 | } |
| 80 | 82 | ||
diff --git a/src/core/file_sys/program_metadata.h b/src/core/file_sys/program_metadata.h index 455532567..1eee916be 100644 --- a/src/core/file_sys/program_metadata.h +++ b/src/core/file_sys/program_metadata.h | |||
| @@ -44,6 +44,12 @@ public: | |||
| 44 | ProgramMetadata(); | 44 | ProgramMetadata(); |
| 45 | ~ProgramMetadata(); | 45 | ~ProgramMetadata(); |
| 46 | 46 | ||
| 47 | ProgramMetadata(const ProgramMetadata&) = default; | ||
| 48 | ProgramMetadata& operator=(const ProgramMetadata&) = default; | ||
| 49 | |||
| 50 | ProgramMetadata(ProgramMetadata&&) = default; | ||
| 51 | ProgramMetadata& operator=(ProgramMetadata&&) = default; | ||
| 52 | |||
| 47 | /// Gets a default ProgramMetadata configuration, should only be used for homebrew formats where | 53 | /// Gets a default ProgramMetadata configuration, should only be used for homebrew formats where |
| 48 | /// we do not have an NPDM file | 54 | /// we do not have an NPDM file |
| 49 | static ProgramMetadata GetDefault(); | 55 | static ProgramMetadata GetDefault(); |
| @@ -53,7 +59,8 @@ public: | |||
| 53 | /// Load from parameters instead of NPDM file, used for KIP | 59 | /// Load from parameters instead of NPDM file, used for KIP |
| 54 | void LoadManual(bool is_64_bit, ProgramAddressSpaceType address_space, s32 main_thread_prio, | 60 | void LoadManual(bool is_64_bit, ProgramAddressSpaceType address_space, s32 main_thread_prio, |
| 55 | u32 main_thread_core, u32 main_thread_stack_size, u64 title_id, | 61 | u32 main_thread_core, u32 main_thread_stack_size, u64 title_id, |
| 56 | u64 filesystem_permissions, KernelCapabilityDescriptors capabilities); | 62 | u64 filesystem_permissions, u32 system_resource_size, |
| 63 | KernelCapabilityDescriptors capabilities); | ||
| 57 | 64 | ||
| 58 | bool Is64BitProgram() const; | 65 | bool Is64BitProgram() const; |
| 59 | ProgramAddressSpaceType GetAddressSpaceType() const; | 66 | ProgramAddressSpaceType GetAddressSpaceType() const; |
diff --git a/src/core/hle/service/glue/ectx.cpp b/src/core/hle/service/glue/ectx.cpp new file mode 100644 index 000000000..249c6f003 --- /dev/null +++ b/src/core/hle/service/glue/ectx.cpp | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "core/hle/service/glue/ectx.h" | ||
| 6 | |||
| 7 | namespace Service::Glue { | ||
| 8 | |||
| 9 | ECTX_AW::ECTX_AW(Core::System& system_) : ServiceFramework{system_, "ectx:aw"} { | ||
| 10 | // clang-format off | ||
| 11 | static const FunctionInfo functions[] = { | ||
| 12 | {0, nullptr, "CreateContextRegistrar"}, | ||
| 13 | {1, nullptr, "CommitContext"}, | ||
| 14 | }; | ||
| 15 | // clang-format on | ||
| 16 | |||
| 17 | RegisterHandlers(functions); | ||
| 18 | } | ||
| 19 | |||
| 20 | ECTX_AW::~ECTX_AW() = default; | ||
| 21 | |||
| 22 | } // namespace Service::Glue | ||
diff --git a/src/core/hle/service/glue/ectx.h b/src/core/hle/service/glue/ectx.h new file mode 100644 index 000000000..b275e808a --- /dev/null +++ b/src/core/hle/service/glue/ectx.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "core/hle/service/service.h" | ||
| 8 | |||
| 9 | namespace Core { | ||
| 10 | class System; | ||
| 11 | } | ||
| 12 | |||
| 13 | namespace Service::Glue { | ||
| 14 | |||
| 15 | class ECTX_AW final : public ServiceFramework<ECTX_AW> { | ||
| 16 | public: | ||
| 17 | explicit ECTX_AW(Core::System& system_); | ||
| 18 | ~ECTX_AW() override; | ||
| 19 | }; | ||
| 20 | |||
| 21 | } // namespace Service::Glue | ||
diff --git a/src/core/hle/service/glue/glue.cpp b/src/core/hle/service/glue/glue.cpp index 4eafbe5fa..a08dc9758 100644 --- a/src/core/hle/service/glue/glue.cpp +++ b/src/core/hle/service/glue/glue.cpp | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include "core/core.h" | 6 | #include "core/core.h" |
| 7 | #include "core/hle/service/glue/arp.h" | 7 | #include "core/hle/service/glue/arp.h" |
| 8 | #include "core/hle/service/glue/bgtc.h" | 8 | #include "core/hle/service/glue/bgtc.h" |
| 9 | #include "core/hle/service/glue/ectx.h" | ||
| 9 | #include "core/hle/service/glue/glue.h" | 10 | #include "core/hle/service/glue/glue.h" |
| 10 | 11 | ||
| 11 | namespace Service::Glue { | 12 | namespace Service::Glue { |
| @@ -20,6 +21,9 @@ void InstallInterfaces(Core::System& system) { | |||
| 20 | // BackGround Task Controller | 21 | // BackGround Task Controller |
| 21 | std::make_shared<BGTC_T>(system)->InstallAsService(system.ServiceManager()); | 22 | std::make_shared<BGTC_T>(system)->InstallAsService(system.ServiceManager()); |
| 22 | std::make_shared<BGTC_SC>(system)->InstallAsService(system.ServiceManager()); | 23 | std::make_shared<BGTC_SC>(system)->InstallAsService(system.ServiceManager()); |
| 24 | |||
| 25 | // Error Context | ||
| 26 | std::make_shared<ECTX_AW>(system)->InstallAsService(system.ServiceManager()); | ||
| 23 | } | 27 | } |
| 24 | 28 | ||
| 25 | } // namespace Service::Glue | 29 | } // namespace Service::Glue |
diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index 7d7542fc2..9bcf8870d 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp | |||
| @@ -46,7 +46,7 @@ struct hash<Service::LM::LogPacketHeaderEntry> { | |||
| 46 | boost::hash_combine(seed, k.severity); | 46 | boost::hash_combine(seed, k.severity); |
| 47 | boost::hash_combine(seed, k.verbosity); | 47 | boost::hash_combine(seed, k.verbosity); |
| 48 | return seed; | 48 | return seed; |
| 49 | }; | 49 | } |
| 50 | }; | 50 | }; |
| 51 | } // namespace std | 51 | } // namespace std |
| 52 | 52 | ||
| @@ -95,7 +95,7 @@ private: | |||
| 95 | std::memcpy(&header, data.data(), sizeof(LogPacketHeader)); | 95 | std::memcpy(&header, data.data(), sizeof(LogPacketHeader)); |
| 96 | offset += sizeof(LogPacketHeader); | 96 | offset += sizeof(LogPacketHeader); |
| 97 | 97 | ||
| 98 | LogPacketHeaderEntry entry{ | 98 | const LogPacketHeaderEntry entry{ |
| 99 | .pid = header.pid, | 99 | .pid = header.pid, |
| 100 | .tid = header.tid, | 100 | .tid = header.tid, |
| 101 | .severity = header.severity, | 101 | .severity = header.severity, |
| @@ -105,16 +105,17 @@ private: | |||
| 105 | if (True(header.flags & LogPacketFlags::Head)) { | 105 | if (True(header.flags & LogPacketFlags::Head)) { |
| 106 | std::vector<u8> tmp(data.size() - sizeof(LogPacketHeader)); | 106 | std::vector<u8> tmp(data.size() - sizeof(LogPacketHeader)); |
| 107 | std::memcpy(tmp.data(), data.data() + offset, tmp.size()); | 107 | std::memcpy(tmp.data(), data.data() + offset, tmp.size()); |
| 108 | entries[entry] = std::move(tmp); | 108 | entries.insert_or_assign(entry, std::move(tmp)); |
| 109 | } else { | 109 | } else { |
| 110 | const auto entry_iter = entries.find(entry); | ||
| 111 | |||
| 110 | // Append to existing entry | 112 | // Append to existing entry |
| 111 | if (!entries.contains(entry)) { | 113 | if (entry_iter == entries.cend()) { |
| 112 | LOG_ERROR(Service_LM, "Log entry does not exist!"); | 114 | LOG_ERROR(Service_LM, "Log entry does not exist!"); |
| 113 | return; | 115 | return; |
| 114 | } | 116 | } |
| 115 | std::vector<u8> tmp(data.size() - sizeof(LogPacketHeader)); | ||
| 116 | 117 | ||
| 117 | auto& existing_entry = entries[entry]; | 118 | auto& existing_entry = entry_iter->second; |
| 118 | const auto base = existing_entry.size(); | 119 | const auto base = existing_entry.size(); |
| 119 | existing_entry.resize(base + (data.size() - sizeof(LogPacketHeader))); | 120 | existing_entry.resize(base + (data.size() - sizeof(LogPacketHeader))); |
| 120 | std::memcpy(existing_entry.data() + base, data.data() + offset, | 121 | std::memcpy(existing_entry.data() + base, data.data() + offset, |
diff --git a/src/core/loader/kip.cpp b/src/core/loader/kip.cpp index 3f4ba233d..55e6de794 100644 --- a/src/core/loader/kip.cpp +++ b/src/core/loader/kip.cpp | |||
| @@ -68,7 +68,8 @@ AppLoader::LoadResult AppLoader_KIP::Load(Kernel::Process& process, | |||
| 68 | FileSys::ProgramMetadata metadata; | 68 | FileSys::ProgramMetadata metadata; |
| 69 | metadata.LoadManual(kip->Is64Bit(), address_space, kip->GetMainThreadPriority(), | 69 | metadata.LoadManual(kip->Is64Bit(), address_space, kip->GetMainThreadPriority(), |
| 70 | kip->GetMainThreadCpuCore(), kip->GetMainThreadStackSize(), | 70 | kip->GetMainThreadCpuCore(), kip->GetMainThreadStackSize(), |
| 71 | kip->GetTitleID(), 0xFFFFFFFFFFFFFFFF, kip->GetKernelCapabilities()); | 71 | kip->GetTitleID(), 0xFFFFFFFFFFFFFFFF, 0x1FE00000, |
| 72 | kip->GetKernelCapabilities()); | ||
| 72 | 73 | ||
| 73 | const VAddr base_address = process.PageTable().GetCodeRegionStart(); | 74 | const VAddr base_address = process.PageTable().GetCodeRegionStart(); |
| 74 | Kernel::CodeSet codeset; | 75 | Kernel::CodeSet codeset; |