summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_trap.c
diff options
context:
space:
mode:
authorjlemon <jlemon@FreeBSD.org>1998-03-23 19:52:59 +0000
committerjlemon <jlemon@FreeBSD.org>1998-03-23 19:52:59 +0000
commit8f4e20b1a35e937bbd54a2aae08925d58fe629d6 (patch)
tree4562782c6b8cf96026bed2ea30ad93d394db0dbe /sys/kern/subr_trap.c
parentc6b01b495d72c0a38989df9916619c271ff13e71 (diff)
downloadFreeBSD-src-8f4e20b1a35e937bbd54a2aae08925d58fe629d6.zip
FreeBSD-src-8f4e20b1a35e937bbd54a2aae08925d58fe629d6.tar.gz
Add the ability to make real-mode BIOS calls from the kernel. Currently,
everything is contained inside #ifdef VM86, so this option must be present in the config file to use this functionality. Thanks to Tor Egge, these changes should work on SMP machines. However, it may not be throughly SMP-safe. Currently, the only BIOS calls made are memory-sizing routines at bootup, these replace reading the RTC values.
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r--sys/kern/subr_trap.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index 79715f5..5e1bb32 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.121 1998/02/04 22:32:12 eivind Exp $
+ * $Id: trap.c,v 1.122 1998/02/06 12:13:10 eivind Exp $
*/
/*
@@ -225,6 +225,35 @@ restart:
type = frame.tf_trapno;
code = frame.tf_err;
+#ifdef VM86
+ if (in_vm86call) {
+ if (frame.tf_eflags & PSL_VM &&
+ (type == T_PROTFLT || type == T_STKFLT)) {
+ i = vm86_emulate((struct vm86frame *)&frame);
+ if (i != 0)
+ /*
+ * returns to original process
+ */
+ vm86_trap((struct vm86frame *)&frame);
+ return;
+ }
+ switch (type) {
+ /*
+ * these traps want either a process context, or
+ * assume a normal userspace trap.
+ */
+ case T_PROTFLT:
+ case T_SEGNPFLT:
+ trap_fatal(&frame);
+ return;
+ case T_TRCTRAP:
+ type = T_BPTFLT; /* kernel breakpoint */
+ /* FALL THROUGH */
+ }
+ goto kernel_trap; /* normal kernel trap handling */
+ }
+#endif
+
if ((ISPL(frame.tf_cs) == SEL_UPL) || (frame.tf_eflags & PSL_VM)) {
/* user trap */
@@ -356,6 +385,9 @@ restart:
break;
}
} else {
+#ifdef VM86
+kernel_trap:
+#endif
/* kernel trap */
switch (type) {
OpenPOWER on IntegriCloud