[haiku-development] Re: S3 Video Driver

Gerald Zajac <zajacg@xxxxxxxxxxxxx> wrote:
> I haven't looked at that code yet, but I hope that it will also allow
> drivers other than the VESA driver to call the video BIOS.

Indeed it's already possible. You just have to do something like that:

#include <arch/x86/vm86.h>

{
        struct vm86_state vmState;
        status_t ret = vm86_prepare(&vmState, 0x2000);
        if (ret != B_OK)
                return ret;

        vmState.regs.eax = 0x4f02;
        vmState.regs.ebx = 0x123;
        ret = vm86_do_int(vmState, 0x10);
        if (ret != B_OK) {
                /* vm86 mode failed */
        }

        if ((vmState.regs.eax & 0xffff) != 0x4f) {
                /* handle VESA error */
        }

        vm86_cleanup(&vmState);
}

You can also have a look at my recently posted patches for the VESA driver. 
Please note that you will need the "[PATCH 1/4] Export vm86_* functions to 
other modules correctly" patch, otherwise your driver won't compile nor 
link...

/Jan


Other related posts: