Correct an NSO loader bug and use the correct address space extents

This commit is contained in:
Billy Laws 2020-10-11 20:51:20 +01:00 committed by ◱ PixelyIon
parent 17feb68eb5
commit 31efb5e930
2 changed files with 4 additions and 4 deletions

View File

@ -33,8 +33,8 @@ namespace skyline::kernel {
} }
chunks = {ChunkDescriptor{ chunks = {ChunkDescriptor{
.ptr = reinterpret_cast<u8 *>(base.address), .ptr = reinterpret_cast<u8 *>(addressSpace.address),
.size = base.size, .size = addressSpace.size,
.state = memory::states::Unmapped, .state = memory::states::Unmapped,
}}; }};
} }

View File

@ -41,11 +41,11 @@ namespace skyline::loader {
nsoExecutable.text.contents.resize(util::AlignUp(nsoExecutable.text.contents.size(), PAGE_SIZE)); nsoExecutable.text.contents.resize(util::AlignUp(nsoExecutable.text.contents.size(), PAGE_SIZE));
nsoExecutable.text.offset = header.text.memoryOffset; nsoExecutable.text.offset = header.text.memoryOffset;
nsoExecutable.ro.contents = GetSegment(backing, header.ro, header.flags.textCompressed ? header.textCompressedSize : 0); nsoExecutable.ro.contents = GetSegment(backing, header.ro, header.flags.roCompressed ? header.roCompressedSize : 0);
nsoExecutable.ro.contents.resize(util::AlignUp(nsoExecutable.ro.contents.size(), PAGE_SIZE)); nsoExecutable.ro.contents.resize(util::AlignUp(nsoExecutable.ro.contents.size(), PAGE_SIZE));
nsoExecutable.ro.offset = header.ro.memoryOffset; nsoExecutable.ro.offset = header.ro.memoryOffset;
nsoExecutable.data.contents = GetSegment(backing, header.data, header.flags.textCompressed ? header.textCompressedSize : 0); nsoExecutable.data.contents = GetSegment(backing, header.data, header.flags.dataCompressed ? header.dataCompressedSize : 0);
nsoExecutable.data.contents.resize(util::AlignUp(nsoExecutable.data.contents.size(), PAGE_SIZE)); nsoExecutable.data.contents.resize(util::AlignUp(nsoExecutable.data.contents.size(), PAGE_SIZE));
nsoExecutable.data.offset = header.data.memoryOffset; nsoExecutable.data.offset = header.data.memoryOffset;