mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix floating point corruption on thread exit.
This commit is contained in:
parent
6a44dcae04
commit
607128334f
3 changed files with 10 additions and 4 deletions
|
@ -175,7 +175,8 @@ static void InterruptYieldCPU(CPU::InterruptRegisters* regs, void* /*user*/)
|
||||||
|
|
||||||
static void ThreadExitCPU(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);
|
SetThreadState(currentthread, Thread::State::DEAD);
|
||||||
InterruptYieldCPU(regs, NULL);
|
InterruptYieldCPU(regs, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,9 +75,10 @@ void Init()
|
||||||
Interrupt::RegisterHandler(7, OnFPUAccess, NULL);
|
Interrupt::RegisterHandler(7, OnFPUAccess, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NofityTaskExit()
|
void NofityTaskExit(Thread* thread)
|
||||||
{
|
{
|
||||||
fputhread = NULL;
|
if ( fputhread == thread )
|
||||||
|
fputhread = NULL;
|
||||||
DisableFPU();
|
DisableFPU();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,13 @@
|
||||||
#define SORTIX_FLOAT_H
|
#define SORTIX_FLOAT_H
|
||||||
|
|
||||||
namespace Sortix {
|
namespace Sortix {
|
||||||
|
|
||||||
|
class Thread;
|
||||||
|
|
||||||
namespace Float {
|
namespace Float {
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void NofityTaskExit();
|
void NofityTaskExit(Thread* thread);
|
||||||
|
|
||||||
static inline void EnableFPU()
|
static inline void EnableFPU()
|
||||||
{
|
{
|
||||||
|
@ -50,5 +53,6 @@ static inline void NotityTaskSwitch()
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Float
|
} // namespace Float
|
||||||
|
|
||||||
} // namespace Sortix
|
} // namespace Sortix
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue