diff options
| author | 2018-12-19 21:14:47 -0500 | |
|---|---|---|
| committer | 2018-12-21 07:05:34 -0500 | |
| commit | 010bc677f36304964e753057740a8ca32a7dcb83 (patch) | |
| tree | addf6c2eb4b90236e61ae038b7717d2f774f85c3 /src | |
| parent | kernel/process_capability: Handle interrupt capability flags (diff) | |
| download | yuzu-010bc677f36304964e753057740a8ca32a7dcb83.tar.gz yuzu-010bc677f36304964e753057740a8ca32a7dcb83.tar.xz yuzu-010bc677f36304964e753057740a8ca32a7dcb83.zip | |
kernel/process_capability: Handle program capability flags
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/errors.h | 1 | ||||
| -rw-r--r-- | src/core/hle/kernel/process_capability.cpp | 9 | ||||
| -rw-r--r-- | src/core/hle/kernel/process_capability.h | 21 |
3 files changed, 29 insertions, 2 deletions
diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h index a3d725866..ec574c097 100644 --- a/src/core/hle/kernel/errors.h +++ b/src/core/hle/kernel/errors.h | |||
| @@ -31,6 +31,7 @@ constexpr ResultCode ERR_NOT_FOUND{ErrorModule::Kernel, 121}; | |||
| 31 | constexpr ResultCode ERR_ALREADY_REGISTERED{ErrorModule::Kernel, 122}; | 31 | constexpr ResultCode ERR_ALREADY_REGISTERED{ErrorModule::Kernel, 122}; |
| 32 | constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE{ErrorModule::Kernel, 123}; | 32 | constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE{ErrorModule::Kernel, 123}; |
| 33 | constexpr ResultCode ERR_INVALID_STATE{ErrorModule::Kernel, 125}; | 33 | constexpr ResultCode ERR_INVALID_STATE{ErrorModule::Kernel, 125}; |
| 34 | constexpr ResultCode ERR_RESERVED_VALUE{ErrorModule::Kernel, 126}; | ||
| 34 | constexpr ResultCode ERR_RESOURCE_LIMIT_EXCEEDED{ErrorModule::Kernel, 132}; | 35 | constexpr ResultCode ERR_RESOURCE_LIMIT_EXCEEDED{ErrorModule::Kernel, 132}; |
| 35 | 36 | ||
| 36 | } // namespace Kernel | 37 | } // namespace Kernel |
diff --git a/src/core/hle/kernel/process_capability.cpp b/src/core/hle/kernel/process_capability.cpp index e98157f9c..ef506b9f3 100644 --- a/src/core/hle/kernel/process_capability.cpp +++ b/src/core/hle/kernel/process_capability.cpp | |||
| @@ -200,6 +200,8 @@ void ProcessCapabilities::Clear() { | |||
| 200 | handle_table_size = 0; | 200 | handle_table_size = 0; |
| 201 | kernel_version = 0; | 201 | kernel_version = 0; |
| 202 | 202 | ||
| 203 | program_type = ProgramType::SysModule; | ||
| 204 | |||
| 203 | is_debuggable = false; | 205 | is_debuggable = false; |
| 204 | can_force_debug = false; | 206 | can_force_debug = false; |
| 205 | } | 207 | } |
| @@ -303,7 +305,12 @@ ResultCode ProcessCapabilities::HandleInterruptFlags(u32 flags) { | |||
| 303 | } | 305 | } |
| 304 | 306 | ||
| 305 | ResultCode ProcessCapabilities::HandleProgramTypeFlags(u32 flags) { | 307 | ResultCode ProcessCapabilities::HandleProgramTypeFlags(u32 flags) { |
| 306 | // TODO: Implement | 308 | const u32 reserved = flags >> 17; |
| 309 | if (reserved != 0) { | ||
| 310 | return ERR_RESERVED_VALUE; | ||
| 311 | } | ||
| 312 | |||
| 313 | program_type = static_cast<ProgramType>((flags >> 14) & 0b111); | ||
| 307 | return RESULT_SUCCESS; | 314 | return RESULT_SUCCESS; |
| 308 | } | 315 | } |
| 309 | 316 | ||
diff --git a/src/core/hle/kernel/process_capability.h b/src/core/hle/kernel/process_capability.h index 4c151b3d5..140d60267 100644 --- a/src/core/hle/kernel/process_capability.h +++ b/src/core/hle/kernel/process_capability.h | |||
| @@ -14,6 +14,14 @@ namespace Kernel { | |||
| 14 | 14 | ||
| 15 | class VMManager; | 15 | class VMManager; |
| 16 | 16 | ||
| 17 | /// The possible types of programs that may be indicated | ||
| 18 | /// by the program type capability descriptor. | ||
| 19 | enum class ProgramType { | ||
| 20 | SysModule, | ||
| 21 | Application, | ||
| 22 | Applet, | ||
| 23 | }; | ||
| 24 | |||
| 17 | /// Handles kernel capability descriptors that are provided by | 25 | /// Handles kernel capability descriptors that are provided by |
| 18 | /// application metadata. These descriptors provide information | 26 | /// application metadata. These descriptors provide information |
| 19 | /// that alters certain parameters for kernel process instance | 27 | /// that alters certain parameters for kernel process instance |
| @@ -137,6 +145,16 @@ public: | |||
| 137 | return svc_capabilities; | 145 | return svc_capabilities; |
| 138 | } | 146 | } |
| 139 | 147 | ||
| 148 | /// Gets the valid interrupt bits. | ||
| 149 | const InterruptCapabilities& GetInterruptCapabilities() const { | ||
| 150 | return interrupt_capabilities; | ||
| 151 | } | ||
| 152 | |||
| 153 | /// Gets the program type for this process. | ||
| 154 | ProgramType GetProgramType() const { | ||
| 155 | return program_type; | ||
| 156 | } | ||
| 157 | |||
| 140 | private: | 158 | private: |
| 141 | /// Attempts to parse a given sequence of capability descriptors. | 159 | /// Attempts to parse a given sequence of capability descriptors. |
| 142 | /// | 160 | /// |
| @@ -215,7 +233,8 @@ private: | |||
| 215 | 233 | ||
| 216 | u32 handle_table_size = 0; | 234 | u32 handle_table_size = 0; |
| 217 | u32 kernel_version = 0; | 235 | u32 kernel_version = 0; |
| 218 | u32 program_type = 0; | 236 | |
| 237 | ProgramType program_type = ProgramType::SysModule; | ||
| 219 | 238 | ||
| 220 | bool is_debuggable = false; | 239 | bool is_debuggable = false; |
| 221 | bool can_force_debug = false; | 240 | bool can_force_debug = false; |