Kernel: Reset FPU state on exec()
This commit is contained in:
parent
315538245f
commit
9aa234cc47
Notes:
sideshowbarker
2024-07-19 09:13:49 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/9aa234cc475
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;
|
||||
|
||||
new_main_thread->make_thread_specific_region({});
|
||||
new_main_thread->reset_fpu_state();
|
||||
|
||||
memset(&tss, 0, sizeof(TSS32));
|
||||
tss.iomapbase = sizeof(TSS32);
|
||||
|
|
|
@ -94,7 +94,7 @@ Thread::Thread(Process& process)
|
|||
#endif
|
||||
set_default_signal_dispositions();
|
||||
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));
|
||||
m_tss.iomapbase = sizeof(TSS32);
|
||||
|
||||
|
@ -879,4 +879,9 @@ Thread* Thread::from_tid(int tid)
|
|||
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;
|
||||
bool unlock_process_if_locked();
|
||||
void relock_process();
|
||||
|
||||
String backtrace_impl() const;
|
||||
void reset_fpu_state();
|
||||
|
||||
Process& m_process;
|
||||
int m_tid { -1 };
|
||||
TSS32 m_tss;
|
||||
|
|
Loading…
Add table
Reference in a new issue