Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: Chip Coldwell <coldwell@physics.harvard.edu>
Subject: VESA/VGA BIOS emulation
Date: Thu, 16 Dec 2004 15:24:43 -0500	[thread overview]
Message-ID: <Pine.LNX.4.61.0412161458560.25782@localhost.localdomain> (raw)


I posted this question on comp.os.vms a few days ago, but nobody's
responded so I suspect they don't know the answer.  Thus, I am trying
my luck here.  If you feel this is way OT, I've got my asbestos
underpants on so let the flames begin.

The Alpha SRM console supports a PC BIOS emulation callback routine
(Alpha Architecture Reference Manual, 3rd Ed, part III sect 2.3.7.3).
I've been using this function from VMS to set VGA video modes on a
video card not currently supported by OpenVMS Alpha, and since I can
see the results on screen I know this part of my code works.

One of the arguments the BIOS_EMUL function takes is an array of
longwords that correspond to the emulated Intel x86 registers.  Some
of the VESA extended BIOS functions (VBE 3.0) take parameters passed
by reference in the x86 registers, with the pointers in ES:DI using
the godawful Intel 20-bit real-mode segmented addressing scheme.[1]

My question is: how do I map from an OS virtual address to the
values in the emulated 8086 ES:DI registers?

For example, if I put the value 0x4F00 into the emulated AX register,
and a pointer to a 512 byte buffer in the ES:DI registers, then call
int 0x10, the VESA BIOS will fill in a bunch of very useful
information in the 512 byte buffer[2].  I can do all of this using the
SRM BIOS emulator callback, and I know it does something because the
AX register has the value 0x004F on return (byte-swap of the input AX
value), which the documents say indicates success.

I suspect there is a region of virtual address space set aside to
serve as memory for the x86 emulator, and that addresses I pass in the
ES:DI registers turn into offsets from the base of that region.  If
that's true, then what I really need to know is what that base address
is.

The BIOS_EMUL console callback can be passed an "additional_data"
parameter in the r20 register, but putting the virtual address in there
didn't work.  P0 space includes virtual addresses that fit in 20 bits, so
I tried stuffing one into the x86 segment/offset registers but that didn't
work either.  I even tried doing both simultaneously.

I noticed that XFree86 solves this problem by having their own x86
emulator that runs in the OS (see the contents of "xc/extras/x86emu"
in their source distribution).  This enables things like the XFree86
VESA driver to work on Alpha.  I could do something similar; I could
even use the emulator that comes with XFree86 since it was there
before their license changed, but it seems a shameful duplication of
effort if the SRM console already does what I need.

I can post my code if anyone thinks that would be helpful.

Notes:

[1] The 8086 segment/offset scheme represents a 20-bit address by a 16-bit
segment register and a 16-bit offset register where the physical address
is calculated as (segment << 4) + offset.  Yes, there are many
segment/offset combinations that yeild the same physical address.

[2] See http://www.vesa.org/vbe3.pdf for details.

Chip

-- 
Charles M. "Chip" Coldwell
System Administrator
Harvard Physics Department
617-495-3388


             reply	other threads:[~2004-12-16 20:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-16 20:24 Chip Coldwell [this message]
2004-12-18 21:27 ` VESA/VGA BIOS emulation Chip Coldwell
2004-12-18 21:50   ` Måns Rullgård
2004-12-19 18:01     ` Chip Coldwell
2004-12-21 17:21       ` FredK
2004-12-21 21:31         ` Chip Coldwell
2004-12-24  4:15           ` FredK
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox