summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_trap.c
diff options
context:
space:
mode:
authorsef <sef@FreeBSD.org>1997-12-03 02:45:50 +0000
committersef <sef@FreeBSD.org>1997-12-03 02:45:50 +0000
commit27c596e1ed6ea0fe26b2cf64d9e5a257d92f2d34 (patch)
tree2692587b854c4cfa8a941378c4bf7963d3ab5b07 /sys/kern/subr_trap.c
parent9d22d2de832f88f942dc2cc7473ca06c716d2f4b (diff)
downloadFreeBSD-src-27c596e1ed6ea0fe26b2cf64d9e5a257d92f2d34.zip
FreeBSD-src-27c596e1ed6ea0fe26b2cf64d9e5a257d92f2d34.tar.gz
Work around for the Intel Pentium F00F bug; this is Intel's recommended
workaround. Note that this currently eats up two pages extra in the system; this could be alleviated by aligning idt correctly, and then only dealing with that (as opposed to the current method of allocated two pages and copying the IDT table to that, and then setting that to be the IDT table).
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r--sys/kern/subr_trap.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index e53b015..9bebd7e 100644
--- a/sys/kern/subr_trap.c
+++ b/sys/kern/subr_trap.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
- * $Id: trap.c,v 1.114 1997/11/06 19:28:09 phk Exp $
+ * $Id: trap.c,v 1.115 1997/11/24 13:25:37 bde Exp $
*/
/*
@@ -142,6 +142,11 @@ static char *trap_msg[] = {
static void userret __P((struct proc *p, struct trapframe *frame,
u_quad_t oticks));
+#ifndef NO_F00F_HACK
+extern struct gate_descriptor *t_idt;
+extern int has_f00f_bug;
+#endif
+
static inline void
userret(p, frame, oticks)
struct proc *p;
@@ -211,6 +216,9 @@ trap(frame)
u_long eva;
#endif
+#ifndef NO_F00F_HACK
+restart:
+#endif
type = frame.tf_trapno;
code = frame.tf_err;
@@ -276,6 +284,10 @@ trap(frame)
i = trap_pfault(&frame, TRUE);
if (i == -1)
return;
+#ifndef NO_F00F_HACK
+ if (i == -2)
+ goto restart;
+#endif
if (i == 0)
goto out;
@@ -642,7 +654,18 @@ trap_pfault(frame, usermode)
if (va >= KERNBASE) {
/*
* Don't allow user-mode faults in kernel address space.
+ * An exception: if the faulting address is the invalid
+ * instruction entry in the IDT, then the Intel Pentium
+ * F00F bug workaround was triggered, and we need to
+ * treat it is as an illegal instruction, and not a page
+ * fault.
*/
+#ifndef NO_F00F_HACK
+ if ((eva == (unsigned int)&t_idt[6]) && has_f00f_bug) {
+ frame->tf_trapno = T_PRIVINFLT;
+ return -2;
+ }
+#endif
if (usermode)
goto nogo;
OpenPOWER on IntegriCloud