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).
This commit is contained in:
parent
cf9d6c6f52
commit
dccfe193a9
|
@ -47,6 +47,7 @@ SharedPtr<Process> Process::Create(KernelCore& kernel, std::string&& name) {
|
|||
|
||||
void Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata) {
|
||||
program_id = metadata.GetTitleID();
|
||||
is_64bit_process = metadata.Is64BitProgram();
|
||||
vm_manager.Reset(metadata.GetAddressSpaceType());
|
||||
}
|
||||
|
||||
|
|
|
@ -189,6 +189,11 @@ public:
|
|||
return is_virtual_address_memory_enabled;
|
||||
}
|
||||
|
||||
/// Whether this process is an AArch64 or AArch32 process.
|
||||
bool Is64BitProcess() const {
|
||||
return is_64bit_process;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads process-specifics configuration info with metadata provided
|
||||
* by an executable.
|
||||
|
@ -287,6 +292,11 @@ private:
|
|||
/// This vector will grow as more pages are allocated for new threads.
|
||||
std::vector<std::bitset<8>> tls_slots;
|
||||
|
||||
/// Whether or not this process is AArch64, or AArch32.
|
||||
/// By default, we currently assume this is true, unless otherwise
|
||||
/// specified by metadata provided to the process during loading.
|
||||
bool is_64bit_process = true;
|
||||
|
||||
std::string name;
|
||||
};
|
||||
|
||||
|
|
Reference in New Issue