Fix segment:offset calculation of interrupt vector for relocated video BIOS

when the original offset is bigger than size of one page.  X86BIOS macros
cannot be used here because it is assumed address is only linear in a page.

Tested by:	netchild
This commit is contained in:
Jung-uk Kim 2010-09-13 19:58:46 +00:00
parent d3a8a8b9fa
commit f6ff063a6e

View File

@ -804,18 +804,16 @@ vesa_bios_init(void)
vbios = x86bios_get_orm(vesa_bios_offs);
if (vbios != NULL) {
vesa_bios_size = vbios[2] * 512;
offs = BIOS_SADDRTOLADDR(vesa_bios_int10);
if (offs > vesa_bios_offs &&
offs < vesa_bios_offs + vesa_bios_size) {
if (((VESA_BIOS_OFFSET << 12) & 0xffff0000) ==
(vesa_bios_int10 & 0xffff0000) &&
vesa_bios_size > (vesa_bios_int10 & 0xffff)) {
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);
offs = ((vesa_bios_offs << 12) & 0xffff0000) +
(vesa_bios_int10 & 0xffff);
x86bios_set_intr(0x10, offs);
} else
offs = vesa_bios_int10;
}
}
if (vesa_bios == NULL)
printf("VESA: failed to shadow video ROM\n");