summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2003-05-04 04:58:17 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2003-05-04 04:58:17 +0000
commit0586c027875790df6679f4197c9aab5d5f4d97f4 (patch)
treed5b53ec42106c7273f676906166ad5f0a6f8be92
parentff2e1662aa70c8fcde0dec71bf0d8413480603e6 (diff)
When a protection fault occurs, force %cr2 to contain the pc as
the fault address.
-rw-r--r--sys/arch/i386/i386/trap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c
index 68c6f74eac5..c7841cb16df 100644
--- a/sys/arch/i386/i386/trap.c
+++ b/sys/arch/i386/i386/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.54 2003/05/02 21:07:48 mickey Exp $ */
+/* $OpenBSD: trap.c,v 1.55 2003/05/04 04:58:16 drahn Exp $ */
/* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */
/*-
@@ -327,6 +327,8 @@ trap(frame)
#endif
if (ftype == VM_PROT_READ)
ftype |= VM_PROT_EXECUTE;
+ /* force %cr2 register have fault address */
+ __asm __volatile("movl %0,%%cr2" :: "r" (frame.tf_eip));
goto page_fault;
case T_TSSFLT|T_USER: