Kernel: replace boost::intrusive_ptr with std::shared_ptr
This commit is contained in:
parent
c1de8acfe5
commit
5f11c5f733
96 changed files with 522 additions and 538 deletions
|
@ -92,10 +92,10 @@ static u32 TranslateAddr(u32 addr, const THREEloadinfo* loadinfo, u32* offsets)
|
|||
}
|
||||
|
||||
using Kernel::CodeSet;
|
||||
using Kernel::SharedPtr;
|
||||
using std::shared_ptr;
|
||||
|
||||
static THREEDSX_Error Load3DSXFile(FileUtil::IOFile& file, u32 base_addr,
|
||||
SharedPtr<CodeSet>* out_codeset) {
|
||||
std::shared_ptr<CodeSet>* out_codeset) {
|
||||
if (!file.IsOpen())
|
||||
return ERROR_FILE;
|
||||
|
||||
|
@ -217,7 +217,7 @@ static THREEDSX_Error Load3DSXFile(FileUtil::IOFile& file, u32 base_addr,
|
|||
}
|
||||
|
||||
// Create the CodeSet
|
||||
SharedPtr<CodeSet> code_set = Core::System::GetInstance().Kernel().CreateCodeSet("", 0);
|
||||
std::shared_ptr<CodeSet> code_set = Core::System::GetInstance().Kernel().CreateCodeSet("", 0);
|
||||
|
||||
code_set->CodeSegment().offset = loadinfo.seg_ptrs[0] - program_image.data();
|
||||
code_set->CodeSegment().addr = loadinfo.seg_addrs[0];
|
||||
|
@ -255,14 +255,14 @@ FileType AppLoader_THREEDSX::IdentifyType(FileUtil::IOFile& file) {
|
|||
return FileType::Error;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_THREEDSX::Load(Kernel::SharedPtr<Kernel::Process>& process) {
|
||||
ResultStatus AppLoader_THREEDSX::Load(std::shared_ptr<Kernel::Process>& process) {
|
||||
if (is_loaded)
|
||||
return ResultStatus::ErrorAlreadyLoaded;
|
||||
|
||||
if (!file.IsOpen())
|
||||
return ResultStatus::Error;
|
||||
|
||||
SharedPtr<CodeSet> codeset;
|
||||
std::shared_ptr<CodeSet> codeset;
|
||||
if (Load3DSXFile(file, Memory::PROCESS_IMAGE_VADDR, &codeset) != ERROR_NONE)
|
||||
return ResultStatus::Error;
|
||||
codeset->name = filename;
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
return IdentifyType(file);
|
||||
}
|
||||
|
||||
ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) override;
|
||||
ResultStatus Load(std::shared_ptr<Kernel::Process>& process) override;
|
||||
|
||||
ResultStatus ReadIcon(std::vector<u8>& buffer) override;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "core/memory.h"
|
||||
|
||||
using Kernel::CodeSet;
|
||||
using Kernel::SharedPtr;
|
||||
using std::shared_ptr;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// ELF Header Constants
|
||||
|
@ -209,7 +209,7 @@ public:
|
|||
u32 GetFlags() const {
|
||||
return (u32)(header->e_flags);
|
||||
}
|
||||
SharedPtr<CodeSet> LoadInto(u32 vaddr);
|
||||
std::shared_ptr<CodeSet> LoadInto(u32 vaddr);
|
||||
|
||||
int GetNumSegments() const {
|
||||
return (int)(header->e_phnum);
|
||||
|
@ -272,7 +272,7 @@ const char* ElfReader::GetSectionName(int section) const {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
SharedPtr<CodeSet> ElfReader::LoadInto(u32 vaddr) {
|
||||
std::shared_ptr<CodeSet> ElfReader::LoadInto(u32 vaddr) {
|
||||
LOG_DEBUG(Loader, "String section: {}", header->e_shstrndx);
|
||||
|
||||
// Should we relocate?
|
||||
|
@ -300,7 +300,7 @@ SharedPtr<CodeSet> ElfReader::LoadInto(u32 vaddr) {
|
|||
std::vector<u8> program_image(total_image_size);
|
||||
std::size_t current_image_position = 0;
|
||||
|
||||
SharedPtr<CodeSet> codeset = Core::System::GetInstance().Kernel().CreateCodeSet("", 0);
|
||||
std::shared_ptr<CodeSet> codeset = Core::System::GetInstance().Kernel().CreateCodeSet("", 0);
|
||||
|
||||
for (unsigned int i = 0; i < header->e_phnum; ++i) {
|
||||
Elf32_Phdr* p = &segments[i];
|
||||
|
@ -377,7 +377,7 @@ FileType AppLoader_ELF::IdentifyType(FileUtil::IOFile& file) {
|
|||
return FileType::Error;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_ELF::Load(Kernel::SharedPtr<Kernel::Process>& process) {
|
||||
ResultStatus AppLoader_ELF::Load(std::shared_ptr<Kernel::Process>& process) {
|
||||
if (is_loaded)
|
||||
return ResultStatus::ErrorAlreadyLoaded;
|
||||
|
||||
|
@ -393,7 +393,7 @@ ResultStatus AppLoader_ELF::Load(Kernel::SharedPtr<Kernel::Process>& process) {
|
|||
return ResultStatus::Error;
|
||||
|
||||
ElfReader elf_reader(&buffer[0]);
|
||||
SharedPtr<CodeSet> codeset = elf_reader.LoadInto(Memory::PROCESS_IMAGE_VADDR);
|
||||
std::shared_ptr<CodeSet> codeset = elf_reader.LoadInto(Memory::PROCESS_IMAGE_VADDR);
|
||||
codeset->name = filename;
|
||||
|
||||
process = Core::System::GetInstance().Kernel().CreateProcess(std::move(codeset));
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
return IdentifyType(file);
|
||||
}
|
||||
|
||||
ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) override;
|
||||
ResultStatus Load(std::shared_ptr<Kernel::Process>& process) override;
|
||||
|
||||
private:
|
||||
std::string filename;
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
* @param process The newly created process.
|
||||
* @return The status result of the operation.
|
||||
*/
|
||||
virtual ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) = 0;
|
||||
virtual ResultStatus Load(std::shared_ptr<Kernel::Process>& process) = 0;
|
||||
|
||||
/**
|
||||
* Loads the system mode that this application needs.
|
||||
|
|
|
@ -61,9 +61,9 @@ std::pair<std::optional<u32>, ResultStatus> AppLoader_NCCH::LoadKernelSystemMode
|
|||
ResultStatus::Success);
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_NCCH::LoadExec(Kernel::SharedPtr<Kernel::Process>& process) {
|
||||
ResultStatus AppLoader_NCCH::LoadExec(std::shared_ptr<Kernel::Process>& process) {
|
||||
using Kernel::CodeSet;
|
||||
using Kernel::SharedPtr;
|
||||
using std::shared_ptr;
|
||||
|
||||
if (!is_loaded)
|
||||
return ResultStatus::ErrorNotLoaded;
|
||||
|
@ -75,7 +75,7 @@ ResultStatus AppLoader_NCCH::LoadExec(Kernel::SharedPtr<Kernel::Process>& proces
|
|||
std::string process_name = Common::StringFromFixedZeroTerminatedBuffer(
|
||||
(const char*)overlay_ncch->exheader_header.codeset_info.name, 8);
|
||||
|
||||
SharedPtr<CodeSet> codeset =
|
||||
std::shared_ptr<CodeSet> codeset =
|
||||
Core::System::GetInstance().Kernel().CreateCodeSet(process_name, program_id);
|
||||
|
||||
codeset->CodeSegment().offset = 0;
|
||||
|
@ -151,7 +151,7 @@ void AppLoader_NCCH::ParseRegionLockoutInfo() {
|
|||
}
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_NCCH::Load(Kernel::SharedPtr<Kernel::Process>& process) {
|
||||
ResultStatus AppLoader_NCCH::Load(std::shared_ptr<Kernel::Process>& process) {
|
||||
u64_le ncch_program_id;
|
||||
|
||||
if (is_loaded)
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
return IdentifyType(file);
|
||||
}
|
||||
|
||||
ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) override;
|
||||
ResultStatus Load(std::shared_ptr<Kernel::Process>& process) override;
|
||||
|
||||
/**
|
||||
* Loads the Exheader and returns the system mode for this application.
|
||||
|
@ -65,7 +65,7 @@ private:
|
|||
* @param process The newly created process
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
ResultStatus LoadExec(Kernel::SharedPtr<Kernel::Process>& process);
|
||||
ResultStatus LoadExec(std::shared_ptr<Kernel::Process>& process);
|
||||
|
||||
/// Reads the region lockout info in the SMDH and send it to CFG service
|
||||
void ParseRegionLockoutInfo();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue