From 9f911945d51d19ca0f32a6f6f89d21011babd8f9 Mon Sep 17 00:00:00 2001 From: itojun Date: Mon, 24 Jun 2002 10:10:17 +0000 Subject: [PATCH] handle IDT-less case just as linux does --- sys/arch/i386/i386/vm86.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/sys/arch/i386/i386/vm86.c b/sys/arch/i386/i386/vm86.c index 9693c5cab4ef..0d7603609cf7 100644 --- a/sys/arch/i386/i386/vm86.c +++ b/sys/arch/i386/i386/vm86.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm86.c,v 1.26 2002/03/29 17:07:06 christos Exp $ */ +/* $NetBSD: vm86.c,v 1.27 2002/06/24 10:10:17 itojun Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm86.c,v 1.26 2002/03/29 17:07:06 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm86.c,v 1.27 2002/06/24 10:10:17 itojun Exp $"); #include #include @@ -158,8 +158,17 @@ fast_intxx(p, intrno) * Fetch intr handler info from "real-mode" IDT based at addr 0 in * the user address space. */ - if (copyin((caddr_t)(intrno * sizeof(ihand)), &ihand, sizeof(ihand))) - goto bad; + if (copyin((caddr_t)(intrno * sizeof(ihand)), &ihand, sizeof(ihand))) { + /* + * No IDT! What Linux does here is simply call back into + * userspace with the VM86_INTx arg as if it was a revectored + * int. Some applications rely on this (i.e. dynamically + * emulate an IDT), and those that don't will crash in a + * spectacular way, I suppose. + * --thorpej@netbsd.org + */ + goto vector; + } /* * Otherwise, push flags, cs, eip, and jump to handler to @@ -181,10 +190,6 @@ fast_intxx(p, intrno) vector: vm86_return(p, VM86_MAKEVAL(VM86_INTx, intrno)); return; - -bad: - vm86_return(p, VM86_UNKNOWN); - return; } void