commit-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[2375] 2009-06-29 Robert Millan <address@hidden>


From: Robert Millan
Subject: [2375] 2009-06-29 Robert Millan <address@hidden>
Date: Mon, 29 Jun 2009 17:19:35 +0000

Revision: 2375
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2375
Author:   robertmh
Date:     2009-06-29 17:19:35 +0000 (Mon, 29 Jun 2009)
Log Message:
-----------
2009-06-29  Robert Millan  <address@hidden>

        * 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'.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/include/grub/i386/linux.h
    trunk/grub2/loader/i386/linux.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog       2009-06-29 15:55:42 UTC (rev 2374)
+++ trunk/grub2/ChangeLog       2009-06-29 17:19:35 UTC (rev 2375)
@@ -1,8 +1,21 @@
 2009-06-29  Robert Millan  <address@hidden>
 
+       * 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  <address@hidden>
 
        * include/grub/i386/linux.h (GRUB_LINUX_FLAG_QUIET): New macro.

Modified: trunk/grub2/include/grub/i386/linux.h
===================================================================
--- trunk/grub2/include/grub/i386/linux.h       2009-06-29 15:55:42 UTC (rev 
2374)
+++ trunk/grub2/include/grub/i386/linux.h       2009-06-29 17:19:35 UTC (rev 
2375)
@@ -79,6 +79,7 @@
   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
 

Modified: trunk/grub2/loader/i386/linux.c
===================================================================
--- trunk/grub2/loader/i386/linux.c     2009-06-29 15:55:42 UTC (rev 2374)
+++ trunk/grub2/loader/i386/linux.c     2009-06-29 17:19:35 UTC (rev 2375)
@@ -479,9 +479,7 @@
     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_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 @@
 
   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 @@
   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.  */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]