Page MenuHomeFreeBSD

x86: Copy the FPU/XSAVE state from the creating thread to new threads.
ClosedPublic

Authored by jhb on Mar 10 2021, 10:13 PM.

Details

Summary

POSIX states that new threads created via pthread_create() should
inherit the "floating point environment" from the creating thread.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

I tested this on amd64 using kib@'s test program from D29024.

sys/i386/i386/vm_machdep.c
433

Why not call npxexit() there, same as for amd64?

466

This should be fine but unrelated?

sys/i386/i386/vm_machdep.c
433

Why not call npxexit() there, same as for amd64?

This matches cpu_fork() for i386 which does not use npxexit(). If we'd rather fix i386 to use npxexit() can I throw that into this series.

466

This should be fine but unrelated?

It's just part of the 'update pcb before copy logic' which now matches cpu_fork(). Since I had to add the FPU save, I figured this should mirror cpu_fork() at the same time.

This revision was not accepted when it landed; it landed in state Needs Review.Mar 12 2021, 5:50 PM
This revision was automatically updated to reflect the committed changes.