summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkato <kato@FreeBSD.org>1999-06-21 11:14:27 +0000
committerkato <kato@FreeBSD.org>1999-06-21 11:14:27 +0000
commitc93d5ba964ee6cb74c965c3cb727d9e512a78ca5 (patch)
tree0cebfefaa08a289922e6d93359b94bdba18d54e0
parent88d27048132de6b99d8bb92ab6ced6261ccb6de4 (diff)
downloadFreeBSD-src-c93d5ba964ee6cb74c965c3cb727d9e512a78ca5.zip
FreeBSD-src-c93d5ba964ee6cb74c965c3cb727d9e512a78ca5.tar.gz
Sync with sys/i386/i386/machdep.c revision 1.342.
-rw-r--r--sys/pc98/i386/machdep.c22
-rw-r--r--sys/pc98/pc98/machdep.c22
2 files changed, 20 insertions, 24 deletions
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index e0b85b1..9a0ace5 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
- * $Id: machdep.c,v 1.118 1999/06/03 13:49:52 kato Exp $
+ * $Id: machdep.c,v 1.119 1999/06/17 11:09:39 kato Exp $
*/
#include "apm.h"
@@ -900,7 +900,8 @@ union descriptor gdt[NGDT * NCPU]; /* global descriptor table */
#else
union descriptor gdt[NGDT]; /* global descriptor table */
#endif
-struct gate_descriptor idt[NIDT]; /* interrupt descriptor table */
+static struct gate_descriptor idt0[NIDT];
+struct gate_descriptor *idt = &idt0[0]; /* interrupt descriptor table */
union descriptor ldt[NLDT]; /* local descriptor table */
#ifdef SMP
/* table descriptors - used to load tables by microp */
@@ -913,7 +914,6 @@ extern struct segment_descriptor common_tssd, *tss_gdt;
int private_tss; /* flag indicating private tss */
#if defined(I586_CPU) && !defined(NO_F00F_HACK)
-struct gate_descriptor *t_idt;
extern int has_f00f_bug;
#endif
@@ -1103,11 +1103,7 @@ setidt(idx, func, typ, dpl, selec)
{
struct gate_descriptor *ip;
-#if defined(I586_CPU) && !defined(NO_F00F_HACK)
- ip = (t_idt != NULL ? t_idt : idt) + idx;
-#else
ip = idt + idx;
-#endif
ip->gd_looffset = (int)func;
ip->gd_selector = selec;
ip->gd_stkcpy = 0;
@@ -1843,7 +1839,7 @@ init386(first)
setidt(0x80, &IDTVEC(int0x80_syscall),
SDT_SYS386TGT, SEL_UPL, GSEL(GCODE_SEL, SEL_KPL));
- r_idt.rd_limit = sizeof(idt) - 1;
+ r_idt.rd_limit = sizeof(idt0) - 1;
r_idt.rd_base = (int) idt;
lidt(&r_idt);
@@ -1950,6 +1946,7 @@ SYSINIT(f00f_hack, SI_SUB_INTRINSIC, SI_ORDER_FIRST, f00f_hack, NULL);
static void
f00f_hack(void *unused) {
+ struct gate_descriptor *new_idt;
#ifndef SMP
struct region_descriptor r_idt;
#endif
@@ -1960,7 +1957,7 @@ f00f_hack(void *unused) {
printf("Intel Pentium detected, installing workaround for F00F bug\n");
- r_idt.rd_limit = sizeof(idt) - 1;
+ r_idt.rd_limit = sizeof(idt0) - 1;
tmp = kmem_alloc(kernel_map, PAGE_SIZE * 2);
if (tmp == 0)
@@ -1968,10 +1965,11 @@ f00f_hack(void *unused) {
if (((unsigned int)tmp & (PAGE_SIZE-1)) != 0)
panic("kmem_alloc returned non-page-aligned memory");
/* Put the first seven entries in the lower page */
- t_idt = (struct gate_descriptor*)(tmp + PAGE_SIZE - (7*8));
- bcopy(idt, t_idt, sizeof(idt));
- r_idt.rd_base = (int)t_idt;
+ new_idt = (struct gate_descriptor*)(tmp + PAGE_SIZE - (7*8));
+ bcopy(idt, new_idt, sizeof(idt0));
+ r_idt.rd_base = (int)new_idt;
lidt(&r_idt);
+ idt = new_idt;
if (vm_map_protect(kernel_map, tmp, tmp + PAGE_SIZE,
VM_PROT_READ, FALSE) != KERN_SUCCESS)
panic("vm_map_protect failed");
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index e0b85b1..9a0ace5 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
- * $Id: machdep.c,v 1.118 1999/06/03 13:49:52 kato Exp $
+ * $Id: machdep.c,v 1.119 1999/06/17 11:09:39 kato Exp $
*/
#include "apm.h"
@@ -900,7 +900,8 @@ union descriptor gdt[NGDT * NCPU]; /* global descriptor table */
#else
union descriptor gdt[NGDT]; /* global descriptor table */
#endif
-struct gate_descriptor idt[NIDT]; /* interrupt descriptor table */
+static struct gate_descriptor idt0[NIDT];
+struct gate_descriptor *idt = &idt0[0]; /* interrupt descriptor table */
union descriptor ldt[NLDT]; /* local descriptor table */
#ifdef SMP
/* table descriptors - used to load tables by microp */
@@ -913,7 +914,6 @@ extern struct segment_descriptor common_tssd, *tss_gdt;
int private_tss; /* flag indicating private tss */
#if defined(I586_CPU) && !defined(NO_F00F_HACK)
-struct gate_descriptor *t_idt;
extern int has_f00f_bug;
#endif
@@ -1103,11 +1103,7 @@ setidt(idx, func, typ, dpl, selec)
{
struct gate_descriptor *ip;
-#if defined(I586_CPU) && !defined(NO_F00F_HACK)
- ip = (t_idt != NULL ? t_idt : idt) + idx;
-#else
ip = idt + idx;
-#endif
ip->gd_looffset = (int)func;
ip->gd_selector = selec;
ip->gd_stkcpy = 0;
@@ -1843,7 +1839,7 @@ init386(first)
setidt(0x80, &IDTVEC(int0x80_syscall),
SDT_SYS386TGT, SEL_UPL, GSEL(GCODE_SEL, SEL_KPL));
- r_idt.rd_limit = sizeof(idt) - 1;
+ r_idt.rd_limit = sizeof(idt0) - 1;
r_idt.rd_base = (int) idt;
lidt(&r_idt);
@@ -1950,6 +1946,7 @@ SYSINIT(f00f_hack, SI_SUB_INTRINSIC, SI_ORDER_FIRST, f00f_hack, NULL);
static void
f00f_hack(void *unused) {
+ struct gate_descriptor *new_idt;
#ifndef SMP
struct region_descriptor r_idt;
#endif
@@ -1960,7 +1957,7 @@ f00f_hack(void *unused) {
printf("Intel Pentium detected, installing workaround for F00F bug\n");
- r_idt.rd_limit = sizeof(idt) - 1;
+ r_idt.rd_limit = sizeof(idt0) - 1;
tmp = kmem_alloc(kernel_map, PAGE_SIZE * 2);
if (tmp == 0)
@@ -1968,10 +1965,11 @@ f00f_hack(void *unused) {
if (((unsigned int)tmp & (PAGE_SIZE-1)) != 0)
panic("kmem_alloc returned non-page-aligned memory");
/* Put the first seven entries in the lower page */
- t_idt = (struct gate_descriptor*)(tmp + PAGE_SIZE - (7*8));
- bcopy(idt, t_idt, sizeof(idt));
- r_idt.rd_base = (int)t_idt;
+ new_idt = (struct gate_descriptor*)(tmp + PAGE_SIZE - (7*8));
+ bcopy(idt, new_idt, sizeof(idt0));
+ r_idt.rd_base = (int)new_idt;
lidt(&r_idt);
+ idt = new_idt;
if (vm_map_protect(kernel_map, tmp, tmp + PAGE_SIZE,
VM_PROT_READ, FALSE) != KERN_SUCCESS)
panic("vm_map_protect failed");
OpenPOWER on IntegriCloud