Make sure the VESA mode number is between 256 and 511 inclusive.

This commit is contained in:
Jung-uk Kim 2012-02-16 22:46:00 +00:00
parent 60474b7b97
commit 2f18ee9d47
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=231842

View file

@ -1311,7 +1311,9 @@ vesa_set_mode(video_adapter_t *adp, int mode)
if (!(info.vi_flags & V_INFO_GRAPHICS))
info.vi_flags &= ~V_INFO_LINEAR;
if (vesa_bios_set_mode(mode | ((info.vi_flags & V_INFO_LINEAR) ? 0x4000 : 0)))
if ((info.vi_flags & V_INFO_LINEAR) != 0)
mode |= 0x4000;
if (vesa_bios_set_mode(mode))
return (1);
/* Palette format is reset by the above VBE function call. */
@ -1329,7 +1331,7 @@ vesa_set_mode(video_adapter_t *adp, int mode)
#if VESA_DEBUG > 0
printf("VESA: mode set!\n");
#endif
vesa_adp->va_mode = mode;
vesa_adp->va_mode = mode & 0x1ff; /* Mode number is 9-bit. */
vesa_adp->va_flags &= ~V_ADP_COLOR;
vesa_adp->va_flags |=
(info.vi_flags & V_INFO_COLOR) ? V_ADP_COLOR : 0;