loader: Check error on NPDM load, use TID for CodeSet

This commit is contained in:
shinyquagsire23 2018-02-25 07:01:37 -07:00
parent fd3806fd30
commit 487f8bc018
3 changed files with 10 additions and 6 deletions

View file

@ -92,7 +92,7 @@ static constexpr u32 PageAlignSize(u32 size) {
return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK;
}
VAddr AppLoader_NSO::LoadModule(const std::string& path, VAddr load_base) {
VAddr AppLoader_NSO::LoadModule(const std::string& path, VAddr load_base, u64 tid) {
FileUtil::IOFile file(path, "rb");
if (!file.IsOpen()) {
return {};
@ -109,7 +109,7 @@ VAddr AppLoader_NSO::LoadModule(const std::string& path, VAddr load_base) {
}
// Build program image
Kernel::SharedPtr<Kernel::CodeSet> codeset = Kernel::CodeSet::Create("", 0);
Kernel::SharedPtr<Kernel::CodeSet> codeset = Kernel::CodeSet::Create("", tid);
std::vector<u8> program_image;
for (int i = 0; i < nso_header.segments.size(); ++i) {
std::vector<u8> data =
@ -158,7 +158,7 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr<Kernel::Process>& process) {
process = Kernel::Process::Create("main");
// Load module
LoadModule(filepath, Memory::PROCESS_IMAGE_VADDR);
LoadModule(filepath, Memory::PROCESS_IMAGE_VADDR, 0);
LOG_DEBUG(Loader, "loaded module %s @ 0x%" PRIx64, filepath.c_str(),
Memory::PROCESS_IMAGE_VADDR);