diff options
| author | 2018-12-19 23:50:20 -0500 | |
|---|---|---|
| committer | 2018-12-21 07:05:34 -0500 | |
| commit | 002ae08bbd3e5e851d8a682203462efbcf59e3dd (patch) | |
| tree | 231239717b1035634a2d6ec5d09622fd7a5c6f4b /src/core/file_sys | |
| parent | kernel/process_capability: Handle debug capability flags (diff) | |
| download | yuzu-002ae08bbd3e5e851d8a682203462efbcf59e3dd.tar.gz yuzu-002ae08bbd3e5e851d8a682203462efbcf59e3dd.tar.xz yuzu-002ae08bbd3e5e851d8a682203462efbcf59e3dd.zip | |
kernel/process: Hook up the process capability parser to the process itself
While we're at it, we can also toss out the leftover capability parsing
from Citra.
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/program_metadata.cpp | 11 | ||||
| -rw-r--r-- | src/core/file_sys/program_metadata.h | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp index 8903ed1d3..e90c8c2de 100644 --- a/src/core/file_sys/program_metadata.cpp +++ b/src/core/file_sys/program_metadata.cpp | |||
| @@ -40,6 +40,13 @@ Loader::ResultStatus ProgramMetadata::Load(VirtualFile file) { | |||
| 40 | if (sizeof(FileAccessHeader) != file->ReadObject(&aci_file_access, aci_header.fah_offset)) | 40 | if (sizeof(FileAccessHeader) != file->ReadObject(&aci_file_access, aci_header.fah_offset)) |
| 41 | return Loader::ResultStatus::ErrorBadFileAccessHeader; | 41 | return Loader::ResultStatus::ErrorBadFileAccessHeader; |
| 42 | 42 | ||
| 43 | aci_kernel_capabilities.resize(aci_header.kac_size / sizeof(u32)); | ||
| 44 | const u64 read_size = aci_header.kac_size; | ||
| 45 | const u64 read_offset = npdm_header.aci_offset + aci_header.kac_offset; | ||
| 46 | if (file->ReadBytes(aci_kernel_capabilities.data(), read_size, read_offset) != read_size) { | ||
| 47 | return Loader::ResultStatus::ErrorBadKernelCapabilityDescriptors; | ||
| 48 | } | ||
| 49 | |||
| 43 | return Loader::ResultStatus::Success; | 50 | return Loader::ResultStatus::Success; |
| 44 | } | 51 | } |
| 45 | 52 | ||
| @@ -71,6 +78,10 @@ u64 ProgramMetadata::GetFilesystemPermissions() const { | |||
| 71 | return aci_file_access.permissions; | 78 | return aci_file_access.permissions; |
| 72 | } | 79 | } |
| 73 | 80 | ||
| 81 | const ProgramMetadata::KernelCapabilityDescriptors& ProgramMetadata::GetKernelCapabilities() const { | ||
| 82 | return aci_kernel_capabilities; | ||
| 83 | } | ||
| 84 | |||
| 74 | void ProgramMetadata::Print() const { | 85 | void ProgramMetadata::Print() const { |
| 75 | LOG_DEBUG(Service_FS, "Magic: {:.4}", npdm_header.magic.data()); | 86 | LOG_DEBUG(Service_FS, "Magic: {:.4}", npdm_header.magic.data()); |
| 76 | LOG_DEBUG(Service_FS, "Main thread priority: 0x{:02X}", npdm_header.main_thread_priority); | 87 | LOG_DEBUG(Service_FS, "Main thread priority: 0x{:02X}", npdm_header.main_thread_priority); |
diff --git a/src/core/file_sys/program_metadata.h b/src/core/file_sys/program_metadata.h index e4470d6f0..0033ba347 100644 --- a/src/core/file_sys/program_metadata.h +++ b/src/core/file_sys/program_metadata.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <vector> | ||
| 8 | #include "common/bit_field.h" | 9 | #include "common/bit_field.h" |
| 9 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 10 | #include "common/swap.h" | 11 | #include "common/swap.h" |
| @@ -38,6 +39,8 @@ enum class ProgramFilePermission : u64 { | |||
| 38 | */ | 39 | */ |
| 39 | class ProgramMetadata { | 40 | class ProgramMetadata { |
| 40 | public: | 41 | public: |
| 42 | using KernelCapabilityDescriptors = std::vector<u32>; | ||
| 43 | |||
| 41 | ProgramMetadata(); | 44 | ProgramMetadata(); |
| 42 | ~ProgramMetadata(); | 45 | ~ProgramMetadata(); |
| 43 | 46 | ||
| @@ -50,6 +53,7 @@ public: | |||
| 50 | u32 GetMainThreadStackSize() const; | 53 | u32 GetMainThreadStackSize() const; |
| 51 | u64 GetTitleID() const; | 54 | u64 GetTitleID() const; |
| 52 | u64 GetFilesystemPermissions() const; | 55 | u64 GetFilesystemPermissions() const; |
| 56 | const KernelCapabilityDescriptors& GetKernelCapabilities() const; | ||
| 53 | 57 | ||
| 54 | void Print() const; | 58 | void Print() const; |
| 55 | 59 | ||
| @@ -154,6 +158,8 @@ private: | |||
| 154 | 158 | ||
| 155 | FileAccessControl acid_file_access; | 159 | FileAccessControl acid_file_access; |
| 156 | FileAccessHeader aci_file_access; | 160 | FileAccessHeader aci_file_access; |
| 161 | |||
| 162 | KernelCapabilityDescriptors aci_kernel_capabilities; | ||
| 157 | }; | 163 | }; |
| 158 | 164 | ||
| 159 | } // namespace FileSys | 165 | } // namespace FileSys |