2

I've got an intel-based SBC that I'm using in an embedded application. It's got a Digital IO (DIO) port attached to a Fintek Super I/O chip. I want to be able to set the bits on the output lines of this port to control some other hardware.

Fortunately, the manufacturer's BIOS comes with a function to do just this:

AX=6F09h
bl=<bits>
int 15h

Unfortunately I'm running 64-bit linux in protected mode. Is there any way I can call that bios interrupt, either from a user-space program or as a kernel driver if need be?

I can alternatively set registers directly on the Fintek chip, but this requires knowing exactly what pins on the chip are connected to the DIO header, and, of course, this changes from board revision to board revision.

gct
  • 14,100
  • 15
  • 68
  • 107

3 Answers3

2

Your distribution probably has packages for libx86. libx86 uses lrmi (the opposite of DPMI) on x86, and an x86 emulator on x86-64, since AFAIK vm86 mode cannot be used from 64 bits mode.

ninjalj
  • 42,493
  • 9
  • 106
  • 148
  • True, vm86 mode is no longer usable from long mode code (note "long mode" not "64 bit" - even 32 bit code running in long mode (it had it's name, forgot it) is not able to use vm86). – Griwes Feb 15 '12 at 13:23
1

First of all, you must ensure that Linux doesn't overwrite memory, where interrupts reside.

You will not be able to get to real mode in any easy and not-breaking OS runtime way. You should find where in memory that interrupt function is and use some kind of emulator to interpret that 16bit machine code and execute 64bit long mode procedures. You can search OSDev Forums and OSDev Wiki to find more on this topic.

(Tip: look for questions about using VESA in protected mode).

Griwes
  • 8,805
  • 2
  • 43
  • 70
0

I've shimmed it into the bootloader before for prototypes, but it may not carry over. Either you fix the hw or futz with the chip locations based on "where they've been before".

Dtyree
  • 330
  • 2
  • 5