Correct type of executable sizes (#1802)
This commit is contained in:
parent
ef157bbe26
commit
19d18662ea
9 changed files with 95 additions and 77 deletions
|
@ -21,16 +21,16 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
public static bool LoadKip(KernelContext context, KipExecutable kip)
|
||||
{
|
||||
int endOffset = kip.DataOffset + kip.Data.Length;
|
||||
uint endOffset = kip.DataOffset + (uint)kip.Data.Length;
|
||||
|
||||
if (kip.BssSize != 0)
|
||||
{
|
||||
endOffset = kip.BssOffset + kip.BssSize;
|
||||
}
|
||||
|
||||
int codeSize = BitUtils.AlignUp(kip.TextOffset + endOffset, KMemoryManager.PageSize);
|
||||
uint codeSize = BitUtils.AlignUp(kip.TextOffset + endOffset, KMemoryManager.PageSize);
|
||||
|
||||
int codePagesCount = codeSize / KMemoryManager.PageSize;
|
||||
int codePagesCount = (int)(codeSize / KMemoryManager.PageSize);
|
||||
|
||||
ulong codeBaseAddress = kip.Is64BitAddressSpace ? 0x8000000UL : 0x200000UL;
|
||||
|
||||
|
@ -124,35 +124,31 @@ namespace Ryujinx.HLE.HOS
|
|||
return true;
|
||||
}
|
||||
|
||||
public static bool LoadNsos(
|
||||
KernelContext context,
|
||||
Npdm metaData,
|
||||
byte[] arguments = null,
|
||||
params IExecutable[] executables)
|
||||
public static bool LoadNsos(KernelContext context, Npdm metaData, byte[] arguments = null, params IExecutable[] executables)
|
||||
{
|
||||
ulong argsStart = 0;
|
||||
int argsSize = 0;
|
||||
uint argsSize = 0;
|
||||
ulong codeStart = metaData.Is64Bit ? 0x8000000UL : 0x200000UL;
|
||||
int codeSize = 0;
|
||||
uint codeSize = 0;
|
||||
|
||||
ulong[] nsoBase = new ulong[executables.Length];
|
||||
|
||||
for (int index = 0; index < executables.Length; index++)
|
||||
{
|
||||
IExecutable staticObject = executables[index];
|
||||
IExecutable nso = executables[index];
|
||||
|
||||
int textEnd = staticObject.TextOffset + staticObject.Text.Length;
|
||||
int roEnd = staticObject.RoOffset + staticObject.Ro.Length;
|
||||
int dataEnd = staticObject.DataOffset + staticObject.Data.Length + staticObject.BssSize;
|
||||
uint textEnd = nso.TextOffset + (uint)nso.Text.Length;
|
||||
uint roEnd = nso.RoOffset + (uint)nso.Ro.Length;
|
||||
uint dataEnd = nso.DataOffset + (uint)nso.Data.Length + nso.BssSize;
|
||||
|
||||
int nsoSize = textEnd;
|
||||
uint nsoSize = textEnd;
|
||||
|
||||
if ((uint)nsoSize < (uint)roEnd)
|
||||
if (nsoSize < roEnd)
|
||||
{
|
||||
nsoSize = roEnd;
|
||||
}
|
||||
|
||||
if ((uint)nsoSize < (uint)dataEnd)
|
||||
if (nsoSize < dataEnd)
|
||||
{
|
||||
nsoSize = dataEnd;
|
||||
}
|
||||
|
@ -167,16 +163,16 @@ namespace Ryujinx.HLE.HOS
|
|||
{
|
||||
argsStart = (ulong)codeSize;
|
||||
|
||||
argsSize = BitUtils.AlignDown(arguments.Length * 2 + ArgsTotalSize - 1, KMemoryManager.PageSize);
|
||||
argsSize = (uint)BitUtils.AlignDown(arguments.Length * 2 + ArgsTotalSize - 1, KMemoryManager.PageSize);
|
||||
|
||||
codeSize += argsSize;
|
||||
}
|
||||
}
|
||||
|
||||
PtcProfiler.StaticCodeStart = codeStart;
|
||||
PtcProfiler.StaticCodeSize = codeSize;
|
||||
PtcProfiler.StaticCodeSize = (int)codeSize;
|
||||
|
||||
int codePagesCount = codeSize / KMemoryManager.PageSize;
|
||||
int codePagesCount = (int)(codeSize / KMemoryManager.PageSize);
|
||||
|
||||
int personalMmHeapPagesCount = metaData.PersonalMmHeapSize / KMemoryManager.PageSize;
|
||||
|
||||
|
@ -284,7 +280,7 @@ namespace Ryujinx.HLE.HOS
|
|||
process.CpuMemory.Write(roStart, image.Ro);
|
||||
process.CpuMemory.Write(dataStart, image.Data);
|
||||
|
||||
MemoryHelper.FillWithZeros(process.CpuMemory, (long)bssStart, image.BssSize);
|
||||
process.CpuMemory.Fill(bssStart, image.BssSize, 0);
|
||||
|
||||
KernelResult SetProcessMemoryPermission(ulong address, ulong size, KMemoryPermission permission)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue