svn commit: r212070 - head/sys/dev/fb

Jung-uk Kim jkim at FreeBSD.org
Tue Aug 31 20:21:53 UTC 2010


Author: jkim
Date: Tue Aug 31 20:21:52 2010
New Revision: 212070
URL: http://svn.freebsd.org/changeset/base/212070

Log:
  Make sure the interrupt entry point is within the video ROM range.  We must
  not change interrupt vector if it is not pointing the ROM itself.  Actually,
  we just fail shadowing altogether if that is the case because the shadowed
  copy will be useless for sure and POST may not be relocatable or useful.
  While I'm here, fix a debugging message under bootverbose, really.  r211829
  fixed one case but broke another.  Mea Culpa.

Modified:
  head/sys/dev/fb/vesa.c

Modified: head/sys/dev/fb/vesa.c
==============================================================================
--- head/sys/dev/fb/vesa.c	Tue Aug 31 19:59:18 2010	(r212069)
+++ head/sys/dev/fb/vesa.c	Tue Aug 31 20:21:52 2010	(r212070)
@@ -799,19 +799,25 @@ vesa_bios_init(void)
 	/*
 	 * Shadow video ROM.
 	 */
-	offs = BIOS_SADDRTOLADDR(vesa_bios_int10);
+	offs = vesa_bios_int10;
 	if (vesa_shadow_rom) {
 		vbios = x86bios_get_orm(vesa_bios_offs);
 		if (vbios != NULL) {
 			vesa_bios_size = vbios[2] * 512;
-			vesa_bios = x86bios_alloc(&vesa_bios_offs,
-			    vesa_bios_size, M_WAITOK);
-			memcpy(vesa_bios, vbios, vesa_bios_size);
-			offs = offs - VESA_BIOS_OFFSET + vesa_bios_offs;
-			offs = (X86BIOS_PHYSTOSEG(offs) << 16) +
-			    X86BIOS_PHYSTOOFF(offs);
-			x86bios_set_intr(0x10, offs);
-		} else
+			offs = BIOS_SADDRTOLADDR(vesa_bios_int10);
+			if (offs > vesa_bios_offs &&
+			    offs < vesa_bios_offs + vesa_bios_size) {
+				vesa_bios = x86bios_alloc(&vesa_bios_offs,
+				    vesa_bios_size, M_WAITOK);
+				memcpy(vesa_bios, vbios, vesa_bios_size);
+				offs = offs - VESA_BIOS_OFFSET + vesa_bios_offs;
+				offs = (X86BIOS_PHYSTOSEG(offs) << 16) +
+				    X86BIOS_PHYSTOOFF(offs);
+				x86bios_set_intr(0x10, offs);
+			} else
+				offs = vesa_bios_int10;
+		}
+		if (vesa_bios == NULL)
 			printf("VESA: failed to shadow video ROM\n");
 	}
 	if (bootverbose)


More information about the svn-src-all mailing list