Calling 16-bit PM code from 32-bit PM Kernel Driver

Calling 16-bit PM code from 32-bit PM Kernel Driver

Post by Wez Furlon » Sun, 13 Jun 1999 04:00:00

Any ideas?

Does anyone have experience with this?

I am trying to access the VESA VBE 3 Protected Mode interface from a driver
(so I can build a framebuffer device).

The VBE 3 spec explains how to find out where the PM interface stuff is, and
says that I need to create 16bit data selectors for a data storage area
(which must be allocated for the PMI), 0xa0000, 0xb0000, 0xb80000, and one
more for a 16bit stack (which must also be allocated for the PMI).

In addition, the bios needs to be copied into RAM, and a 16bit code selector
created that points to it.

It goes on to say that in order to use the interface, I need to switch to
the 16bit stack I allocated, and make a far call using a 16:32 pointer to
the PMI entry point.

I understand (in general terms) the concepts of selectors, but do not
understand how to use them within the 32bit Linux kernel.

I see from the APM code that the gdt is set up with a couple of custom
selectors - is this the approach I should take? Will this work for 16 bit

So far I have added my own entries to the gdt, set them up as best I know
how, but when I make the call to the BIOS, the system hangs (it doesn't even
get as far as an oops).

Any suggestions and/or examples, or even pointers to people/places with more
info will be greatly received.


1. I need to run 16-bit executable on 32-bit OS

(My previous posting's description seems to have its ending "?" truncated,
so I am re-posting with a new description.)

What I need is the ability to -run- existing 16-bit compiled and linked code
on a 32-bit UNIX operating system and have it interface to native UNIX code.

I have a package running on an 80286.  I want to move it to a UNIX platform,
and UnixWare is what my company would like to use.

The package DOES NOT run under DOS.  It runs on our own system which DOES
NOT use any protected mode capabilities of the 80286.  However, executables
that we load and run -are- in DOS's 16-bit ".EXE" format (the non-Windows
format).  Loading the executable into memory is not a problem.  I already
have a solution for that.  What I need to resolve is the following:

  1.  How do I tell UnixWare that the code I want it to execute is 16-bit
        code, and
  2.  How do I call 32-bit routines from the 16-bit code?

Note:  The executable is already being passed the address of a table of
service routine addresses in segment:offset format.  The executable then
uses these routine addresses for every access to system services for file,
I/O, and other operations.

BTW:  UnixWare -does- come with a product called Merge from Locus Computing
Corporation, but it does not fully meet our needs.


Apertus Technologies                                       (612) 828-0582
Eden Prairie, MN

2. CDE 1.2 and Solaris 2.6

3. AHA-3940AUW invisable

4. SpeedStar64 on 16-bit & 32-bit modes

5. libjpeg problemo

6. How to run a 16-bit executable on a 32-bit OS?

7. OKIDATA 400 LED printer problem

8. Can't use 16-bit, 32-bit modes

9. DMA : 32-bit physical address -> 16-bit segment/offset

10. mrand48() returning 16-bit longs, instead of 32-bit

11. difference between 16-bit & 32-bit OPERATING SYSTEMS

12. OSR5 arad gives WARNING 32-bit PM interface