From 25b602e4c2eacaeb1190c57879ff4ee18f907f05 Mon Sep 17 00:00:00 2001 From: Luoqi Chen Date: Thu, 6 May 1999 01:07:03 +0000 Subject: Now that each cpu has its own gdt table, we need to setup apm gdt entries in all the tables. --- sys/i386/apm/apm.c | 19 ++++++++++++++++++- sys/i386/bios/apm.c | 19 ++++++++++++++++++- 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 #include @@ -45,6 +46,10 @@ #include #endif +#ifdef SMP +#include +#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 #include @@ -45,6 +46,10 @@ #include #endif +#ifdef SMP +#include +#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 */ -- cgit v1.3