aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuoqi Chen <luoqi@FreeBSD.org>1999-05-06 01:07:03 +0000
committerLuoqi Chen <luoqi@FreeBSD.org>1999-05-06 01:07:03 +0000
commit25b602e4c2eacaeb1190c57879ff4ee18f907f05 (patch)
tree4c27d009fe88de2201c4c5685c29f98ab285bb70
parentc300b7b6c12fd0667ea80cb7529221a36d4fda25 (diff)
downloadsrc-25b602e4c2eacaeb1190c57879ff4ee18f907f05.tar.gz
src-25b602e4c2eacaeb1190c57879ff4ee18f907f05.zip
Now that each cpu has its own gdt table, we need to setup apm gdt entries in
all the tables.
Notes
Notes: svn path=/head/; revision=46540
-rw-r--r--sys/i386/apm/apm.c19
-rw-r--r--sys/i386/bios/apm.c19
2 files changed, 36 insertions, 2 deletions
diff --git a/sys/i386/apm/apm.c b/sys/i386/apm/apm.c
index d97b51ba236b..25bef843beb0 100644
--- a/sys/i386/apm/apm.c
+++ b/sys/i386/apm/apm.c
@@ -15,11 +15,12 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
- * $Id: apm.c,v 1.79 1999/04/18 15:10:58 dfr Exp $
+ * $Id: apm.c,v 1.80 1999/04/21 07:57:55 imp Exp $
*/
#include "opt_devfs.h"
#include "opt_vm86.h"
+#include "opt_smp.h"
#include <sys/param.h>
#include <sys/conf.h>
@@ -45,6 +46,10 @@
#include <machine/vm86.h>
#endif
+#ifdef SMP
+#include <machine/smp.h>
+#endif
+
static int apm_display __P((int newstate));
static int apm_int __P((u_long *eax, u_long *ebx, u_long *ecx, u_long *edx));
static void apm_resume __P((void));
@@ -92,6 +97,10 @@ static struct cdevsw apm_cdevsw =
static void
setup_apm_gdt(u_int code32_base, u_int code16_base, u_int data_base, u_int code32_limit, u_int code16_limit, u_int data_limit)
{
+#ifdef SMP
+ int x;
+#endif
+
/* setup 32bit code segment */
gdt_segs[GAPMCODE32_SEL].ssd_base = code32_base;
gdt_segs[GAPMCODE32_SEL].ssd_limit = code32_limit;
@@ -108,6 +117,14 @@ setup_apm_gdt(u_int code32_base, u_int code16_base, u_int data_base, u_int code3
ssdtosd(gdt_segs + GAPMCODE32_SEL, &gdt[GAPMCODE32_SEL].sd);
ssdtosd(gdt_segs + GAPMCODE16_SEL, &gdt[GAPMCODE16_SEL].sd);
ssdtosd(gdt_segs + GAPMDATA_SEL , &gdt[GAPMDATA_SEL ].sd);
+
+#ifdef SMP
+ for (x = 1; x < NCPU; x++) {
+ gdt[x * NGDT + GAPMCODE32_SEL].sd = gdt[GAPMCODE32_SEL].sd;
+ gdt[x * NGDT + GAPMCODE16_SEL].sd = gdt[GAPMCODE16_SEL].sd;
+ gdt[x * NGDT + GAPMDATA_SEL ].sd = gdt[GAPMDATA_SEL ].sd;
+ }
+#endif
}
/* 48bit far pointer. Do not staticize - used from apm_setup.s */
diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c
index d97b51ba236b..25bef843beb0 100644
--- a/sys/i386/bios/apm.c
+++ b/sys/i386/bios/apm.c
@@ -15,11 +15,12 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
- * $Id: apm.c,v 1.79 1999/04/18 15:10:58 dfr Exp $
+ * $Id: apm.c,v 1.80 1999/04/21 07:57:55 imp Exp $
*/
#include "opt_devfs.h"
#include "opt_vm86.h"
+#include "opt_smp.h"
#include <sys/param.h>
#include <sys/conf.h>
@@ -45,6 +46,10 @@
#include <machine/vm86.h>
#endif
+#ifdef SMP
+#include <machine/smp.h>
+#endif
+
static int apm_display __P((int newstate));
static int apm_int __P((u_long *eax, u_long *ebx, u_long *ecx, u_long *edx));
static void apm_resume __P((void));
@@ -92,6 +97,10 @@ static struct cdevsw apm_cdevsw =
static void
setup_apm_gdt(u_int code32_base, u_int code16_base, u_int data_base, u_int code32_limit, u_int code16_limit, u_int data_limit)
{
+#ifdef SMP
+ int x;
+#endif
+
/* setup 32bit code segment */
gdt_segs[GAPMCODE32_SEL].ssd_base = code32_base;
gdt_segs[GAPMCODE32_SEL].ssd_limit = code32_limit;
@@ -108,6 +117,14 @@ setup_apm_gdt(u_int code32_base, u_int code16_base, u_int data_base, u_int code3
ssdtosd(gdt_segs + GAPMCODE32_SEL, &gdt[GAPMCODE32_SEL].sd);
ssdtosd(gdt_segs + GAPMCODE16_SEL, &gdt[GAPMCODE16_SEL].sd);
ssdtosd(gdt_segs + GAPMDATA_SEL , &gdt[GAPMDATA_SEL ].sd);
+
+#ifdef SMP
+ for (x = 1; x < NCPU; x++) {
+ gdt[x * NGDT + GAPMCODE32_SEL].sd = gdt[GAPMCODE32_SEL].sd;
+ gdt[x * NGDT + GAPMCODE16_SEL].sd = gdt[GAPMCODE16_SEL].sd;
+ gdt[x * NGDT + GAPMDATA_SEL ].sd = gdt[GAPMDATA_SEL ].sd;
+ }
+#endif
}
/* 48bit far pointer. Do not staticize - used from apm_setup.s */