Commit Graph

23 Commits

Author SHA1 Message Date
Gerd Hoffmann f4c6e4c19d vga: add ati bios tables
Needed to make drivers happy which try to gather
informations from these tables.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-03-15 09:59:25 +01:00
Kevin O'Connor 0b2165d191 vgabios: Emulate "leal" instruction
Emulate the "leal" instruction so that the vgabios can run on older
versions of x86emu.  (This removes the previous "leal" trap.)

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-04-11 14:36:59 -04:00
Kevin O'Connor 799b20b0db vgabios: Add config option for assembler fixups
Add a kconfig build option (CONFIG_VGA_FIXUP_ASM) to allow users to
build the vgabios without the complex assembler fixups that work
around emulator bugs.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-04-10 00:38:17 -04:00
Kevin O'Connor 251e26388b vgabios: Don't use extra stack if it appears a modern OS is in use
If the last mode set (while not in vm86 mode) was done from a VBE mode
set call then disable the extra stack.  This works under the premise
that only a modern OS would invoke the VBE mode changing facilities
and a modern OS would always call the vgabios with sufficient stack
space.

This is an ugly hack to work around a problem Windows Vista (and
possibly later Windows releases) has with the VGA BIOS using a stack
in the e-segment.

Reported-by: Richard Laager <rlaager@wiktel.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-03-18 01:46:56 -04:00
Kevin O'Connor aa66d6539c Use an aligned stack offset when entering on the extra stack
The size of 'struct bregs' is not evenly divisible by four and where
the assembler placed a 'struct bregs' on the extra stack as part of
entering into the C functions it caused the C functions to run with a
non-aligned stack.  It's technically not correct to use an unaligned
stack and it is certainly less efficient.

This patch avoids using BREGS_size (the sizeof struct bregs) and
instead introduces PUSHBREGS_size (the size of the general purpose
registers in struct bregs) in the assembler.  Where the code actually
did use the %cs:%ip and flags, an extra 8 (instead of 6) bytes are
added to maintain a sane alignment.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-11-12 12:17:57 -05:00
Kevin O'Connor b4eb6fc5cc vgabios: Add software cursor capability
Add mechanism for drawing a cursor to the framebuffer to implement a
cursor in software.  The timer interrupt is "hooked" so that the
cursor can blink.  This can be useful for "coreboot native vga".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-11-12 12:17:57 -05:00
Kevin O'Connor 46000f5608 Create assembler macros for saving and restoring 'struct bregs'
Create macros SAVEBREGS_POP_DSEAX and RESTOREBREGS_DSEAX for saving
and restoring the cpu state.  These are similar to the existing
PUSHBREGS and POPBREGS macros.

This also fixes a bug in __farcall16 which inadvertently restored %ds
in %es and vice-versa.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-27 10:56:54 -04:00
David Woodhouse 67fd42cf16 vgabios: Use .code16 not .code16gcc
There's no need to use .code16gcc where we are writing assembler code
explicitly. It only affects word-size-ambiguous instructions, and we
should just be explicit. And we are.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2014-06-05 10:58:29 -04:00
Kevin O'Connor 3c37cdb197 vgabios: Add debug message if x86emu leal check triggers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-05-13 10:51:29 -04:00
Kevin O'Connor 8032b8a0fe vgabios: Attempt to detect old x86emu and force a fault.
Check for cases where the leal instruction does not work.  This
instruction is known to not be emulated properly on old versions of
x86emu.  If a broken version of x86emu is found, force a fault that
x86emu will easily detect.  This should help prevent soft failures
when running old software.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-02-05 23:15:27 -05:00
Kevin O'Connor feb0284e37 Small improvements to irqentry_extrastack assembler.
Simplify the entry assembler slightly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-09 20:39:16 -05:00
Kevin O'Connor 41c6061d36 vgabios: Avoid memory references via %esp register in vgabios.
Win7 interprets the vgabios and it does not properly handle memory
references relative to the %esp register.  Commit 4a8b58cb introduced
some of these %esp references - rework that assembler to avoid these
instructions and make win7 happy.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-09 17:27:54 -05:00
Kevin O'Connor dab0a7407c vgabios: Move initialization code to new file vgainit.c.
Move the initialization code out of vgabios.c to a new file to reduce
the size of the vgabios.c file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-04 10:34:18 -05:00
Kevin O'Connor 4a8b58cb6c vgabios: Support allocating an extra stack for vgabios calls and default on.
Add code to allocate an extra stack for the main vgabios int 0x10
entry point.  The allocation is done via the PMM spec and uses a PCI
v3 permanent low memory region request.  This request will work with
SeaBIOS - it is unknown how many other main BIOS implementations
support this PMM call.

The extra stack is useful for old DOS programs that call the VGABIOS
and expect it to work with very small amounts of stack space.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-04 10:34:18 -05:00
Kevin O'Connor 9332f9b172 vgabios: Work around lack of support for "calll" in x86emu emulation.
Replace 32 bit call instructions with 16 bit call instructions in the
vgabios to workaround problems in old versions of x86emu.  This change
allows fc13 and fc14 to boot.  (Other x86emu emulation bugs still
prevent fc11 and fc12 from booting.)

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-04 10:34:17 -05:00
Kevin O'Connor 36feea9317 Direct compile 16bit C code instead of including via .S files.
Create a ".code16gcc" directive in src/code16gcc.s and use
-Wa,src/code16gcc.s to tell gcc to compile directly to 16bit code.
This eliminates the need to compile the C code to assembler and
include in romlayout.S and vgaentry.S.  This also allows those two
assembler files to be compiled with debugging (-g) enabled.

Also, includes some Makefile cleanups.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-11 10:49:45 -05:00
Kevin O'Connor 9961f9958c vgabios: Add support for vesa get/set window function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01 20:37:02 -05:00
Kevin O'Connor 72b5e45550 vgabios: Place a signature at offset 0x1e of the rom.
It appears some emulators look for a signature at offset 0x1e of the
option rom.  So, port the signature from the LGPL bios.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-27 21:44:27 -05:00
Julian Pidancet 7c6509cb10 Add a PCI header to the VGA ROM if needed
Allows the ROM to be extracted from a PCI device.

V2: * Declare the PCI header in C
    * Replace #ifdef CONFIG_VGA_PCI with #if CONFIG_VGA_PCI == 1

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
2011-12-20 23:13:06 -05:00
Kevin O'Connor 3dba4c236d Support non-local build directory - allow "make OUT=abc/" to work.
Don't require the build directory to be the "out/" directory of the
SeaBIOS source.
2011-01-29 14:48:53 -05:00
Kevin O'Connor c9d3c2d1c4 Minor vga binary cleanups. 2010-01-01 13:05:23 -05:00
Kevin O'Connor 9f193b9883 Define unified entry points for irq handlers.
The irq entry points now push the handler address and jump to a
    function that does parameter setup.  This reduces the code size
    because the entry setup isn't repeated for every handler.
2009-05-16 23:31:27 -04:00
Kevin O'Connor 1f2c307bc3 Add initial port of the "open source vga bios" project.
This is an initial import of the code from:
    http://www.nongnu.org/vgabios/
The code has been ported from bcc to gcc and gas.
This is an initial import - many functions have not been ported; many
    bugs are present.
2009-05-06 23:35:59 -04:00