[SeaBIOS] [PATCH 2/2] vgabios: Limit the range of the VBE number of "pages" parameter.

Paul Menzel paulepanter at users.sourceforge.net
Sat Sep 14 09:11:02 CEST 2013


Am Freitag, den 13.09.2013, 16:24 -0400 schrieb Kevin O'Connor:
> Looking at the output of other VGA BIOS implementations, it appears
> that the number of available video pages reported is always between 1
> and 127.

That is including 1 and 127, right?

> Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
> ---
>  vgasrc/vbe.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c
> index d962333..2c08736 100644
> --- a/vgasrc/vbe.c
> +++ b/vgasrc/vbe.c
> @@ -144,6 +144,10 @@ vbe_104f01(struct bregs *regs)
>              mode_attr |= VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE;
>          break;
>      }
> +    if (pages > 128)
> +        pages = 128;

As 1 gets subtracted (below in diff), in this case 127 is included.

> +    if (pages < 2)
> +        pages++;

Can pages be 0? If yes, it would be 0 again after substracting 1. Should
it be `pages = 1` instead of `pages++`?

>      SET_FARVAR(seg, info->mode_attributes, mode_attr);
>      SET_FARVAR(seg, info->planes, planes);
>      SET_FARVAR(seg, info->pages, pages - 1);


Thanks,

Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.seabios.org/pipermail/seabios/attachments/20130914/1e1e6bc0/attachment.sig>


More information about the SeaBIOS mailing list