Fix floating point corruption on thread exit.

This commit is contained in:
Jonas 'Sortie' Termansen 2013-01-14 14:38:21 +01:00
parent 6a44dcae04
commit 607128334f
3 changed files with 10 additions and 4 deletions

View File

@ -175,7 +175,8 @@ static void InterruptYieldCPU(CPU::InterruptRegisters* regs, void* /*user*/)
static void ThreadExitCPU(CPU::InterruptRegisters* regs, void* /*user*/)
{
Float::NofityTaskExit(); // Can't use floating point instructions from now.
// Can't use floating point instructions from now.
Float::NofityTaskExit(currentthread);
SetThreadState(currentthread, Thread::State::DEAD);
InterruptYieldCPU(regs, NULL);
}

View File

@ -75,9 +75,10 @@ void Init()
Interrupt::RegisterHandler(7, OnFPUAccess, NULL);
}
void NofityTaskExit()
void NofityTaskExit(Thread* thread)
{
fputhread = NULL;
if ( fputhread == thread )
fputhread = NULL;
DisableFPU();
}

View File

@ -26,10 +26,13 @@
#define SORTIX_FLOAT_H
namespace Sortix {
class Thread;
namespace Float {
void Init();
void NofityTaskExit();
void NofityTaskExit(Thread* thread);
static inline void EnableFPU()
{
@ -50,5 +53,6 @@ static inline void NotityTaskSwitch()
}
} // namespace Float
} // namespace Sortix
#endif