diff -x '*.mk' -ur grub2/conf/i386-pc.rmk grub2.vga/conf/i386-pc.rmk --- grub2/conf/i386-pc.rmk 2007-10-01 17:50:34.000000000 +0200 +++ grub2.vga/conf/i386-pc.rmk 2007-10-20 00:24:50.000000000 +0200 @@ -129,7 +129,7 @@ # Modules. pkgdata_MODULES = _chain.mod _linux.mod linux.mod normal.mod \ _multiboot.mod chain.mod multiboot.mod reboot.mod halt.mod \ - vbe.mod vbetest.mod vbeinfo.mod video.mod gfxterm.mod \ + vga.mod vbe.mod vbetest.mod vbeinfo.mod video.mod gfxterm.mod \ videotest.mod play.mod bitmap.mod tga.mod cpuid.mod serial.mod # For _chain.mod. @@ -191,6 +191,11 @@ multiboot_mod_CFLAGS = $(COMMON_CFLAGS) multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For vga.mod. +vga_mod_SOURCES = term/i386/pc/vga.c +vga_mod_CFLAGS = $(COMMON_CFLAGS) +vga_mod_LDFLAGS = $(COMMON_LDFLAGS) + # For vbe.mod. vbe_mod_SOURCES = video/i386/pc/vbe.c video/i386/pc/vbeblit.c \ video/i386/pc/vbefill.c video/i386/pc/vbeutil.c diff -x '*.mk' -ur grub2/term/i386/pc/vga.c grub2.vga/term/i386/pc/vga.c --- grub2/term/i386/pc/vga.c 2007-10-03 22:11:57.000000000 +0200 +++ grub2.vga/term/i386/pc/vga.c 2007-10-20 00:32:44.000000000 +0200 @@ -25,6 +25,7 @@ #include #include #include +#include #define DEBUG_VGA 0 @@ -175,7 +176,7 @@ } static int -get_vga_glyph (grub_uint32_t code, unsigned char bitmap[32], unsigned *width) +get_vga_glyph (grub_uint32_t code, int fill_bitmap, grub_font_glyph_t glyph) { if (code > 0x7f) { @@ -214,14 +215,14 @@ break; default: - return grub_font_get_glyph (code, bitmap, width); + return grub_font_get_glyph (code, glyph); } } - if (bitmap) - grub_memcpy (bitmap, vga_font + code * CHAR_HEIGHT, CHAR_HEIGHT); + if (fill_bitmap) + grub_memcpy (glyph->bitmap, vga_font + code * CHAR_HEIGHT, CHAR_HEIGHT); - *width = 1; + glyph->width = 1; return 1; } @@ -257,8 +258,7 @@ write_char (void) { struct colored_char *p = text_buf + xpos + ypos * TEXT_WIDTH; - unsigned char bitmap[32]; - unsigned width; + grub_font_glyph_t glyph; unsigned char *mem_base; unsigned plane; @@ -266,7 +266,7 @@ ypos * CHAR_HEIGHT * TEXT_WIDTH + PAGE_OFFSET (page)) - p->index; p -= p->index; - if (! get_vga_glyph (p->code, bitmap, &width)) + if (! get_vga_glyph (p->code, 1, glyph)) invalidate_char (p); for (plane = 0x01; plane <= 0x08; plane <<= 1) @@ -283,12 +283,12 @@ { unsigned i; - for (i = 0; i < width && offset < 32; i++) + for (i = 0; i < glyph->width && offset < 32; i++) { unsigned char fg_mask, bg_mask; - fg_mask = (p->fg_color & plane) ? bitmap[offset] : 0; - bg_mask = (p->bg_color & plane) ? ~(bitmap[offset]) : 0; + fg_mask = (p->fg_color & plane) ? glyph->bitmap[offset] : 0; + bg_mask = (p->bg_color & plane) ? ~(glyph->bitmap[offset]) : 0; offset++; if (check_vga_mem (mem + i)) @@ -393,36 +393,36 @@ } else { - unsigned width; + grub_font_glyph_t glyph; struct colored_char *p; - get_vga_glyph (c, 0, &width); + get_vga_glyph (c, 0, glyph); - if (xpos + width > TEXT_WIDTH) + if (xpos + glyph->width > TEXT_WIDTH) grub_putchar ('\n'); p = text_buf + xpos + ypos * TEXT_WIDTH; p->code = c; p->fg_color = fg_color; p->bg_color = bg_color; - p->width = width - 1; + p->width = glyph->width - 1; p->index = 0; - if (width > 1) + if (glyph->width > 1) { unsigned i; - for (i = 1; i < width; i++) + for (i = 1; i < glyph->width; i++) { p[i].code = ' '; - p[i].width = width - 1; + p[i].width = glyph->width - 1; p[i].index = i; } } write_char (); - xpos += width; + xpos += glyph->width; if (xpos >= TEXT_WIDTH) { xpos = 0; @@ -454,12 +454,12 @@ static grub_ssize_t grub_vga_getcharwidth (grub_uint32_t c) { - unsigned width; + grub_font_glyph_t glyph; - if (! get_vga_glyph (c, 0, &width)) + if (! get_vga_glyph (c, 0, glyph)) return 0; - return width; + return glyph->width; } static grub_uint16_t