mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:17:44 +00:00
Kernel: Reset FPU state on exec()
This commit is contained in:
parent
315538245f
commit
9aa234cc47
3 changed files with 9 additions and 2 deletions
|
@ -992,6 +992,7 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
|
||||||
m_master_tls_alignment = master_tls_alignment;
|
m_master_tls_alignment = master_tls_alignment;
|
||||||
|
|
||||||
new_main_thread->make_thread_specific_region({});
|
new_main_thread->make_thread_specific_region({});
|
||||||
|
new_main_thread->reset_fpu_state();
|
||||||
|
|
||||||
memset(&tss, 0, sizeof(TSS32));
|
memset(&tss, 0, sizeof(TSS32));
|
||||||
tss.iomapbase = sizeof(TSS32);
|
tss.iomapbase = sizeof(TSS32);
|
||||||
|
|
|
@ -94,7 +94,7 @@ Thread::Thread(Process& process)
|
||||||
#endif
|
#endif
|
||||||
set_default_signal_dispositions();
|
set_default_signal_dispositions();
|
||||||
m_fpu_state = (FPUState*)kmalloc_aligned(sizeof(FPUState), 16);
|
m_fpu_state = (FPUState*)kmalloc_aligned(sizeof(FPUState), 16);
|
||||||
memcpy(m_fpu_state, &s_clean_fpu_state, sizeof(FPUState));
|
reset_fpu_state();
|
||||||
memset(&m_tss, 0, sizeof(m_tss));
|
memset(&m_tss, 0, sizeof(m_tss));
|
||||||
m_tss.iomapbase = sizeof(TSS32);
|
m_tss.iomapbase = sizeof(TSS32);
|
||||||
|
|
||||||
|
@ -879,4 +879,9 @@ Thread* Thread::from_tid(int tid)
|
||||||
return found_thread;
|
return found_thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Thread::reset_fpu_state()
|
||||||
|
{
|
||||||
|
memcpy(m_fpu_state, &s_clean_fpu_state, sizeof(FPUState));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -440,8 +440,9 @@ private:
|
||||||
friend class WaitQueue;
|
friend class WaitQueue;
|
||||||
bool unlock_process_if_locked();
|
bool unlock_process_if_locked();
|
||||||
void relock_process();
|
void relock_process();
|
||||||
|
|
||||||
String backtrace_impl() const;
|
String backtrace_impl() const;
|
||||||
|
void reset_fpu_state();
|
||||||
|
|
||||||
Process& m_process;
|
Process& m_process;
|
||||||
int m_tid { -1 };
|
int m_tid { -1 };
|
||||||
TSS32 m_tss;
|
TSS32 m_tss;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue