[SeaBIOS] FreeBSD VESA console not working with SeaBIOS

Kevin O'Connor kevin at koconnor.net
Thu Apr 9 15:15:24 CEST 2015

On Thu, Apr 09, 2015 at 10:59:11AM +0200, Jon Doe wrote:
> On Thu, Apr 9, 2015 at 4:32 AM, Kevin O'Connor <kevin at koconnor.net> wrote:
> > On Wed, Apr 08, 2015 at 08:48:11PM +0200, Peter Stuge wrote:
> >> Kevin O'Connor wrote:
> >> > (Specifically, the "leal" instruction is not properly implemented.)
> >> >
> >> > Unfortunately, there isn't much that can be done about this on the vga
> >> > bios side.
> >>
> >> Really? Impossible to save flags, use other opcodes, and restore flags?
> >>
> >> lea isn't used in vgasrc/ besides in the trap that triggers the fault.
> >>
> >> In src/romlayout.S lea is used in two places to bump esp before calls.
> >> If those code paths are used also by SeaVGABIOS then maybe they could
> >> be rewritten with simpler instructions?
> >
> > The problem is not with leal in hand written assembler - the problem
> > is with leal instructions generated by gcc.  To see the assembler gcc
> > produces for the vgabios one can look at out/vgaccode16.raw.s .  Or,
> > alternatively, one can run:
> >   objdump -m i386 -M i8086 -M suffix -ldr out/vgarom.o
> >
> > We've fixed up gcc assembler in the past (see scripts/vgafixup.py) to
> > work around x86emu.  However, the leal instruction seems painful to
> > patch out - particularly so when %esp is one of the registers read or
> > written in the leal instruction.  If anyone wants to take a stab
> > at a workaround, feel free to submit a patch.
> >
> > -Kevin
> Might be instructive to look at how vmware and virtualbox BIOSes is
> able to work around this problem. Surely their BIOS code is written in
> C?

My understanding is that traditional proprietary BIOS and VGABIOS are
written in assembler.

There are 16bit C compilers that (almost assuredly) wont generate
32bit instructions such as leal - for example, openwatcom and bcc.
However, using them results in other problems.

> Fixing this in x86emu is probably the right thing to do (just checked,
> PCBSD 10.1's x86emu is still broken), but this won't help if you're
> stuck with an old release.

It's also possible to use the older "lgpl vgabios" -
http://www.nongnu.org/vgabios/ - it is written in assembler and C code
(that is compiled with bcc).


More information about the SeaBIOS mailing list