Merge pull request #3234 from Subv/dlp2

HLE/FS: Implemented FS::GetProgramLaunchInfo.
This commit is contained in:
Sebastian Valle 2017-12-10 08:58:08 -05:00 committed by GitHub
commit 2859b98884
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 78 additions and 3 deletions

View file

@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <algorithm>
#include <memory>
#include "common/assert.h"
#include "common/common_funcs.h"
@ -16,6 +17,9 @@
namespace Kernel {
// Lists all processes that exist in the current session.
static std::vector<SharedPtr<Process>> process_list;
SharedPtr<CodeSet> CodeSet::Create(std::string name, u64 program_id) {
SharedPtr<CodeSet> codeset(new CodeSet);
@ -37,6 +41,7 @@ SharedPtr<Process> Process::Create(SharedPtr<CodeSet> code_set) {
process->flags.raw = 0;
process->flags.memory_region.Assign(MemoryRegion::APPLICATION);
process_list.push_back(process);
return process;
}
@ -299,5 +304,20 @@ ResultCode Process::LinearFree(VAddr target, u32 size) {
Kernel::Process::Process() {}
Kernel::Process::~Process() {}
SharedPtr<Process> g_current_process;
void ClearProcessList() {
process_list.clear();
}
SharedPtr<Process> GetProcessById(u32 process_id) {
auto itr = std::find_if(
process_list.begin(), process_list.end(),
[&](const SharedPtr<Process>& process) { return process->process_id == process_id; });
if (itr == process_list.end())
return nullptr;
return *itr;
}
SharedPtr<Process> g_current_process;
} // namespace Kernel

View file

@ -8,6 +8,7 @@
#include <cstddef>
#include <memory>
#include <string>
#include <vector>
#include <boost/container/static_vector.hpp>
#include "common/bit_field.h"
#include "common/common_types.h"
@ -175,5 +176,10 @@ private:
~Process() override;
};
void ClearProcessList();
/// Retrieves a process from the current list of processes.
SharedPtr<Process> GetProcessById(u32 process_id);
extern SharedPtr<Process> g_current_process;
}
} // namespace Kernel

View file

@ -516,6 +516,7 @@ void ThreadingShutdown() {
}
thread_list.clear();
ready_queue.clear();
ClearProcessList();
}
const std::vector<SharedPtr<Thread>>& GetThreadList() {