]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC 291947:
authorjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 21 Dec 2015 22:16:09 +0000 (22:16 +0000)
committerjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 21 Dec 2015 22:16:09 +0000 (22:16 +0000)
commit564140fea4f47160b53932dc913ff1661c999597
treead3f4fe1b0da43d4716aaf41824e16f8e6473e99
parent7b4053a4e307232b228368adab18070a82679307
MFC 291947:
Set %esp correctly in the extended TSS.

The pcb is saved at the top of the kernel stack on x86 platforms.
The initial kenrel stack pointer is set in the TSS so that the trapframe
from user -> kernel transitions begins directly below the pcb and grows
down.

The XSAVE changes moved the FPU save area out of the pcb and into a
variable-sized area after the pcb.  This required updating the expressions
to calculate the initial stack pointer from 'stacktop - sizeof(pcb)' to
'stacktop - sizeof(pcb) + FPU save area size'.

The i386_set_ioperm() system call allows user applications to access
individual I/O ports via the I/O port permission bitmap in the TSS.
On FreeBSD this requires allocating a custom per-process TSS instead of
using the shared per-CPU TSS.

The expression to initialize the initial kernel stack pointer in the
per-process TSS created for i386_set_ioperm() was not properly updated
after the XSAVE changes.  Processes that used i386_set_ioperm() would
trash the trapframe during subsequent context switches resulting in
panics from memory corruption.

This changes fixes the kernel stack pointer calculation for the per-process
TSS.

git-svn-id: svn://svn.freebsd.org/base/stable/10@292572 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/i386/i386/sys_machdep.c