summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2018-09-29 19:13:46 -0400
committerGravatar Lioncash2018-09-30 05:29:40 -0400
commitdccfe193a9caf5ce7aa75489f1722fee2a2073dd (patch)
tree96da0ecc079ad4d5e26dc3b47e1fbd317ff93e43
parentkernel/process: Make data member variables private (diff)
downloadyuzu-dccfe193a9caf5ce7aa75489f1722fee2a2073dd.tar.gz
yuzu-dccfe193a9caf5ce7aa75489f1722fee2a2073dd.tar.xz
yuzu-dccfe193a9caf5ce7aa75489f1722fee2a2073dd.zip
kernel/process: Add a data member to determine if a process is 64-bit or not.
This will be necessary for the implementation of svcGetThreadContext(), as the kernel checks whether or not the process that owns the thread that has it context being retrieved is a 64-bit or 32-bit process. If the process is 32-bit, then the upper 15 general-purpose registers and upper 16 vector registers are cleared to zero (as AArch32 only has 15 GPRs and 16 128-bit vector registers. not 31 general-purpose registers and 32 128-bit vector registers like AArch64).
-rw-r--r--src/core/hle/kernel/process.cpp1
-rw-r--r--src/core/hle/kernel/process.h10
2 files changed, 11 insertions, 0 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index a8e3098ca..dc9fc8470 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -47,6 +47,7 @@ SharedPtr<Process> Process::Create(KernelCore& kernel, std::string&& name) {
47 47
48void Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata) { 48void Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata) {
49 program_id = metadata.GetTitleID(); 49 program_id = metadata.GetTitleID();
50 is_64bit_process = metadata.Is64BitProgram();
50 vm_manager.Reset(metadata.GetAddressSpaceType()); 51 vm_manager.Reset(metadata.GetAddressSpaceType());
51} 52}
52 53
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index 2dfb88fa9..590e0c73d 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/process.h
@@ -189,6 +189,11 @@ public:
189 return is_virtual_address_memory_enabled; 189 return is_virtual_address_memory_enabled;
190 } 190 }
191 191
192 /// Whether this process is an AArch64 or AArch32 process.
193 bool Is64BitProcess() const {
194 return is_64bit_process;
195 }
196
192 /** 197 /**
193 * Loads process-specifics configuration info with metadata provided 198 * Loads process-specifics configuration info with metadata provided
194 * by an executable. 199 * by an executable.
@@ -287,6 +292,11 @@ private:
287 /// This vector will grow as more pages are allocated for new threads. 292 /// This vector will grow as more pages are allocated for new threads.
288 std::vector<std::bitset<8>> tls_slots; 293 std::vector<std::bitset<8>> tls_slots;
289 294
295 /// Whether or not this process is AArch64, or AArch32.
296 /// By default, we currently assume this is true, unless otherwise
297 /// specified by metadata provided to the process during loading.
298 bool is_64bit_process = true;
299
290 std::string name; 300 std::string name;
291}; 301};
292 302