Now that each cpu has its own gdt table, we need to setup apm gdt entries in

all the tables.
This commit is contained in:
Luoqi Chen 1999-05-06 01:07:03 +00:00
parent c300b7b6c1
commit 25b602e4c2
2 changed files with 36 additions and 2 deletions

View File

@ -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 */

View File

@ -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 */