summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-09-21 15:03:59 +0000
committerpeter <peter@FreeBSD.org>1997-09-21 15:03:59 +0000
commitaab3d0a47854b3b263f0dca21d8393aaa8e2a94d (patch)
tree8ffc4b981552e3e14a812ac68d386658a0d1bfb6 /sys/amd64
parent2f99a3221a4184f53b9eaca11bd32f7811c1862e (diff)
downloadFreeBSD-src-aab3d0a47854b3b263f0dca21d8393aaa8e2a94d.zip
FreeBSD-src-aab3d0a47854b3b263f0dca21d8393aaa8e2a94d.tar.gz
Implement the parts needed for VM86 under SMP.
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/cpu_switch.S25
-rw-r--r--sys/amd64/amd64/locore.S11
-rw-r--r--sys/amd64/amd64/locore.s11
-rw-r--r--sys/amd64/amd64/machdep.c11
-rw-r--r--sys/amd64/amd64/mp_machdep.c18
-rw-r--r--sys/amd64/amd64/mptable.c18
-rw-r--r--sys/amd64/amd64/swtch.s25
-rw-r--r--sys/amd64/include/mptable.h18
8 files changed, 106 insertions, 31 deletions
diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S
index b83af08..7a71f7e 100644
--- a/sys/amd64/amd64/cpu_switch.S
+++ b/sys/amd64/amd64/cpu_switch.S
@@ -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 */
diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S
index 36ded88..56b6ba8 100644
--- a/sys/amd64/amd64/locore.S
+++ b/sys/amd64/amd64/locore.S
@@ -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"
diff --git a/sys/amd64/amd64/locore.s b/sys/amd64/amd64/locore.s
index 36ded88..56b6ba8 100644
--- a/sys/amd64/amd64/locore.s
+++ b/sys/amd64/amd64/locore.s
@@ -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"
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 50916d5..b3ad287 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -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)];
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index 06a5e96..0a55e81 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -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);
diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c
index 06a5e96..0a55e81 100644
--- a/sys/amd64/amd64/mptable.c
+++ b/sys/amd64/amd64/mptable.c
@@ -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);
diff --git a/sys/amd64/amd64/swtch.s b/sys/amd64/amd64/swtch.s
index b83af08..7a71f7e 100644
--- a/sys/amd64/amd64/swtch.s
+++ b/sys/amd64/amd64/swtch.s
@@ -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 */
diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h
index 06a5e96..0a55e81 100644
--- a/sys/amd64/include/mptable.h
+++ b/sys/amd64/include/mptable.h
@@ -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);
OpenPOWER on IntegriCloud