]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2009-06-29 Robert Millan <rmh.grub@aybabtu.com>
authorrobertmh <robertmh@localhost>
Mon, 29 Jun 2009 17:19:35 +0000 (17:19 +0000)
committerrobertmh <robertmh@localhost>
Mon, 29 Jun 2009 17:19:35 +0000 (17:19 +0000)
        * include/grub/i386/linux.h (GRUB_VIDEO_TYPE_TEXT): New macro.

        * loader/i386/linux.c [__i386__] (grub_linux_boot): Simplify inline
        assembly in final jump, using register constraints.

        (grub_linux_boot): For text mode, initialize `have_vga' using
        GRUB_VIDEO_TYPE_TEXT rather than 0 (this changes its value to 1).

        Initialize `video_cursor_x' and `video_cursor_y' as late as possible,
        right before the final jump.

        Set `video_mode' to 0x3.

        Document initialization of `video_page', `video_mode' and
        `video_ega_bx'.

ChangeLog
include/grub/i386/linux.h
loader/i386/linux.c

index ab44fb5d93818a4a450530df5b0addaf2d33948d..844f603b0c81263f42b565d6049a4e6e422a274b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,21 @@
 2009-06-29  Robert Millan  <rmh.grub@aybabtu.com>
 
+       * include/grub/i386/linux.h (GRUB_VIDEO_TYPE_TEXT): New macro.
+
        * loader/i386/linux.c [__i386__] (grub_linux_boot): Simplify inline
        assembly in final jump, using register constraints.
 
+       (grub_linux_boot): For text mode, initialize `have_vga' using
+       GRUB_VIDEO_TYPE_TEXT rather than 0 (this changes its value to 1).
+
+       Initialize `video_cursor_x' and `video_cursor_y' as late as possible,
+       right before the final jump.
+
+       Set `video_mode' to 0x3.
+
+       Document initialization of `video_page', `video_mode' and
+       `video_ega_bx'.
+
 2009-06-29  Robert Millan  <rmh.grub@aybabtu.com>
 
        * include/grub/i386/linux.h (GRUB_LINUX_FLAG_QUIET): New macro.
index dc6c02e1b21a3e18d81ee8c60108fd2950760cd6..641c09016b96036a0a98a335713cc39172a4a182 100644 (file)
@@ -79,6 +79,7 @@ struct grub_e820_mmap
   grub_uint32_t type;
 } __attribute__((packed));
 
+#define GRUB_VIDEO_TYPE_TEXT   0x01
 #define GRUB_VIDEO_TYPE_VLFB   0x23    /* VESA VGA in graphic mode     */
 #define GRUB_VIDEO_TYPE_EFI    0x70
 
index da2e34c4f59c16037462595f07600b0be3deca0f..78fa848229cd332eb07b06beb73bedaa67772677 100644 (file)
@@ -479,9 +479,7 @@ grub_linux_boot (void)
     params->have_vga = GRUB_VIDEO_TYPE_VLFB;
   else
     {
-      params->have_vga = 0;
-      params->video_cursor_x = grub_getxy () >> 8;
-      params->video_cursor_y = grub_getxy () & 0xff;
+      params->have_vga = GRUB_VIDEO_TYPE_TEXT;
       params->video_width = 80;
       params->video_height = 25;
     }
@@ -536,6 +534,13 @@ grub_linux_boot (void)
   grub_mmap_iterate (hook);
   params->mmap_size = e820_num;
 
+  /* Initialize these last, because terminal position could be affected by printfs above.  */
+  if (params->have_vga == GRUB_VIDEO_TYPE_TEXT)
+    {
+      params->video_cursor_x = grub_getxy () >> 8;
+      params->video_cursor_y = grub_getxy () & 0xff;
+    }
+
 #ifdef __x86_64__
 
   grub_memcpy ((char *) prot_mode_mem + (prot_mode_pages << 12),
@@ -664,8 +669,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 
   params->type_of_loader = (LINUX_LOADER_ID_GRUB << 4);
 
+  /* These two are used (instead of cmd_line_ptr) by older versions of Linux,
+     and otherwise ignored.  */
   params->cl_magic = GRUB_LINUX_CL_MAGIC;
   params->cl_offset = 0x1000;
+
   params->cmd_line_ptr = (unsigned long) real_mode_mem + 0x1000;
   params->ramdisk_image = 0;
   params->ramdisk_size = 0;
@@ -679,9 +687,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   params->ext_mem = ((32 * 0x100000) >> 10);
   params->alt_mem = ((32 * 0x100000) >> 10);
 
-  params->video_page = 0; /* ??? */
-  params->video_mode = 0;
+  /* Ignored by Linux.  */
+  params->video_page = 0;
+
+  /* Must be non-zero even in text mode, or Linux will think there's no VGA.  */
+  params->video_mode = 0x3;
+
+  /* Only used when `video_mode == 0x7', otherwise ignored.  */
   params->video_ega_bx = 0;
+
   params->font_size = 16; /* XXX */
 
   /* The other parameters are filled when booting.  */