---------------------------------------------------------------------- Patch name: VBE Linear Frame Buffer support Author: Jeroen Janssen Date: 24 March 2002 RCS Id: $Id: patch.vbe-lfb,v 1.2 2002/03/21 07:13:47 japj Exp $ Detailed description: This patch will (together with an update vgabios) add support for VBE Linear Frame Buffer modes. The file patch.vbe-lfb-bios.tar.gz contains a LFB enabled vbebios. It was build from the vgabios sources on 24 March 2002 with #define VBE_HAVE_LFB uncommented in vbe.c In order to test the LFB code, you need to replace the vgaromimage: line in .bochsrc to the extracted vbebios.bin. The tar.gz file also contains a 'debug' build bios that shows lots of information on the bochsout logfile. Patch was created with: cvs diff -u Apply patch to what version: cvs checked out on 24 March 2002, release version 1.4pre1 Instructions: To patch, go to main bochs directory. Type "patch -p0 < THIS_PATCH_FILE". ---------------------------------------------------------------------- *** iodev/vga.cc 16 Mar 2002 11:37:43 -0000 1.29 --- iodev/vga.cc 24 Mar 2002 10:30:06 -0000 @@ -2081,9 +2081,20 @@ bx_vga_c::vbe_mem_read(Bit32u addr) { Bit32u offset; - offset = addr - 0xA0000; + + if (addr >= VBE_DISPI_LFB_PHYSICAL_ADDRESS) + { + // LFB read + // FIXME: check for max VBE video memory size + offset = offset - VBE_DISPI_LFB_PHYSICAL_ADDRESS; + } + else + { + // banked mode read + offset = BX_VGA_THIS s.vbe_bank*65536 + addr - 0xA0000; + } - return (BX_VGA_THIS s.vbe_memory[BX_VGA_THIS s.vbe_bank*65536 + offset]); + return (BX_VGA_THIS s.vbe_memory[offset]); } void @@ -2091,7 +2102,18 @@ { Bit32u offset; unsigned x_tileno, y_tileno; - offset = BX_VGA_THIS s.vbe_bank*65536 + (addr - 0xA0000); + + if (addr >= VBE_DISPI_LFB_PHYSICAL_ADDRESS) + { + // LFB write + // FIXME: check for max VBE video memory size + offset = offset - VBE_DISPI_LFB_PHYSICAL_ADDRESS; + } + else + { + // banked mode write + offset = BX_VGA_THIS s.vbe_bank*65536 + (addr - 0xA0000); + } // check for out of memory write if (offset < sizeof(BX_VGA_THIS s.vbe_memory)) *** iodev/vga.h 16 Mar 2002 10:22:57 -0000 1.10 --- iodev/vga.h 24 Mar 2002 10:30:11 -0000 @@ -52,6 +52,8 @@ #define VBE_DISPI_DISABLED 0x00 #define VBE_DISPI_ENABLED 0x01 + #define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000 + #define BX_MAX_XRES VBE_DISPI_MAX_XRES #define BX_MAX_YRES VBE_DISPI_MAX_YRES *** memory/memory.cc 3 Oct 2001 13:10:38 -0000 1.9 --- memory/memory.cc 24 Mar 2002 10:30:16 -0000 @@ -224,6 +224,37 @@ data_ptr = (Bit8u *) data + (len - 1); #endif + +#if BX_SUPPORT_VBE + // Check VBE LFB support + + if (a20addr >= VBE_DISPI_LFB_PHYSICAL_ADDRESS) + { + for (i = 0; i < len; i++) { + // FIXME: check for max VBE video memory size + + //if (a20addr < BX_MEM_THIS len) { + //vector[a20addr] = *data_ptr; + //BX_DBG_DIRTY_PAGE(a20addr >> 12); + //BX_DYN_DIRTY_PAGE(a20addr >> 12); + BX_VGA_MEM_WRITE(a20addr, *data_ptr); + // } + + // otherwise ignore byte, since it overruns memory + addr++; + a20addr = A20ADDR(addr); +#ifdef BX_LITTLE_ENDIAN + data_ptr++; +#else // BX_BIG_ENDIAN + data_ptr--; +#endif + } + return; + } + +#endif + + #if BX_SUPPORT_APIC bx_generic_apic_c *local_apic = &cpu->local_apic; bx_generic_apic_c *ioapic = bx_devices.ioapic; @@ -422,6 +453,36 @@ #else // BX_BIG_ENDIAN data_ptr = (Bit8u *) data + (len - 1); #endif + +#if BX_SUPPORT_VBE + // Check VBE LFB support + + if (a20addr >= VBE_DISPI_LFB_PHYSICAL_ADDRESS) + { + for (i = 0; i < len; i++) { + // FIXME: check for max VBE video memory size + + //if (a20addr < BX_MEM_THIS len) { + //vector[a20addr] = *data_ptr; + //BX_DBG_DIRTY_PAGE(a20addr >> 12); + //BX_DYN_DIRTY_PAGE(a20addr >> 12); + *data_ptr = BX_VGA_MEM_READ(a20addr); + // } + + // otherwise ignore byte, since it overruns memory + addr++; + a20addr = A20ADDR(addr); +#ifdef BX_LITTLE_ENDIAN + data_ptr++; +#else // BX_BIG_ENDIAN + data_ptr--; +#endif + } + return; + } + +#endif + #if BX_SUPPORT_APIC bx_generic_apic_c *local_apic = &cpu->local_apic;