2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'. * conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'. (vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New variables. * conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace `term/i386/pc/console.c' with `term/i386/vga_common.c'. * kern/i386/coreboot/init.c (grub_machine_init): Replace call to grub_console_init() with call to grub_vga_text_init(). (grub_machine_fini): Replace call to grub_console_fini() with call to grub_vga_text_fini() and grub_at_keyboard_fini(). * include/grub/i386/pc/console.h: Include `<grub/term.h>'. (grub_console_putchar, grub_console_getcharwidth, grub_console_getwh) (grub_console_setcolorstate, grub_console_setcolor) (grub_console_getcolor): New function prototypes. * term/i386/pc/vga_text.c: Include `<grub/dl.h>'. (grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls) (grub_vga_text_setcursor): Static-ize. (grub_vga_text_term): New structure. (GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions. * term/i386/pc/console.c: Remove `<grub/machine/machine.h>'. (grub_console_cur_color, grub_console_standard_color) (grub_console_normal_color, grub_console_highlight_color) (map_char, grub_console_putchar, grub_console_getcharwidth) (grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor) (grub_console_getcolor): Move from here ... * term/i386/vga_common.c: ... to here (same function names).
This commit is contained in:
parent
95b841d37b
commit
76679cd3a4
13 changed files with 315 additions and 145 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2007, 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,6 +16,7 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/machine/console.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/types.h>
|
||||
|
@ -106,31 +107,31 @@ grub_console_real_putchar (int c)
|
|||
update_cursor ();
|
||||
}
|
||||
|
||||
grub_uint16_t
|
||||
grub_console_getxy (void)
|
||||
static grub_uint16_t
|
||||
grub_vga_text_getxy (void)
|
||||
{
|
||||
return (grub_curr_x << 8) | grub_curr_y;
|
||||
}
|
||||
|
||||
void
|
||||
grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
||||
static void
|
||||
grub_vga_text_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
||||
{
|
||||
grub_curr_x = x;
|
||||
grub_curr_y = y;
|
||||
update_cursor ();
|
||||
}
|
||||
|
||||
void
|
||||
grub_console_cls (void)
|
||||
static void
|
||||
grub_vga_text_cls (void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ROWS * COLS; i++)
|
||||
((short *) VGA_TEXT_SCREEN)[i] = ' ' | (grub_console_cur_color << 8);
|
||||
grub_console_gotoxy (0, 0);
|
||||
grub_vga_text_gotoxy (0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
grub_console_setcursor (int on)
|
||||
static void
|
||||
grub_vga_text_setcursor (int on)
|
||||
{
|
||||
grub_uint8_t old;
|
||||
grub_outb (CRTC_CURSOR, CRTC_ADDR_PORT);
|
||||
|
@ -140,3 +141,30 @@ grub_console_setcursor (int on)
|
|||
else
|
||||
grub_outb (old | CRTC_CURSOR_DISABLE, CRTC_DATA_PORT);
|
||||
}
|
||||
|
||||
static struct grub_term_output grub_vga_text_term =
|
||||
{
|
||||
.name = "vga_text",
|
||||
.init = grub_vga_text_cls,
|
||||
.fini = grub_vga_text_cls,
|
||||
.putchar = grub_console_putchar,
|
||||
.getcharwidth = grub_console_getcharwidth,
|
||||
.getwh = grub_console_getwh,
|
||||
.getxy = grub_vga_text_getxy,
|
||||
.gotoxy = grub_vga_text_gotoxy,
|
||||
.cls = grub_vga_text_cls,
|
||||
.setcolorstate = grub_console_setcolorstate,
|
||||
.setcolor = grub_console_setcolor,
|
||||
.getcolor = grub_console_getcolor,
|
||||
.setcursor = grub_vga_text_setcursor,
|
||||
};
|
||||
|
||||
GRUB_MOD_INIT(vga_text)
|
||||
{
|
||||
grub_term_register_output (&grub_vga_text_term);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(vga_text)
|
||||
{
|
||||
grub_term_unregister_output (&grub_vga_text_term);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue