svn commit: r215139 - head/sys/i386/bios

Jung-uk Kim jkim at FreeBSD.org
Thu Nov 11 19:20:33 UTC 2010


Author: jkim
Date: Thu Nov 11 19:20:33 2010
New Revision: 215139
URL: http://svn.freebsd.org/changeset/base/215139

Log:
  Add compat shim for apm(4) to translate APM BIOS function numbers from i386
  to PC98-specific ones.  Any binaries using apm ioctl(4) commands but built
  for i386 should also work on PC98 now.
  
  Reviewed by:	imp, nyan

Modified:
  head/sys/i386/bios/apm.c

Modified: head/sys/i386/bios/apm.c
==============================================================================
--- head/sys/i386/bios/apm.c	Thu Nov 11 19:18:52 2010	(r215138)
+++ head/sys/i386/bios/apm.c	Thu Nov 11 19:20:33 2010	(r215139)
@@ -1389,6 +1389,23 @@ apmioctl(struct cdev *dev, u_long cmd, c
 			return (EPERM);
 		/* XXX compatibility with the old interface */
 		args = (struct apm_bios_arg *)addr;
+#ifdef PC98
+		if (((args->eax >> 8) & 0xff) == 0x53) {
+			sc->bios.r.eax = args->eax & ~0xffff;
+			sc->bios.r.eax |= APM_BIOS << 8;
+			switch (args->eax & 0xff) {
+			case 0x0a:
+				sc->bios.r.eax |= APM_GETPWSTATUS;
+				break;
+			case 0x0e:
+				sc->bios.r.eax |= APM_DRVVERSION;
+				break;
+			default:
+				sc->bios.r.eax |= args->eax & 0xff;
+				break;
+			}
+		} else
+#endif
 		sc->bios.r.eax = args->eax;
 		sc->bios.r.ebx = args->ebx;
 		sc->bios.r.ecx = args->ecx;


More information about the svn-src-head mailing list