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.
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;
}
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),
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;
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. */