Re: [patches] [PATCH] [21/22] x86_64: Extend bzImage protocol for relocatable bzImage

From: Eric W. Biederman
Date: Tue May 08 2007 - 21:45:51 EST


"H. Peter Anvin" <hpa@xxxxxxxxx> writes:

> yhlu wrote:
>> On 5/8/07, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
>>> Jeremy Fitzhardinge wrote:
>>> Specifically boot_params.screen_info isn't being properly set up by the
>>> caller.
>>
>> will setup real_mode_data in kexec path?
>
> -ENOPARSE

I believe YH is asking how we setup real_mode_data in /sbin/kexec.
The setup is:
> real_mode->orig_x = 0;
> real_mode->orig_y = 0;
> real_mode->orig_video_page = 0;
> real_mode->orig_video_mode = 0;
> real_mode->orig_video_cols = 80;
> real_mode->orig_video_lines = 25;
> real_mode->orig_video_ega_bx = 0;
> real_mode->orig_video_isVGA = 1;
> real_mode->orig_video_points = 16;

Silly but generally safe.

More relevant because the code is in kernel we have:

arch/arm/kernel/setup.c:
> struct screen_info screen_info = {
> .orig_video_lines = 30,
> .orig_video_cols = 80,
> .orig_video_mode = 0,
> .orig_video_ega_bx = 0,
> .orig_video_isVGA = 1,
> .orig_video_points = 8
> };


arch/alpha/kernel/sys_sio.c:
> /* The AlphaBook1 has LCD video fixed at 800x600,
> 37 rows and 100 cols. */
> screen_info.orig_y = 37;
> screen_info.orig_video_cols = 100;
> screen_info.orig_video_lines = 37;


I expect I can find a few more examples where we specify
video_cols and video_lines but we use video_mode == 0.

Going farther mode 0x00 is a BIOS 40x25 mode. So the patch below is
not always safe even if we boot the bzImage. It is just highly
unlikely anyone would start the kernel in 40x25 text mode.

Therefore I expect the test should test several additional
fields, in particular video lines and columns before we
decide that we have an uninitialized screen_info and give up.


> commit f82af20e1a028e16b9bb11da081fa1148d40fa6a
> Author: Gerd Hoffmann <kraxel@xxxxxxx>
> Date: Wed May 2 19:27:19 2007 +0200
>
> [PATCH] x86-64: ignore vgacon if hardware not present
>
> Avoid trying to set up vgacon if there's no vga hardware present.
>
> Signed-off-by: Jeremy Fitzhardinge <jeremy@xxxxxxxxxxxxx>
> Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
> Signed-off-by: Andi Kleen <ak@xxxxxxx>
> Cc: Alan <alan@xxxxxxxxxxxxxxxxxxx>
> Acked-by: Ingo Molnar <mingo@xxxxxxx>
>
> diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
> index 91a2078..3e67c34 100644
> --- a/drivers/video/console/vgacon.c
> +++ b/drivers/video/console/vgacon.c
> @@ -371,7 +371,8 @@ static const char *vgacon_startup(void)
> }
>
> /* VGA16 modes are not handled by VGACON */
> - if ((ORIG_VIDEO_MODE == 0x0D) || /* 320x200/4 */
> + if ((ORIG_VIDEO_MODE == 0x00) || /* SCREEN_INFO not initialized */
> + (ORIG_VIDEO_MODE == 0x0D) || /* 320x200/4 */
> (ORIG_VIDEO_MODE == 0x0E) || /* 640x200/4 */
> (ORIG_VIDEO_MODE == 0x10) || /* 640x350/4 */
> (ORIG_VIDEO_MODE == 0x12) || /* 640x480/4 */

Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/