Print stack trace on invalid memory accesses (#461)
* Print stack trace on invalid memory accesses * Rebased, change code region base address for 39-bits address space, print stack trace on break and undefined instructions too
This commit is contained in:
parent
0e1e094b7a
commit
2cb8541462
5 changed files with 53 additions and 1 deletions
|
@ -91,7 +91,7 @@ namespace Ryujinx.HLE.HOS.Kernel
|
|||
break;
|
||||
|
||||
case AddressSpaceType.Addr39Bits:
|
||||
CodeRegionStart = 0;
|
||||
CodeRegionStart = 0x8000000;
|
||||
CodeRegionSize = 0x80000000;
|
||||
MapRegionSize = 0x1000000000;
|
||||
HeapRegionSize = 0x180000000;
|
||||
|
|
|
@ -67,6 +67,8 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
Memory = new AMemory(Device.Memory.RamPointer);
|
||||
|
||||
Memory.InvalidAccess += CpuInvalidAccessHandler;
|
||||
|
||||
MemoryManager = new KMemoryManager(this);
|
||||
|
||||
TlsPages = new List<KTlsPageManager>();
|
||||
|
@ -283,11 +285,15 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
private void BreakHandler(object sender, AInstExceptionEventArgs e)
|
||||
{
|
||||
PrintStackTraceForCurrentThread();
|
||||
|
||||
throw new GuestBrokeExecutionException();
|
||||
}
|
||||
|
||||
private void UndefinedHandler(object sender, AInstUndefinedEventArgs e)
|
||||
{
|
||||
PrintStackTraceForCurrentThread();
|
||||
|
||||
throw new UndefinedInstructionException(e.Position, e.RawOpCode);
|
||||
}
|
||||
|
||||
|
@ -334,6 +340,24 @@ namespace Ryujinx.HLE.HOS
|
|||
return Translator;
|
||||
}
|
||||
|
||||
private void CpuInvalidAccessHandler(object sender, AInvalidAccessEventArgs e)
|
||||
{
|
||||
PrintStackTraceForCurrentThread();
|
||||
}
|
||||
|
||||
private void PrintStackTraceForCurrentThread()
|
||||
{
|
||||
foreach (KThread Thread in Threads.Values)
|
||||
{
|
||||
if (Thread.Context.IsCurrentThread())
|
||||
{
|
||||
PrintStackTrace(Thread.Context.ThreadState);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PrintStackTrace(AThreadState ThreadState)
|
||||
{
|
||||
StringBuilder Trace = new StringBuilder();
|
||||
|
|
|
@ -125,6 +125,13 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
//As of now, it assumes that HostChannelsCount == 2.
|
||||
WaveBuffer Wb = WaveBuffers[BufferIndex];
|
||||
|
||||
if (Wb.Position == 0)
|
||||
{
|
||||
Samples = new int[0];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (SampleFormat == SampleFormat.PcmInt16)
|
||||
{
|
||||
int SamplesCount = (int)(Wb.Size / (sizeof(short) * ChannelsCount));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue