Initialize thread regs with 0xDEADBEEF.

Also initialize the float regs to NaN.
This commit is contained in:
Unknown W. Brackets 2013-10-29 21:39:24 -07:00
parent 122f19a3cf
commit 04ec987448
2 changed files with 14 additions and 9 deletions

View file

@ -1892,9 +1892,10 @@ void ThreadContext::reset()
{ {
for (int i = 0; i<32; i++) for (int i = 0; i<32; i++)
{ {
r[i] = 0; r[i] = 0xDEADBEEF;
f[i] = 0.0f; fi[i] = 0x7f800001;
} }
r[0] = 0;
for (int i = 0; i<128; i++) for (int i = 0; i<128; i++)
{ {
v[i] = 0.0f; v[i] = 0.0f;
@ -1919,15 +1920,13 @@ void ThreadContext::reset()
fpcond = 0; fpcond = 0;
fcr0 = 0; fcr0 = 0;
fcr31 = 0; fcr31 = 0;
hi = 0; hi = 0xDEADBEEF;
lo = 0; lo = 0xDEADBEEF;
} }
void __KernelResetThread(Thread *t, int lowestPriority) void __KernelResetThread(Thread *t, int lowestPriority)
{ {
t->context.reset(); t->context.reset();
t->context.hi = 0;
t->context.lo = 0;
t->context.pc = t->nt.entrypoint; t->context.pc = t->nt.entrypoint;
// If the thread would be better than lowestPriority, reset to its initial. Yes, kinda odd... // If the thread would be better than lowestPriority, reset to its initial. Yes, kinda odd...

View file

@ -114,9 +114,15 @@ struct ThreadContext
// r must be followed by f. // r must be followed by f.
u32 r[32]; u32 r[32];
float f[32]; union {
float f[32];
float v[128]; u32 fi[32];
int fs[32];
};
union {
float v[128];
u32 vi[128];
};
u32 vfpuCtrl[16]; u32 vfpuCtrl[16];
union { union {