Implement the parts needed for VM86 under SMP.

This commit is contained in:
Peter Wemm 1997-09-21 15:03:59 +00:00
parent 705c7a18f9
commit dfd5aef3a8
16 changed files with 193 additions and 66 deletions

View file

@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: swtch.s,v 1.10 1997/09/07 21:50:13 smp Exp smp $
* $Id: swtch.s,v 1.62 1997/09/07 22:04:09 fsmp Exp $
*/
#include "npx.h"
@ -255,9 +255,28 @@ _idle:
movl %ecx,%esp
/* update common_tss.tss_esp0 pointer */
#ifdef VM86
movl _my_tr, %esi
#endif /* VM86 */
movl $_common_tss, %eax
movl %ecx, TSS_ESP0(%eax)
#ifdef VM86
btrl %esi, _private_tss
je 1f
movl $_common_tssd, %edi
/* move correct tss descriptor into GDT slot, then reload tr */
leal _gdt(,%esi,8), %ebx /* entry in GDT */
movl 0(%edi), %eax
movl %eax, 0(%ebx)
movl 4(%edi), %eax
movl %eax, 4(%ebx)
shll $3, %esi /* GSEL(entry, SEL_KPL) */
ltr %si
1:
#endif /* VM86 */
sti
/*
@ -342,7 +361,7 @@ idle_loop:
/* update common_tss.tss_esp0 pointer */
#ifdef VM86
movl $GPROC0_SEL, %esi
movl _my_tr, %esi
#endif /* VM86 */
movl $_common_tss, %eax
movl %esp, TSS_ESP0(%eax)
@ -582,7 +601,7 @@ swtch_com:
#endif /* SMP */
#ifdef VM86
movl $GPROC0_SEL, %esi
movl _my_tr, %esi
cmpl $0, PCB_EXT(%edx) /* has pcb extension? */
je 1f
btsl %esi, _private_tss /* mark use of private tss */

View file

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.97 1997/09/07 22:03:46 fsmp Exp $
* $Id: locore.s,v 1.98 1997/09/21 05:49:56 dyson Exp $
*
* originally from: locore.s, by William F. Jolitz
*
@ -122,6 +122,15 @@
.set _inside_intr,_SMP_prvpage+52 /* [13] */
.set _common_tss,_SMP_prvpage+56 /* 102 (ie: 104) bytes long */
#ifdef VM86
.globl _common_tssd
.set _common_tssd,_common_tss+104 /* 8 bytes long */
.globl _private_tss
.set _private_tss,_common_tss+112
.globl _my_tr
.set _my_tr,_common_tss+116
#endif
/* Fetch the .set's for the local apic */
#include "i386/i386/mp_apicdefs.s"

View file

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.97 1997/09/07 22:03:46 fsmp Exp $
* $Id: locore.s,v 1.98 1997/09/21 05:49:56 dyson Exp $
*
* originally from: locore.s, by William F. Jolitz
*
@ -122,6 +122,15 @@
.set _inside_intr,_SMP_prvpage+52 /* [13] */
.set _common_tss,_SMP_prvpage+56 /* 102 (ie: 104) bytes long */
#ifdef VM86
.globl _common_tssd
.set _common_tssd,_common_tss+104 /* 8 bytes long */
.globl _private_tss
.set _private_tss,_common_tss+112
.globl _my_tr
.set _my_tr,_common_tss+116
#endif
/* Fetch the .set's for the local apic */
#include "i386/i386/mp_apicdefs.s"

View file

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.262 1997/09/04 15:14:48 davidg Exp $
* $Id: machdep.c,v 1.263 1997/09/04 15:23:33 davidg Exp $
*/
#include "apm.h"
@ -840,12 +840,15 @@ struct region_descriptor r_gdt, r_idt;
extern struct i386tss common_tss; /* One tss per cpu */
#ifdef VM86
extern struct segment_descriptor common_tssd;
extern int private_tss;
extern u_int my_tr;
#endif /* VM86 */
#else
struct i386tss common_tss;
#ifdef VM86
struct segment_descriptor common_tssd;
u_int private_tss = 0; /* flag indicating private tss */
u_int private_tss; /* flag indicating private tss */
u_int my_tr; /* which task register setting */
#endif /* VM86 */
#endif
@ -1468,6 +1471,10 @@ init386(first)
common_tss.tss_ioopt = (sizeof common_tss) << 16;
gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
ltr(gsel_tss);
#ifdef VM86
private_tss = 0;
my_tr = GPROC0_SEL;
#endif
dblfault_tss.tss_esp = dblfault_tss.tss_esp0 = dblfault_tss.tss_esp1 =
dblfault_tss.tss_esp2 = (int) &dblfault_stack[sizeof(dblfault_stack)];

View file

@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mp_machdep.c,v 1.52 1997/09/07 22:03:59 fsmp Exp $
* $Id: mp_machdep.c,v 1.53 1997/09/21 05:49:58 dyson Exp $
*/
#include "opt_smp.h"
@ -247,8 +247,9 @@ extern pt_entry_t *KPTphys;
/* Virtual address of per-cpu common_tss */
extern struct i386tss common_tss;
#ifdef VM86
extern u_int private_tss; /* flag indicating private tss */
extern struct segment_descriptor common_tssd;
extern u_int private_tss; /* flag indicating private tss */
extern u_int my_tr;
#endif /* VM86 */
/* IdlePTD per cpu */
@ -403,7 +404,10 @@ mp_announce(void)
void
init_secondary(void)
{
int gsel_tss, slot;
int gsel_tss;
#ifndef VM86
u_int my_tr;
#endif
r_gdt.rd_limit = sizeof(gdt[0]) * (NGDT + NCPU) - 1;
r_gdt.rd_base = (int) gdt;
@ -411,14 +415,14 @@ init_secondary(void)
lidt(&r_idt);
lldt(_default_ldt);
slot = NGDT + cpuid;
gsel_tss = GSEL(slot, SEL_KPL);
gdt[slot].sd.sd_type = SDT_SYS386TSS;
my_tr = NGDT + cpuid;
gsel_tss = GSEL(my_tr, SEL_KPL);
gdt[my_tr].sd.sd_type = SDT_SYS386TSS;
common_tss.tss_esp0 = 0; /* not used until after switch */
common_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL);
common_tss.tss_ioopt = (sizeof common_tss) << 16;
#ifdef VM86
common_tssd = gdt[slot].sd;
common_tssd = gdt[my_tr].sd;
private_tss = 0;
#endif /* VM86 */
ltr(gsel_tss);

View file

@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mp_machdep.c,v 1.52 1997/09/07 22:03:59 fsmp Exp $
* $Id: mp_machdep.c,v 1.53 1997/09/21 05:49:58 dyson Exp $
*/
#include "opt_smp.h"
@ -247,8 +247,9 @@ extern pt_entry_t *KPTphys;
/* Virtual address of per-cpu common_tss */
extern struct i386tss common_tss;
#ifdef VM86
extern u_int private_tss; /* flag indicating private tss */
extern struct segment_descriptor common_tssd;
extern u_int private_tss; /* flag indicating private tss */
extern u_int my_tr;
#endif /* VM86 */
/* IdlePTD per cpu */
@ -403,7 +404,10 @@ mp_announce(void)
void
init_secondary(void)
{
int gsel_tss, slot;
int gsel_tss;
#ifndef VM86
u_int my_tr;
#endif
r_gdt.rd_limit = sizeof(gdt[0]) * (NGDT + NCPU) - 1;
r_gdt.rd_base = (int) gdt;
@ -411,14 +415,14 @@ init_secondary(void)
lidt(&r_idt);
lldt(_default_ldt);
slot = NGDT + cpuid;
gsel_tss = GSEL(slot, SEL_KPL);
gdt[slot].sd.sd_type = SDT_SYS386TSS;
my_tr = NGDT + cpuid;
gsel_tss = GSEL(my_tr, SEL_KPL);
gdt[my_tr].sd.sd_type = SDT_SYS386TSS;
common_tss.tss_esp0 = 0; /* not used until after switch */
common_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL);
common_tss.tss_ioopt = (sizeof common_tss) << 16;
#ifdef VM86
common_tssd = gdt[slot].sd;
common_tssd = gdt[my_tr].sd;
private_tss = 0;
#endif /* VM86 */
ltr(gsel_tss);

View file

@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: swtch.s,v 1.10 1997/09/07 21:50:13 smp Exp smp $
* $Id: swtch.s,v 1.62 1997/09/07 22:04:09 fsmp Exp $
*/
#include "npx.h"
@ -255,9 +255,28 @@ _idle:
movl %ecx,%esp
/* update common_tss.tss_esp0 pointer */
#ifdef VM86
movl _my_tr, %esi
#endif /* VM86 */
movl $_common_tss, %eax
movl %ecx, TSS_ESP0(%eax)
#ifdef VM86
btrl %esi, _private_tss
je 1f
movl $_common_tssd, %edi
/* move correct tss descriptor into GDT slot, then reload tr */
leal _gdt(,%esi,8), %ebx /* entry in GDT */
movl 0(%edi), %eax
movl %eax, 0(%ebx)
movl 4(%edi), %eax
movl %eax, 4(%ebx)
shll $3, %esi /* GSEL(entry, SEL_KPL) */
ltr %si
1:
#endif /* VM86 */
sti
/*
@ -342,7 +361,7 @@ idle_loop:
/* update common_tss.tss_esp0 pointer */
#ifdef VM86
movl $GPROC0_SEL, %esi
movl _my_tr, %esi
#endif /* VM86 */
movl $_common_tss, %eax
movl %esp, TSS_ESP0(%eax)
@ -582,7 +601,7 @@ swtch_com:
#endif /* SMP */
#ifdef VM86
movl $GPROC0_SEL, %esi
movl _my_tr, %esi
cmpl $0, PCB_EXT(%edx) /* has pcb extension? */
je 1f
btsl %esi, _private_tss /* mark use of private tss */

View file

@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mp_machdep.c,v 1.52 1997/09/07 22:03:59 fsmp Exp $
* $Id: mp_machdep.c,v 1.53 1997/09/21 05:49:58 dyson Exp $
*/
#include "opt_smp.h"
@ -247,8 +247,9 @@ extern pt_entry_t *KPTphys;
/* Virtual address of per-cpu common_tss */
extern struct i386tss common_tss;
#ifdef VM86
extern u_int private_tss; /* flag indicating private tss */
extern struct segment_descriptor common_tssd;
extern u_int private_tss; /* flag indicating private tss */
extern u_int my_tr;
#endif /* VM86 */
/* IdlePTD per cpu */
@ -403,7 +404,10 @@ mp_announce(void)
void
init_secondary(void)
{
int gsel_tss, slot;
int gsel_tss;
#ifndef VM86
u_int my_tr;
#endif
r_gdt.rd_limit = sizeof(gdt[0]) * (NGDT + NCPU) - 1;
r_gdt.rd_base = (int) gdt;
@ -411,14 +415,14 @@ init_secondary(void)
lidt(&r_idt);
lldt(_default_ldt);
slot = NGDT + cpuid;
gsel_tss = GSEL(slot, SEL_KPL);
gdt[slot].sd.sd_type = SDT_SYS386TSS;
my_tr = NGDT + cpuid;
gsel_tss = GSEL(my_tr, SEL_KPL);
gdt[my_tr].sd.sd_type = SDT_SYS386TSS;
common_tss.tss_esp0 = 0; /* not used until after switch */
common_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL);
common_tss.tss_ioopt = (sizeof common_tss) << 16;
#ifdef VM86
common_tssd = gdt[slot].sd;
common_tssd = gdt[my_tr].sd;
private_tss = 0;
#endif /* VM86 */
ltr(gsel_tss);

View file

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.97 1997/09/07 22:03:46 fsmp Exp $
* $Id: locore.s,v 1.98 1997/09/21 05:49:56 dyson Exp $
*
* originally from: locore.s, by William F. Jolitz
*
@ -122,6 +122,15 @@
.set _inside_intr,_SMP_prvpage+52 /* [13] */
.set _common_tss,_SMP_prvpage+56 /* 102 (ie: 104) bytes long */
#ifdef VM86
.globl _common_tssd
.set _common_tssd,_common_tss+104 /* 8 bytes long */
.globl _private_tss
.set _private_tss,_common_tss+112
.globl _my_tr
.set _my_tr,_common_tss+116
#endif
/* Fetch the .set's for the local apic */
#include "i386/i386/mp_apicdefs.s"

View file

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.262 1997/09/04 15:14:48 davidg Exp $
* $Id: machdep.c,v 1.263 1997/09/04 15:23:33 davidg Exp $
*/
#include "apm.h"
@ -840,12 +840,15 @@ struct region_descriptor r_gdt, r_idt;
extern struct i386tss common_tss; /* One tss per cpu */
#ifdef VM86
extern struct segment_descriptor common_tssd;
extern int private_tss;
extern u_int my_tr;
#endif /* VM86 */
#else
struct i386tss common_tss;
#ifdef VM86
struct segment_descriptor common_tssd;
u_int private_tss = 0; /* flag indicating private tss */
u_int private_tss; /* flag indicating private tss */
u_int my_tr; /* which task register setting */
#endif /* VM86 */
#endif
@ -1468,6 +1471,10 @@ init386(first)
common_tss.tss_ioopt = (sizeof common_tss) << 16;
gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
ltr(gsel_tss);
#ifdef VM86
private_tss = 0;
my_tr = GPROC0_SEL;
#endif
dblfault_tss.tss_esp = dblfault_tss.tss_esp0 = dblfault_tss.tss_esp1 =
dblfault_tss.tss_esp2 = (int) &dblfault_stack[sizeof(dblfault_stack)];

View file

@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mp_machdep.c,v 1.52 1997/09/07 22:03:59 fsmp Exp $
* $Id: mp_machdep.c,v 1.53 1997/09/21 05:49:58 dyson Exp $
*/
#include "opt_smp.h"
@ -247,8 +247,9 @@ extern pt_entry_t *KPTphys;
/* Virtual address of per-cpu common_tss */
extern struct i386tss common_tss;
#ifdef VM86
extern u_int private_tss; /* flag indicating private tss */
extern struct segment_descriptor common_tssd;
extern u_int private_tss; /* flag indicating private tss */
extern u_int my_tr;
#endif /* VM86 */
/* IdlePTD per cpu */
@ -403,7 +404,10 @@ mp_announce(void)
void
init_secondary(void)
{
int gsel_tss, slot;
int gsel_tss;
#ifndef VM86
u_int my_tr;
#endif
r_gdt.rd_limit = sizeof(gdt[0]) * (NGDT + NCPU) - 1;
r_gdt.rd_base = (int) gdt;
@ -411,14 +415,14 @@ init_secondary(void)
lidt(&r_idt);
lldt(_default_ldt);
slot = NGDT + cpuid;
gsel_tss = GSEL(slot, SEL_KPL);
gdt[slot].sd.sd_type = SDT_SYS386TSS;
my_tr = NGDT + cpuid;
gsel_tss = GSEL(my_tr, SEL_KPL);
gdt[my_tr].sd.sd_type = SDT_SYS386TSS;
common_tss.tss_esp0 = 0; /* not used until after switch */
common_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL);
common_tss.tss_ioopt = (sizeof common_tss) << 16;
#ifdef VM86
common_tssd = gdt[slot].sd;
common_tssd = gdt[my_tr].sd;
private_tss = 0;
#endif /* VM86 */
ltr(gsel_tss);

View file

@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mp_machdep.c,v 1.52 1997/09/07 22:03:59 fsmp Exp $
* $Id: mp_machdep.c,v 1.53 1997/09/21 05:49:58 dyson Exp $
*/
#include "opt_smp.h"
@ -247,8 +247,9 @@ extern pt_entry_t *KPTphys;
/* Virtual address of per-cpu common_tss */
extern struct i386tss common_tss;
#ifdef VM86
extern u_int private_tss; /* flag indicating private tss */
extern struct segment_descriptor common_tssd;
extern u_int private_tss; /* flag indicating private tss */
extern u_int my_tr;
#endif /* VM86 */
/* IdlePTD per cpu */
@ -403,7 +404,10 @@ mp_announce(void)
void
init_secondary(void)
{
int gsel_tss, slot;
int gsel_tss;
#ifndef VM86
u_int my_tr;
#endif
r_gdt.rd_limit = sizeof(gdt[0]) * (NGDT + NCPU) - 1;
r_gdt.rd_base = (int) gdt;
@ -411,14 +415,14 @@ init_secondary(void)
lidt(&r_idt);
lldt(_default_ldt);
slot = NGDT + cpuid;
gsel_tss = GSEL(slot, SEL_KPL);
gdt[slot].sd.sd_type = SDT_SYS386TSS;
my_tr = NGDT + cpuid;
gsel_tss = GSEL(my_tr, SEL_KPL);
gdt[my_tr].sd.sd_type = SDT_SYS386TSS;
common_tss.tss_esp0 = 0; /* not used until after switch */
common_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL);
common_tss.tss_ioopt = (sizeof common_tss) << 16;
#ifdef VM86
common_tssd = gdt[slot].sd;
common_tssd = gdt[my_tr].sd;
private_tss = 0;
#endif /* VM86 */
ltr(gsel_tss);

View file

@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: swtch.s,v 1.10 1997/09/07 21:50:13 smp Exp smp $
* $Id: swtch.s,v 1.62 1997/09/07 22:04:09 fsmp Exp $
*/
#include "npx.h"
@ -255,9 +255,28 @@ _idle:
movl %ecx,%esp
/* update common_tss.tss_esp0 pointer */
#ifdef VM86
movl _my_tr, %esi
#endif /* VM86 */
movl $_common_tss, %eax
movl %ecx, TSS_ESP0(%eax)
#ifdef VM86
btrl %esi, _private_tss
je 1f
movl $_common_tssd, %edi
/* move correct tss descriptor into GDT slot, then reload tr */
leal _gdt(,%esi,8), %ebx /* entry in GDT */
movl 0(%edi), %eax
movl %eax, 0(%ebx)
movl 4(%edi), %eax
movl %eax, 4(%ebx)
shll $3, %esi /* GSEL(entry, SEL_KPL) */
ltr %si
1:
#endif /* VM86 */
sti
/*
@ -342,7 +361,7 @@ idle_loop:
/* update common_tss.tss_esp0 pointer */
#ifdef VM86
movl $GPROC0_SEL, %esi
movl _my_tr, %esi
#endif /* VM86 */
movl $_common_tss, %eax
movl %esp, TSS_ESP0(%eax)
@ -582,7 +601,7 @@ swtch_com:
#endif /* SMP */
#ifdef VM86
movl $GPROC0_SEL, %esi
movl _my_tr, %esi
cmpl $0, PCB_EXT(%edx) /* has pcb extension? */
je 1f
btsl %esi, _private_tss /* mark use of private tss */

View file

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: asnames.h,v 1.7 1997/09/08 00:25:05 peter Exp $
* $Id: asnames.h,v 1.8 1997/09/13 16:00:30 peter Exp $
*/
#ifndef _MACHINE_ASNAMES_H_
@ -263,6 +263,7 @@
#define _mp_ncpus mp_ncpus
#define _mul64 mul64
#define _my_idlePTD my_idlePTD
#define _my_tr my_tr
#define _net_imask net_imask
#define _netisr netisr
#define _netisrs netisrs

View file

@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mp_machdep.c,v 1.52 1997/09/07 22:03:59 fsmp Exp $
* $Id: mp_machdep.c,v 1.53 1997/09/21 05:49:58 dyson Exp $
*/
#include "opt_smp.h"
@ -247,8 +247,9 @@ extern pt_entry_t *KPTphys;
/* Virtual address of per-cpu common_tss */
extern struct i386tss common_tss;
#ifdef VM86
extern u_int private_tss; /* flag indicating private tss */
extern struct segment_descriptor common_tssd;
extern u_int private_tss; /* flag indicating private tss */
extern u_int my_tr;
#endif /* VM86 */
/* IdlePTD per cpu */
@ -403,7 +404,10 @@ mp_announce(void)
void
init_secondary(void)
{
int gsel_tss, slot;
int gsel_tss;
#ifndef VM86
u_int my_tr;
#endif
r_gdt.rd_limit = sizeof(gdt[0]) * (NGDT + NCPU) - 1;
r_gdt.rd_base = (int) gdt;
@ -411,14 +415,14 @@ init_secondary(void)
lidt(&r_idt);
lldt(_default_ldt);
slot = NGDT + cpuid;
gsel_tss = GSEL(slot, SEL_KPL);
gdt[slot].sd.sd_type = SDT_SYS386TSS;
my_tr = NGDT + cpuid;
gsel_tss = GSEL(my_tr, SEL_KPL);
gdt[my_tr].sd.sd_type = SDT_SYS386TSS;
common_tss.tss_esp0 = 0; /* not used until after switch */
common_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL);
common_tss.tss_ioopt = (sizeof common_tss) << 16;
#ifdef VM86
common_tssd = gdt[slot].sd;
common_tssd = gdt[my_tr].sd;
private_tss = 0;
#endif /* VM86 */
ltr(gsel_tss);

View file

@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mp_machdep.c,v 1.52 1997/09/07 22:03:59 fsmp Exp $
* $Id: mp_machdep.c,v 1.53 1997/09/21 05:49:58 dyson Exp $
*/
#include "opt_smp.h"
@ -247,8 +247,9 @@ extern pt_entry_t *KPTphys;
/* Virtual address of per-cpu common_tss */
extern struct i386tss common_tss;
#ifdef VM86
extern u_int private_tss; /* flag indicating private tss */
extern struct segment_descriptor common_tssd;
extern u_int private_tss; /* flag indicating private tss */
extern u_int my_tr;
#endif /* VM86 */
/* IdlePTD per cpu */
@ -403,7 +404,10 @@ mp_announce(void)
void
init_secondary(void)
{
int gsel_tss, slot;
int gsel_tss;
#ifndef VM86
u_int my_tr;
#endif
r_gdt.rd_limit = sizeof(gdt[0]) * (NGDT + NCPU) - 1;
r_gdt.rd_base = (int) gdt;
@ -411,14 +415,14 @@ init_secondary(void)
lidt(&r_idt);
lldt(_default_ldt);
slot = NGDT + cpuid;
gsel_tss = GSEL(slot, SEL_KPL);
gdt[slot].sd.sd_type = SDT_SYS386TSS;
my_tr = NGDT + cpuid;
gsel_tss = GSEL(my_tr, SEL_KPL);
gdt[my_tr].sd.sd_type = SDT_SYS386TSS;
common_tss.tss_esp0 = 0; /* not used until after switch */
common_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL);
common_tss.tss_ioopt = (sizeof common_tss) << 16;
#ifdef VM86
common_tssd = gdt[slot].sd;
common_tssd = gdt[my_tr].sd;
private_tss = 0;
#endif /* VM86 */
ltr(gsel_tss);