Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386/i386 -if APM_USE_KVM86 is set, use BIOS calls ...
details: https://anonhg.NetBSD.org/src/rev/161918309ae4
branches: trunk
changeset: 533688:161918309ae4
user: drochner <drochner%NetBSD.org@localhost>
date: Sun Jul 07 13:06:56 2002 +0000
description:
-if APM_USE_KVM86 is set, use BIOS calls in virtual 8086 mode
-make sure the register frame is really cleared before use
(someone added a field to the frame later which didn't get zeroed)
diffstat:
sys/arch/i386/i386/apm.c | 66 +++++++++++++++++++++++++++++++++++++++++------
1 files changed, 57 insertions(+), 9 deletions(-)
diffs (158 lines):
diff -r 97bd196642c8 -r 161918309ae4 sys/arch/i386/i386/apm.c
--- a/sys/arch/i386/i386/apm.c Sun Jul 07 13:03:47 2002 +0000
+++ b/sys/arch/i386/i386/apm.c Sun Jul 07 13:06:56 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: apm.c,v 1.66 2001/11/15 07:03:28 lukem Exp $ */
+/* $NetBSD: apm.c,v 1.67 2002/07/07 13:06:56 drochner Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.66 2001/11/15 07:03:28 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.67 2002/07/07 13:06:56 drochner Exp $");
#include "apm.h"
#if NAPM > 1
@@ -86,6 +86,9 @@
#include <i386/isa/nvram.h>
#include <machine/bioscall.h>
+#ifdef APM_USE_KVM86
+#include <machine/kvm86.h>
+#endif
#include <machine/apmvar.h>
#if defined(APMDEBUG)
@@ -1030,15 +1033,25 @@
apm_busprobe()
{
struct bioscallregs regs;
+#ifdef APM_USE_KVM86
+ int res;
+#endif
#ifdef APMDEBUG
char bits[128];
#endif
+ memset(®s, 0, sizeof(struct bioscallregs));
regs.AX = APM_BIOS_FN(APM_INSTALLATION_CHECK);
regs.BX = APM_DEV_APM_BIOS;
- regs.CX = regs.DX = 0;
- regs.ESI = regs.EDI = regs.EFLAGS = 0;
+#ifdef APM_USE_KVM86
+ res = kvm86_bioscall_simple(APM_SYSTEM_BIOS, ®s);
+ if (res) {
+ printf("apm_busprobe: kvm86 error\n");
+ return (0);
+ }
+#else
bioscall(APM_SYSTEM_BIOS, ®s);
+#endif
DPRINTF(APMDEBUG_PROBE, ("apm: bioscall return: %x %x %x %x %s %x %x\n",
regs.AX, regs.BX, regs.CX, regs.DX,
bitmask_snprintf(regs.EFLAGS, I386_FLAGBITS, bits, sizeof(bits)),
@@ -1105,16 +1118,27 @@
u_int okbases[] = { 0, biosbasemem*1024 };
u_int oklimits[] = { PAGE_SIZE, IOM_END};
u_int i;
+#ifdef APM_USE_KVM86
+ int res;
+#endif
#ifdef APMDEBUG
char bits[128];
#endif
printf(": ");
+ memset(®s, 0, sizeof(struct bioscallregs));
regs.AX = APM_BIOS_FN(APM_INSTALLATION_CHECK);
regs.BX = APM_DEV_APM_BIOS;
- regs.CX = regs.DX = regs.SI = regs.DI = regs.FLAGS = 0;
+#ifdef APM_USE_KVM86
+ res = kvm86_bioscall_simple(APM_SYSTEM_BIOS, ®s);
+ if (res) {
+ printf("apm_attach: kvm86 error\n");
+ goto bail_disconnected;
+ }
+#else
bioscall(APM_SYSTEM_BIOS, ®s);
+#endif
DPRINTF_BIOSRETURN(regs, bits);
DPRINTF(APMDEBUG_ATTACH, ("\n%s: ", apmsc->sc_dev.dv_xname));
@@ -1124,10 +1148,18 @@
* call a disconnect in case it was already connected
* by some previous code.
*/
+ memset(®s, 0, sizeof(struct bioscallregs));
regs.AX = APM_BIOS_FN(APM_DISCONNECT);
regs.BX = APM_DEV_APM_BIOS;
- regs.CX = regs.DX = regs.SI = regs.DI = regs.FLAGS = 0;
+#ifdef APM_USE_KVM86
+ res = kvm86_bioscall_simple(APM_SYSTEM_BIOS, ®s);
+ if (res) {
+ printf("apm_attach: kvm86 error\n");
+ goto bail_disconnected;
+ }
+#else
bioscall(APM_SYSTEM_BIOS, ®s);
+#endif
DPRINTF_BIOSRETURN(regs, bits);
DPRINTF(APMDEBUG_ATTACH, ("\n%s: ", apmsc->sc_dev.dv_xname));
@@ -1139,11 +1171,18 @@
/*
* And connect to it.
*/
+ memset(®s, 0, sizeof(struct bioscallregs));
regs.AX = APM_BIOS_FN(APM_32BIT_CONNECT);
regs.BX = APM_DEV_APM_BIOS;
- regs.CX = regs.DX = regs.DI = regs.FLAGS = 0;
- regs.ESI = 0;
+#ifdef APM_USE_KVM86
+ res = kvm86_bioscall_simple(APM_SYSTEM_BIOS, ®s);
+ if (res) {
+ printf("apm_attach: kvm86 error\n");
+ goto bail_disconnected;
+ }
+#else
bioscall(APM_SYSTEM_BIOS, ®s);
+#endif
DPRINTF_BIOSRETURN(regs, bits);
DPRINTF(APMDEBUG_ATTACH, ("\n%s: ", apmsc->sc_dev.dv_xname));
@@ -1481,10 +1520,15 @@
/*
* call a disconnect; we're punting.
*/
+ memset(®s, 0, sizeof(struct bioscallregs));
regs.AX = APM_BIOS_FN(APM_DISCONNECT);
regs.BX = APM_DEV_APM_BIOS;
regs.CX = regs.DX = regs.SI = regs.DI = regs.FLAGS = 0;
+#ifdef APM_USE_KVM86
+ (void)kvm86_bioscall_simple(APM_SYSTEM_BIOS, ®s);
+#else
bioscall(APM_SYSTEM_BIOS, ®s);
+#endif
DPRINTF(APMDEBUG_ATTACH, ("\n%s: ", apmsc->sc_dev.dv_xname));
DPRINTF_BIOSRETURN(regs, bits);
bail_disconnected:
@@ -1508,10 +1552,14 @@
/*
* We were unable to create the APM thread; bail out.
*/
+ memset(®s, 0, sizeof(struct bioscallregs));
regs.AX = APM_BIOS_FN(APM_DISCONNECT);
regs.BX = APM_DEV_APM_BIOS;
- regs.CX = regs.DX = regs.SI = regs.DI = regs.FLAGS = 0;
+#ifdef APM_USE_KVM86
+ (void)kvm86_bioscall_simple(APM_SYSTEM_BIOS, ®s);
+#else
bioscall(APM_SYSTEM_BIOS, ®s);
+#endif
DPRINTF(APMDEBUG_ATTACH, ("\n%s: ", apmsc->sc_dev.dv_xname));
DPRINTF_BIOSRETURN(regs, bits);
printf("%s: unable to create thread, kernel APM support disabled\n",
Home |
Main Index |
Thread Index |
Old Index