summaryrefslogtreecommitdiffstats
path: root/sys/i386/bios
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2010-11-11 19:20:33 +0000
committerjkim <jkim@FreeBSD.org>2010-11-11 19:20:33 +0000
commit98098c3edad41d04379bb95076ac6581d99b8a64 (patch)
treecaf4057ec3be654a33e841cf36a7fbbb9c555d95 /sys/i386/bios
parent2c7257916febea8b75c0dd26b35c761f32102153 (diff)
downloadFreeBSD-src-98098c3edad41d04379bb95076ac6581d99b8a64.zip
FreeBSD-src-98098c3edad41d04379bb95076ac6581d99b8a64.tar.gz
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
Diffstat (limited to 'sys/i386/bios')
-rw-r--r--sys/i386/bios/apm.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c
index e015cd0..f33bafd 100644
--- a/sys/i386/bios/apm.c
+++ b/sys/i386/bios/apm.c
@@ -1389,6 +1389,23 @@ apmioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td
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;
OpenPOWER on IntegriCloud