From f6ff063a6efa260d0e0ec2bd2de18616483910a2 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Mon, 13 Sep 2010 19:58:46 +0000 Subject: [PATCH] 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 --- sys/dev/fb/vesa.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/dev/fb/vesa.c b/sys/dev/fb/vesa.c index 4cb3fb5895e..0c05699ff97 100644 --- a/sys/dev/fb/vesa.c +++ b/sys/dev/fb/vesa.c @@ -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");