diff options
| author | 2018-01-16 18:05:21 +0000 | |
|---|---|---|
| committer | 2018-01-16 18:05:21 +0000 | |
| commit | e35644c00533c797888a23420aae90b07e0da184 (patch) | |
| tree | 4b5464207a2bf8355cd7b2b732fc3c30d3524d24 /src/core | |
| parent | travis: Use more recent cmake on macOS (diff) | |
| download | yuzu-e35644c00533c797888a23420aae90b07e0da184.tar.gz yuzu-e35644c00533c797888a23420aae90b07e0da184.tar.xz yuzu-e35644c00533c797888a23420aae90b07e0da184.zip | |
clang-format
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/arm/arm_interface.h | 3 | ||||
| -rw-r--r-- | src/core/hle/ipc.h | 11 | ||||
| -rw-r--r-- | src/core/hle/kernel/hle_ipc.h | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.h | 1 | ||||
| -rw-r--r-- | src/core/hle/kernel/memory.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/mutex.h | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/kernel/vm_manager.cpp | 5 | ||||
| -rw-r--r-- | src/core/hle/service/apm/apm.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.h | 1 | ||||
| -rw-r--r-- | src/core/loader/linker.cpp | 12 | ||||
| -rw-r--r-- | src/core/loader/nso.cpp | 3 | ||||
| -rw-r--r-- | src/core/loader/nso.h | 3 |
13 files changed, 31 insertions, 37 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index 531875006..5ae60214e 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h | |||
| @@ -39,7 +39,8 @@ public: | |||
| 39 | Run(1); | 39 | Run(1); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | virtual void MapBackingMemory(VAddr address, size_t size, u8* memory, Kernel::VMAPermission perms) {} | 42 | virtual void MapBackingMemory(VAddr address, size_t size, u8* memory, |
| 43 | Kernel::VMAPermission perms) {} | ||
| 43 | 44 | ||
| 44 | /// Clear all instruction cache | 45 | /// Clear all instruction cache |
| 45 | virtual void ClearInstructionCache() = 0; | 46 | virtual void ClearInstructionCache() = 0; |
diff --git a/src/core/hle/ipc.h b/src/core/hle/ipc.h index ec08be0f4..88ba105e5 100644 --- a/src/core/hle/ipc.h +++ b/src/core/hle/ipc.h | |||
| @@ -19,7 +19,6 @@ constexpr size_t COMMAND_BUFFER_LENGTH = 0x100 / sizeof(u32); | |||
| 19 | // TODO(yuriks): These will probably go away once translation is implemented inside the kernel. | 19 | // TODO(yuriks): These will probably go away once translation is implemented inside the kernel. |
| 20 | constexpr auto ERR_INVALID_HANDLE = Kernel::ERR_INVALID_HANDLE_OS; | 20 | constexpr auto ERR_INVALID_HANDLE = Kernel::ERR_INVALID_HANDLE_OS; |
| 21 | 21 | ||
| 22 | |||
| 23 | enum class ControlCommand : u32 { | 22 | enum class ControlCommand : u32 { |
| 24 | ConvertSessionToDomain = 0, | 23 | ConvertSessionToDomain = 0, |
| 25 | ConvertDomainToSession = 1, | 24 | ConvertDomainToSession = 1, |
| @@ -81,13 +80,13 @@ struct BufferDescriptorX { | |||
| 81 | u32_le address_bits_0_31; | 80 | u32_le address_bits_0_31; |
| 82 | 81 | ||
| 83 | u32_le Counter() const { | 82 | u32_le Counter() const { |
| 84 | u32_le counter{ counter_bits_0_5 }; | 83 | u32_le counter{counter_bits_0_5}; |
| 85 | counter |= counter_bits_9_11 << 9; | 84 | counter |= counter_bits_9_11 << 9; |
| 86 | return counter; | 85 | return counter; |
| 87 | } | 86 | } |
| 88 | 87 | ||
| 89 | VAddr Address() const { | 88 | VAddr Address() const { |
| 90 | VAddr address{ address_bits_0_31 }; | 89 | VAddr address{address_bits_0_31}; |
| 91 | address |= static_cast<VAddr>(address_bits_32_35) << 32; | 90 | address |= static_cast<VAddr>(address_bits_32_35) << 32; |
| 92 | address |= static_cast<VAddr>(address_bits_36_38) << 36; | 91 | address |= static_cast<VAddr>(address_bits_36_38) << 36; |
| 93 | return address; | 92 | return address; |
| @@ -107,14 +106,14 @@ struct BufferDescriptorABW { | |||
| 107 | }; | 106 | }; |
| 108 | 107 | ||
| 109 | VAddr Address() const { | 108 | VAddr Address() const { |
| 110 | VAddr address{ address_bits_0_31 }; | 109 | VAddr address{address_bits_0_31}; |
| 111 | address |= static_cast<VAddr>(address_bits_32_35) << 32; | 110 | address |= static_cast<VAddr>(address_bits_32_35) << 32; |
| 112 | address |= static_cast<VAddr>(address_bits_36_38) << 36; | 111 | address |= static_cast<VAddr>(address_bits_36_38) << 36; |
| 113 | return address; | 112 | return address; |
| 114 | } | 113 | } |
| 115 | 114 | ||
| 116 | u64 Size() const { | 115 | u64 Size() const { |
| 117 | u64 size{ size_bits_0_31 }; | 116 | u64 size{size_bits_0_31}; |
| 118 | size |= static_cast<u64>(size_bits_32_35) << 32; | 117 | size |= static_cast<u64>(size_bits_32_35) << 32; |
| 119 | return size; | 118 | return size; |
| 120 | } | 119 | } |
| @@ -130,7 +129,7 @@ struct BufferDescriptorC { | |||
| 130 | }; | 129 | }; |
| 131 | 130 | ||
| 132 | VAddr Address() const { | 131 | VAddr Address() const { |
| 133 | VAddr address{ address_bits_0_31 }; | 132 | VAddr address{address_bits_0_31}; |
| 134 | address |= static_cast<VAddr>(address_bits_32_47) << 32; | 133 | address |= static_cast<VAddr>(address_bits_32_47) << 32; |
| 135 | return address; | 134 | return address; |
| 136 | } | 135 | } |
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 09caa43df..164c6db69 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h | |||
| @@ -151,13 +151,13 @@ public: | |||
| 151 | return domain != nullptr; | 151 | return domain != nullptr; |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | template<typename T> | 154 | template <typename T> |
| 155 | SharedPtr<T> GetCopyObject(size_t index) { | 155 | SharedPtr<T> GetCopyObject(size_t index) { |
| 156 | ASSERT(index < copy_objects.size()); | 156 | ASSERT(index < copy_objects.size()); |
| 157 | return DynamicObjectCast<T>(copy_objects[index]); | 157 | return DynamicObjectCast<T>(copy_objects[index]); |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | template<typename T> | 160 | template <typename T> |
| 161 | SharedPtr<T> GetMoveObject(size_t index) { | 161 | SharedPtr<T> GetMoveObject(size_t index) { |
| 162 | ASSERT(index < move_objects.size()); | 162 | ASSERT(index < move_objects.size()); |
| 163 | return DynamicObjectCast<T>(move_objects[index]); | 163 | return DynamicObjectCast<T>(move_objects[index]); |
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index df3b4083e..4d9549e45 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h | |||
| @@ -105,7 +105,6 @@ public: | |||
| 105 | UNREACHABLE(); | 105 | UNREACHABLE(); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | |||
| 109 | public: | 108 | public: |
| 110 | static unsigned int next_object_id; | 109 | static unsigned int next_object_id; |
| 111 | 110 | ||
diff --git a/src/core/hle/kernel/memory.cpp b/src/core/hle/kernel/memory.cpp index d990d0569..d2600cdd7 100644 --- a/src/core/hle/kernel/memory.cpp +++ b/src/core/hle/kernel/memory.cpp | |||
| @@ -95,10 +95,8 @@ MemoryRegionInfo* GetMemoryRegion(MemoryRegion region) { | |||
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | void HandleSpecialMapping(VMManager& address_space, const AddressMapping& mapping) { | 98 | void HandleSpecialMapping(VMManager& address_space, const AddressMapping& mapping) {} |
| 99 | } | ||
| 100 | 99 | ||
| 101 | void MapSharedPages(VMManager& address_space) { | 100 | void MapSharedPages(VMManager& address_space) {} |
| 102 | } | ||
| 103 | 101 | ||
| 104 | } // namespace Kernel | 102 | } // namespace Kernel |
diff --git a/src/core/hle/kernel/mutex.h b/src/core/hle/kernel/mutex.h index 49b6b454e..38db21005 100644 --- a/src/core/hle/kernel/mutex.h +++ b/src/core/hle/kernel/mutex.h | |||
| @@ -41,9 +41,9 @@ public: | |||
| 41 | return HANDLE_TYPE; | 41 | return HANDLE_TYPE; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | u32 priority; ///< The priority of the mutex, used for priority inheritance. | 44 | u32 priority; ///< The priority of the mutex, used for priority inheritance. |
| 45 | std::string name; ///< Name of mutex (optional) | 45 | std::string name; ///< Name of mutex (optional) |
| 46 | VAddr guest_addr; ///< Address of the guest mutex value | 46 | VAddr guest_addr; ///< Address of the guest mutex value |
| 47 | 47 | ||
| 48 | /** | 48 | /** |
| 49 | * Elevate the mutex priority to the best priority | 49 | * Elevate the mutex priority to the best priority |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 9c60576c1..6b3fd13c9 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -255,9 +255,8 @@ static ResultCode CancelSynchronization(Handle thread_handle) { | |||
| 255 | /// Attempts to locks a mutex, creating it if it does not already exist | 255 | /// Attempts to locks a mutex, creating it if it does not already exist |
| 256 | static ResultCode LockMutex(Handle holding_thread_handle, VAddr mutex_addr, | 256 | static ResultCode LockMutex(Handle holding_thread_handle, VAddr mutex_addr, |
| 257 | Handle requesting_thread_handle) { | 257 | Handle requesting_thread_handle) { |
| 258 | LOG_TRACE(Kernel_SVC, | 258 | LOG_TRACE(Kernel_SVC, "called holding_thread_handle=0x%08X, mutex_addr=0x%llx, " |
| 259 | "called holding_thread_handle=0x%08X, mutex_addr=0x%llx, " | 259 | "requesting_current_thread_handle=0x%08X", |
| 260 | "requesting_current_thread_handle=0x%08X", | ||
| 261 | holding_thread_handle, mutex_addr, requesting_thread_handle); | 260 | holding_thread_handle, mutex_addr, requesting_thread_handle); |
| 262 | 261 | ||
| 263 | SharedPtr<Thread> holding_thread = g_handle_table.Get<Thread>(holding_thread_handle); | 262 | SharedPtr<Thread> holding_thread = g_handle_table.Get<Thread>(holding_thread_handle); |
| @@ -522,9 +521,8 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V | |||
| 522 | 521 | ||
| 523 | Core::System::GetInstance().PrepareReschedule(); | 522 | Core::System::GetInstance().PrepareReschedule(); |
| 524 | 523 | ||
| 525 | LOG_TRACE(Kernel_SVC, | 524 | LOG_TRACE(Kernel_SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, " |
| 526 | "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, " | 525 | "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", |
| 527 | "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", | ||
| 528 | entry_point, name.c_str(), arg, stack_top, priority, processor_id, *out_handle); | 526 | entry_point, name.c_str(), arg, stack_top, priority, processor_id, *out_handle); |
| 529 | 527 | ||
| 530 | return RESULT_SUCCESS; | 528 | return RESULT_SUCCESS; |
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp index dca637dde..650d47925 100644 --- a/src/core/hle/kernel/vm_manager.cpp +++ b/src/core/hle/kernel/vm_manager.cpp | |||
| @@ -6,9 +6,9 @@ | |||
| 6 | #include "common/assert.h" | 6 | #include "common/assert.h" |
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | #include "core/arm/arm_interface.h" | 8 | #include "core/arm/arm_interface.h" |
| 9 | #include "core/core.h" | ||
| 9 | #include "core/hle/kernel/errors.h" | 10 | #include "core/hle/kernel/errors.h" |
| 10 | #include "core/hle/kernel/vm_manager.h" | 11 | #include "core/hle/kernel/vm_manager.h" |
| 11 | #include "core/core.h" | ||
| 12 | #include "core/memory.h" | 12 | #include "core/memory.h" |
| 13 | #include "core/memory_setup.h" | 13 | #include "core/memory_setup.h" |
| 14 | #include "core/mmio.h" | 14 | #include "core/mmio.h" |
| @@ -86,7 +86,8 @@ ResultVal<VMManager::VMAHandle> VMManager::MapMemoryBlock(VAddr target, | |||
| 86 | VirtualMemoryArea& final_vma = vma_handle->second; | 86 | VirtualMemoryArea& final_vma = vma_handle->second; |
| 87 | ASSERT(final_vma.size == size); | 87 | ASSERT(final_vma.size == size); |
| 88 | 88 | ||
| 89 | Core::CPU().MapBackingMemory(target, size, block->data() + offset, VMAPermission::ReadWriteExecute); | 89 | Core::CPU().MapBackingMemory(target, size, block->data() + offset, |
| 90 | VMAPermission::ReadWriteExecute); | ||
| 90 | 91 | ||
| 91 | final_vma.type = VMAType::AllocatedMemoryBlock; | 92 | final_vma.type = VMAType::AllocatedMemoryBlock; |
| 92 | final_vma.permissions = VMAPermission::ReadWrite; | 93 | final_vma.permissions = VMAPermission::ReadWrite; |
diff --git a/src/core/hle/service/apm/apm.cpp b/src/core/hle/service/apm/apm.cpp index f70b9fc10..957abdd66 100644 --- a/src/core/hle/service/apm/apm.cpp +++ b/src/core/hle/service/apm/apm.cpp | |||
| @@ -15,8 +15,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager) { | |||
| 15 | 15 | ||
| 16 | APM::APM() : ServiceFramework("apm") { | 16 | APM::APM() : ServiceFramework("apm") { |
| 17 | static const FunctionInfo functions[] = { | 17 | static const FunctionInfo functions[] = { |
| 18 | {0x00000000, nullptr, "OpenSession"}, | 18 | {0x00000000, nullptr, "OpenSession"}, {0x00000001, nullptr, "GetPerformanceMode"}, |
| 19 | {0x00000001, nullptr, "GetPerformanceMode"}, | ||
| 20 | }; | 19 | }; |
| 21 | RegisterHandlers(functions); | 20 | RegisterHandlers(functions); |
| 22 | } | 21 | } |
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index 7530d80ad..a1c050416 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h | |||
| @@ -26,6 +26,7 @@ public: | |||
| 26 | VAddr GetObjectAddress(u32 handle) const; | 26 | VAddr GetObjectAddress(u32 handle) const; |
| 27 | 27 | ||
| 28 | u32 ioctl(u32 command, const std::vector<u8>& input, std::vector<u8>& output) override; | 28 | u32 ioctl(u32 command, const std::vector<u8>& input, std::vector<u8>& output) override; |
| 29 | |||
| 29 | private: | 30 | private: |
| 30 | // Represents an nvmap object. | 31 | // Represents an nvmap object. |
| 31 | struct Object { | 32 | struct Object { |
diff --git a/src/core/loader/linker.cpp b/src/core/loader/linker.cpp index f82c6f4b4..87cc65e91 100644 --- a/src/core/loader/linker.cpp +++ b/src/core/loader/linker.cpp | |||
| @@ -48,9 +48,9 @@ struct Elf64_Sym { | |||
| 48 | }; | 48 | }; |
| 49 | static_assert(sizeof(Elf64_Sym) == 0x18, "Elf64_Sym has incorrect size."); | 49 | static_assert(sizeof(Elf64_Sym) == 0x18, "Elf64_Sym has incorrect size."); |
| 50 | 50 | ||
| 51 | void Linker::WriteRelocations(std::vector<u8>& program_image, | 51 | void Linker::WriteRelocations(std::vector<u8>& program_image, const std::vector<Symbol>& symbols, |
| 52 | const std::vector<Symbol>& symbols, u64 relocation_offset, | 52 | u64 relocation_offset, u64 size, bool is_jump_relocation, |
| 53 | u64 size, bool is_jump_relocation, VAddr load_base) { | 53 | VAddr load_base) { |
| 54 | for (u64 i = 0; i < size; i += sizeof(Elf64_Rela)) { | 54 | for (u64 i = 0; i < size; i += sizeof(Elf64_Rela)) { |
| 55 | Elf64_Rela rela; | 55 | Elf64_Rela rela; |
| 56 | std::memcpy(&rela, &program_image[relocation_offset + i], sizeof(Elf64_Rela)); | 56 | std::memcpy(&rela, &program_image[relocation_offset + i], sizeof(Elf64_Rela)); |
| @@ -90,8 +90,7 @@ void Linker::WriteRelocations(std::vector<u8>& program_image, | |||
| 90 | } | 90 | } |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | void Linker::Relocate(std::vector<u8>& program_image, u32 dynamic_section_offset, | 93 | void Linker::Relocate(std::vector<u8>& program_image, u32 dynamic_section_offset, VAddr load_base) { |
| 94 | VAddr load_base) { | ||
| 95 | std::map<u64, u64> dynamic; | 94 | std::map<u64, u64> dynamic; |
| 96 | while (dynamic_section_offset < program_image.size()) { | 95 | while (dynamic_section_offset < program_image.size()) { |
| 97 | Elf64_Dyn dyn; | 96 | Elf64_Dyn dyn; |
| @@ -141,8 +140,7 @@ void Linker::ResolveImports() { | |||
| 141 | const auto& search = exports.find(import.first); | 140 | const auto& search = exports.find(import.first); |
| 142 | if (search != exports.end()) { | 141 | if (search != exports.end()) { |
| 143 | Memory::Write64(import.second.ea, search->second + import.second.addend); | 142 | Memory::Write64(import.second.ea, search->second + import.second.addend); |
| 144 | } | 143 | } else { |
| 145 | else { | ||
| 146 | LOG_ERROR(Loader, "Unresolved import: %s", import.first.c_str()); | 144 | LOG_ERROR(Loader, "Unresolved import: %s", import.first.c_str()); |
| 147 | } | 145 | } |
| 148 | } | 146 | } |
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 7e1953701..a7d714bc8 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -157,7 +157,8 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr<Kernel::Process>& process) { | |||
| 157 | 157 | ||
| 158 | // Load NSO modules | 158 | // Load NSO modules |
| 159 | VAddr next_load_addr{Memory::PROCESS_IMAGE_VADDR}; | 159 | VAddr next_load_addr{Memory::PROCESS_IMAGE_VADDR}; |
| 160 | for (const auto& module : {"rtld", "sdk", "subsdk0", "subsdk1", "subsdk2", "subsdk3", "subsdk4"}) { | 160 | for (const auto& module : |
| 161 | {"rtld", "sdk", "subsdk0", "subsdk1", "subsdk2", "subsdk3", "subsdk4"}) { | ||
| 161 | const std::string path = filepath.substr(0, filepath.find_last_of("/\\")) + "/" + module; | 162 | const std::string path = filepath.substr(0, filepath.find_last_of("/\\")) + "/" + module; |
| 162 | const VAddr load_addr = next_load_addr; | 163 | const VAddr load_addr = next_load_addr; |
| 163 | next_load_addr = LoadNso(path, load_addr); | 164 | next_load_addr = LoadNso(path, load_addr); |
diff --git a/src/core/loader/nso.h b/src/core/loader/nso.h index 28df00384..03424e70d 100644 --- a/src/core/loader/nso.h +++ b/src/core/loader/nso.h | |||
| @@ -18,8 +18,7 @@ namespace Loader { | |||
| 18 | class AppLoader_NSO final : public AppLoader, Linker { | 18 | class AppLoader_NSO final : public AppLoader, Linker { |
| 19 | public: | 19 | public: |
| 20 | AppLoader_NSO(FileUtil::IOFile&& file, std::string filepath) | 20 | AppLoader_NSO(FileUtil::IOFile&& file, std::string filepath) |
| 21 | : AppLoader(std::move(file)), filepath(std::move(filepath)) { | 21 | : AppLoader(std::move(file)), filepath(std::move(filepath)) {} |
| 22 | } | ||
| 23 | 22 | ||
| 24 | /** | 23 | /** |
| 25 | * Returns the type of the file | 24 | * Returns the type of the file |