Fix use of the custom TSS on i386 after the 4/4 split.

Record common_tssd, the descriptor to be written in GDT to point to
the common TSS, before LTR is executed.  The LTR instruction sets the
loaded descriptor type to 386 TSS busy, which traps on reloads.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Konstantin Belousov 2018-05-12 10:48:53 +00:00
parent 450cd8475a
commit 2017ad1e81
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=333522

View File

@ -2532,12 +2532,12 @@ machdep_init_trampoline(void)
gdt[GPROC0_SEL].sd.sd_lobase = (int)tss;
gdt[GPROC0_SEL].sd.sd_hibase = (u_int)tss >> 24;
gdt[GPROC0_SEL].sd.sd_type = SDT_SYS386TSS;
ltr(GSEL(GPROC0_SEL, SEL_KPL));
PCPU_SET(fsgs_gdt, &gdt[GUFS_SEL].sd);
PCPU_SET(tss_gdt, &gdt[GPROC0_SEL].sd);
PCPU_SET(common_tssd, *PCPU_GET(tss_gdt));
PCPU_SET(common_tssp, tss);
ltr(GSEL(GPROC0_SEL, SEL_KPL));
trampoline = pmap_trm_alloc(end_exceptions - start_exceptions,
M_NOWAIT);