From: H. Peter Anvin Date: Thu, 14 Feb 2008 06:37:33 +0000 (-0800) Subject: VESA: Minor cleanups X-Git-Tag: syslinux-3.62-pre6^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=545ef8479f39a162be3d37ac1253bbaa394e9681;p=profile%2Fivi%2Fsyslinux.git VESA: Minor cleanups Minor cleanups for clarity --- diff --git a/com32/lib/sys/vesa/initvesa.c b/com32/lib/sys/vesa/initvesa.c index 98888d3..0ad882b 100644 --- a/com32/lib/sys/vesa/initvesa.c +++ b/com32/lib/sys/vesa/initvesa.c @@ -75,13 +75,14 @@ static int vesacon_paged_mode_ok(const struct vesa_mode_info *mi) { int i; + if (!is_power_of_2(mi->win_size) || + !is_power_of_2(mi->win_grain) || + mi->win_grain > mi->win_size) + return 0; /* Impossible... */ + for (i = 0; i < 2; i++) { - if ((mi->win_attr[i] & 0x05) == 0x05 && - mi->win_seg[i] && - is_power_of_2(mi->win_size) && - is_power_of_2(mi->win_grain) && - mi->win_grain <= mi->win_size) - return 1; /* We can deal with this... */ + if ((mi->win_attr[i] & 0x05) == 0x05 && mi->win_seg[i]) + return 1; /* Usable window */ } return 0; /* Nope... */ @@ -121,7 +122,8 @@ static int vesacon_set_mode(void) /* Copy general info */ memcpy(&__vesa_info.gi, gi, sizeof *gi); - /* Search for a 640x480 32-bit linear frame buffer mode */ + /* Search for a 640x480 mode with a suitable color and memory model... */ + mode_ptr = GET_PTR(gi->video_mode_ptr); bestmode = 0; bestpxf = PXF_NONE; diff --git a/com32/lib/sys/vesa/screencpy.c b/com32/lib/sys/vesa/screencpy.c index 779fe5d..4972eea 100644 --- a/com32/lib/sys/vesa/screencpy.c +++ b/com32/lib/sys/vesa/screencpy.c @@ -80,13 +80,14 @@ static void set_window_pos(size_t win_pos) { static com32sys_t ireg; + wi.win_pos = win_pos; + if (wi.win_num < 0) - return; + return; /* This should never happen... */ ireg.eax.w[0] = 0x4F05; ireg.ebx.b[0] = wi.win_num; ireg.edx.w[0] = win_pos >> wi.win_gshift; - wi.win_pos = win_pos; __intcall(0x10, &ireg, NULL); }