~hamo/ubuntu/precise/grub2/grub2.hi_res

« back to all changes in this revision

Viewing changes to term/i386/pc/vesafb.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson, Colin Watson, Robert Millan, Updated translations
  • Date: 2010-11-22 12:24:56 UTC
  • mfrom: (1.26.4 upstream) (17.3.36 sid)
  • mto: (17.3.43 sid)
  • mto: This revision was merged to the branch mainline in revision 89.
  • Revision ID: james.westby@ubuntu.com-20101122122456-y82z3sfb7k4zfdcc
Tags: 1.99~20101122-1
[ Colin Watson ]
* New Bazaar snapshot.  Too many changes to list in full, but some of the
  more user-visible ones are as follows:
  - GRUB script:
    + Function parameters, "break", "continue", "shift", "setparams",
      "return", and "!".
    + "export" command supports multiple variable names.
    + Multi-line quoted strings support.
    + Wildcard expansion.
  - sendkey support.
  - USB hotunplugging and USB serial support.
  - Rename CD-ROM to cd on BIOS.
  - Add new --boot-directory option to grub-install, grub-reboot, and
    grub-set-default; the old --root-directory option is still accepted
    but was often confusing.
  - Basic btrfs detection/UUID support (but no file reading yet).
  - bash-completion for utilities.
  - If a device is listed in device.map, always assume that it is
    BIOS-visible rather than using extra layers such as LVM or RAID.
  - Add grub-mknetdir script (closes: #550658).
  - Remove deprecated "root" command.
  - Handle RAID devices containing virtio components.
  - GRUB Legacy configuration file support (via grub-menulst2cfg).
  - Keyboard layout support (via grub-mklayout and grub-kbdcomp).
  - Check generated grub.cfg for syntax errors before saving.
  - Pause execution for at most ten seconds if any errors are displayed,
    so that the user has a chance to see them.
  - Support submenus.
  - Write embedding zone using Reed-Solomon, so that it's robust against
    being partially overwritten (closes: #550702, #591416, #593347).
  - GRUB_DISABLE_LINUX_RECOVERY and GRUB_DISABLE_NETBSD_RECOVERY merged
    into a single GRUB_DISABLE_RECOVERY variable.
  - Fix loader memory allocation failure (closes: #551627).
  - Don't call savedefault on recovery entries (closes: #589325).
  - Support triple-indirect blocks on ext2 (closes: #543924).
  - Recognise DDF1 fake RAID (closes: #603354).

[ Robert Millan ]
* Use dpkg architecture wildcards.

[ Updated translations ]
* Slovenian (Vanja Cvelbar).  Closes: #604003
* Dzongkha (dawa pemo via Tenzin Dendup).  Closes: #604102

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  GRUB  --  GRand Unified Bootloader
3
 
 *  Copyright (C) 2005,2007,2009  Free Software Foundation, Inc.
4
 
 *
5
 
 *  GRUB is free software: you can redistribute it and/or modify
6
 
 *  it under the terms of the GNU General Public License as published by
7
 
 *  the Free Software Foundation, either version 3 of the License, or
8
 
 *  (at your option) any later version.
9
 
 *
10
 
 *  GRUB is distributed in the hope that it will be useful,
11
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 *  GNU General Public License for more details.
14
 
 *
15
 
 *  You should have received a copy of the GNU General Public License
16
 
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
17
 
 */
18
 
 
19
 
// TODO: Deprecated and broken. Scheduled for removal as there is VBE driver in Video subsystem.
20
 
 
21
 
#include <grub/machine/memory.h>
22
 
#include <grub/machine/vga.h>
23
 
#include <grub/machine/vbe.h>
24
 
#include <grub/machine/console.h>
25
 
#include <grub/term.h>
26
 
#include <grub/types.h>
27
 
#include <grub/dl.h>
28
 
#include <grub/misc.h>
29
 
#include <grub/normal.h>
30
 
#include <grub/font.h>
31
 
#include <grub/mm.h>
32
 
#include <grub/env.h>
33
 
 
34
 
#define DEFAULT_CHAR_WIDTH  8
35
 
#define DEFAULT_CHAR_HEIGHT 16
36
 
 
37
 
#define DEFAULT_FG_COLOR    0xa
38
 
#define DEFAULT_BG_COLOR    0x0
39
 
 
40
 
struct grub_colored_char
41
 
{
42
 
  /* An Unicode codepoint.  */
43
 
  grub_uint32_t code;
44
 
 
45
 
  /* Color indexes.  */
46
 
  unsigned char fg_color;
47
 
  unsigned char bg_color;
48
 
 
49
 
  /* The width of this character minus one.  */
50
 
  unsigned char width;
51
 
 
52
 
  /* The column index of this character.  */
53
 
  unsigned char index;
54
 
};
55
 
 
56
 
struct grub_virtual_screen
57
 
{
58
 
  /* Dimensions of the virtual screen.  */
59
 
  grub_uint32_t width;
60
 
  grub_uint32_t height;
61
 
 
62
 
  /* Offset in the display.  */
63
 
  grub_uint32_t offset_x;
64
 
  grub_uint32_t offset_y;
65
 
 
66
 
  /* TTY Character sizes.  */
67
 
  grub_uint32_t char_width;
68
 
  grub_uint32_t char_height;
69
 
 
70
 
  /* Virtual screen TTY size.  */
71
 
  grub_uint32_t columns;
72
 
  grub_uint32_t rows;
73
 
 
74
 
  /* Current cursor details.  */
75
 
  grub_uint32_t cursor_x;
76
 
  grub_uint32_t cursor_y;
77
 
  grub_uint8_t cursor_state;
78
 
  grub_uint8_t fg_color;
79
 
  grub_uint8_t bg_color;
80
 
 
81
 
  /* Text buffer for virtual screen. Contains (columns * rows) number
82
 
     of entries.  */
83
 
  struct grub_colored_char *text_buffer;
84
 
};
85
 
 
86
 
/* Make sure text buffer is not marked as allocated.  */
87
 
static struct grub_virtual_screen virtual_screen =
88
 
  {
89
 
    .text_buffer = 0
90
 
  };
91
 
 
92
 
static unsigned char *vga_font = 0;
93
 
static grub_uint32_t old_mode = 0;
94
 
 
95
 
static struct grub_vbe_mode_info_block mode_info;
96
 
static grub_uint8_t *framebuffer = 0;
97
 
static grub_uint32_t bytes_per_scan_line = 0;
98
 
 
99
 
static void
100
 
grub_virtual_screen_free (void)
101
 
{
102
 
  /* If virtual screen has been allocated, free it.  */
103
 
  if (virtual_screen.text_buffer != 0)
104
 
    grub_free (virtual_screen.text_buffer);
105
 
 
106
 
  /* Reset virtual screen data.  */
107
 
  grub_memset (&virtual_screen, 0, sizeof (virtual_screen));
108
 
}
109
 
 
110
 
static grub_err_t
111
 
grub_virtual_screen_setup (grub_uint32_t width,
112
 
                           grub_uint32_t height)
113
 
{
114
 
  /* Free old virtual screen.  */
115
 
  grub_virtual_screen_free ();
116
 
 
117
 
  /* Initialize with default data.  */
118
 
  virtual_screen.width = width;
119
 
  virtual_screen.height = height;
120
 
  virtual_screen.offset_x = 0;
121
 
  virtual_screen.offset_y = 0;
122
 
  virtual_screen.char_width = DEFAULT_CHAR_WIDTH;
123
 
  virtual_screen.char_height = DEFAULT_CHAR_HEIGHT;
124
 
  virtual_screen.cursor_x = 0;
125
 
  virtual_screen.cursor_y = 0;
126
 
  virtual_screen.cursor_state = 1;
127
 
  virtual_screen.fg_color = DEFAULT_FG_COLOR;
128
 
  virtual_screen.bg_color = DEFAULT_BG_COLOR;
129
 
 
130
 
  /* Calculate size of text buffer.  */
131
 
  virtual_screen.columns = virtual_screen.width / virtual_screen.char_width;
132
 
  virtual_screen.rows = virtual_screen.height / virtual_screen.char_height;
133
 
 
134
 
  /* Allocate memory for text buffer.  */
135
 
  virtual_screen.text_buffer =
136
 
    (struct grub_colored_char *) grub_malloc (virtual_screen.columns
137
 
                                              * virtual_screen.rows
138
 
                                              * sizeof (*virtual_screen.text_buffer));
139
 
 
140
 
  return grub_errno;
141
 
}
142
 
 
143
 
static grub_err_t
144
 
grub_vesafb_mod_init (void)
145
 
{
146
 
  grub_uint32_t use_mode = GRUB_VBE_DEFAULT_VIDEO_MODE;
147
 
  struct grub_vbe_info_block controller_info;
148
 
  char *modevar;
149
 
 
150
 
  /* Use fonts from VGA bios.  */
151
 
  vga_font = grub_vga_get_font ();
152
 
 
153
 
  /* Check if we have VESA BIOS installed.  */
154
 
  if (grub_vbe_probe (&controller_info) != GRUB_ERR_NONE)
155
 
    return grub_errno;
156
 
 
157
 
  /* Check existence of vbe_mode environment variable.  */
158
 
  modevar = grub_env_get ("vbe_mode");
159
 
 
160
 
  if (modevar != 0)
161
 
    {
162
 
      unsigned long value;
163
 
 
164
 
      value = grub_strtoul (modevar, 0, 0);
165
 
      if (grub_errno == GRUB_ERR_NONE)
166
 
        use_mode = value;
167
 
    }
168
 
 
169
 
  /* Store initial video mode.  */
170
 
  if (grub_vbe_get_video_mode (&old_mode) != GRUB_ERR_NONE)
171
 
    return grub_errno;
172
 
 
173
 
  /* Setup desired graphics mode.  */
174
 
  if (grub_vbe_set_video_mode (use_mode, &mode_info) != GRUB_ERR_NONE)
175
 
    return grub_errno;
176
 
 
177
 
  /* Determine framebuffer and bytes per scan line.  */
178
 
  framebuffer = (grub_uint8_t *) mode_info.phys_base_addr;
179
 
 
180
 
  if (controller_info.version >= 0x300)
181
 
    bytes_per_scan_line = mode_info.lin_bytes_per_scan_line;
182
 
  else
183
 
    bytes_per_scan_line = mode_info.bytes_per_scan_line;
184
 
 
185
 
  /* Create virtual screen.  */
186
 
  if (grub_virtual_screen_setup (mode_info.x_resolution,
187
 
                                 mode_info.y_resolution) != GRUB_ERR_NONE)
188
 
    {
189
 
      grub_vbe_set_video_mode (old_mode, 0);
190
 
      return grub_errno;
191
 
    }
192
 
 
193
 
  /* Make sure frame buffer is black.  */
194
 
  grub_memset (framebuffer,
195
 
               0,
196
 
               bytes_per_scan_line * mode_info.y_resolution);
197
 
 
198
 
  return GRUB_ERR_NONE;
199
 
}
200
 
 
201
 
static grub_err_t
202
 
grub_vesafb_mod_fini (void)
203
 
{
204
 
  grub_virtual_screen_free ();
205
 
 
206
 
  grub_vbe_set_video_mode (old_mode, 0);
207
 
 
208
 
  return GRUB_ERR_NONE;
209
 
}
210
 
 
211
 
static int
212
 
grub_virtual_screen_get_glyph (grub_uint32_t code,
213
 
                               unsigned char bitmap[32],
214
 
                               unsigned *width)
215
 
{
216
 
  if (code > 0x7f)
217
 
    {
218
 
      /* Map some unicode characters to the VGA font, if possible.  */
219
 
      switch (code)
220
 
        {
221
 
        case 0x2190:    /* left arrow */
222
 
          code = 0x1b;
223
 
          break;
224
 
        case 0x2191:    /* up arrow */
225
 
          code = 0x18;
226
 
          break;
227
 
        case 0x2192:    /* right arrow */
228
 
          code = 0x1a;
229
 
          break;
230
 
        case 0x2193:    /* down arrow */
231
 
          code = 0x19;
232
 
          break;
233
 
        case 0x2501:    /* horizontal line */
234
 
          code = 0xc4;
235
 
          break;
236
 
        case 0x2503:    /* vertical line */
237
 
          code = 0xb3;
238
 
          break;
239
 
        case 0x250F:    /* upper-left corner */
240
 
          code = 0xda;
241
 
          break;
242
 
        case 0x2513:    /* upper-right corner */
243
 
          code = 0xbf;
244
 
          break;
245
 
        case 0x2517:    /* lower-left corner */
246
 
          code = 0xc0;
247
 
          break;
248
 
        case 0x251B:    /* lower-right corner */
249
 
          code = 0xd9;
250
 
          break;
251
 
 
252
 
        default:
253
 
          return grub_font_get_glyph_any (code, bitmap, width);
254
 
        }
255
 
    }
256
 
 
257
 
  /* TODO This is wrong for the new font module.  Should it be fixed?  */
258
 
  if (bitmap)
259
 
    grub_memcpy (bitmap,
260
 
                 vga_font + code * virtual_screen.char_height,
261
 
                 virtual_screen.char_height);
262
 
  *width = 1;
263
 
  return 1;
264
 
}
265
 
 
266
 
static void
267
 
grub_virtual_screen_invalidate_char (struct grub_colored_char *p)
268
 
{
269
 
  p->code = 0xFFFF;
270
 
 
271
 
  if (p->width)
272
 
    {
273
 
      struct grub_colored_char *q;
274
 
 
275
 
      for (q = p + 1; q <= p + p->width; q++)
276
 
        {
277
 
          q->code = 0xFFFF;
278
 
          q->width = 0;
279
 
          q->index = 0;
280
 
        }
281
 
    }
282
 
 
283
 
  p->width = 0;
284
 
}
285
 
 
286
 
static void
287
 
write_char (void)
288
 
{
289
 
  struct grub_colored_char *p;
290
 
  unsigned char bitmap[32];
291
 
  unsigned width;
292
 
  unsigned y;
293
 
  unsigned offset;
294
 
 
295
 
  p = (virtual_screen.text_buffer
296
 
       + virtual_screen.cursor_x
297
 
       + (virtual_screen.cursor_y * virtual_screen.columns));
298
 
 
299
 
  p -= p->index;
300
 
 
301
 
  if (! grub_virtual_screen_get_glyph (p->code, bitmap, &width))
302
 
    {
303
 
      grub_virtual_screen_invalidate_char (p);
304
 
      width = 0;
305
 
    }
306
 
 
307
 
  for (y = 0, offset = 0;
308
 
       y < virtual_screen.char_height;
309
 
       y++, offset++)
310
 
    {
311
 
      unsigned i;
312
 
 
313
 
      for (i = 0;
314
 
           (i < width * virtual_screen.char_width) && (offset < 32);
315
 
           i++)
316
 
        {
317
 
          unsigned char color;
318
 
 
319
 
          if (bitmap[offset] & (1 << (8-i)))
320
 
            {
321
 
              color = p->fg_color;
322
 
            }
323
 
          else
324
 
            {
325
 
              color = p->bg_color;
326
 
            }
327
 
 
328
 
          grub_vbe_set_pixel_index(i + (virtual_screen.cursor_x
329
 
                                        * virtual_screen.char_width),
330
 
                                   y + (virtual_screen.cursor_y
331
 
                                        * virtual_screen.char_height),
332
 
                                   color);
333
 
        }
334
 
    }
335
 
}
336
 
 
337
 
static void
338
 
write_cursor (void)
339
 
{
340
 
  grub_uint32_t x;
341
 
  grub_uint32_t y;
342
 
 
343
 
  for (y = ((virtual_screen.cursor_y + 1) * virtual_screen.char_height) - 3;
344
 
       y < ((virtual_screen.cursor_y + 1) * virtual_screen.char_height) - 1;
345
 
       y++)
346
 
    {
347
 
      for (x = virtual_screen.cursor_x * virtual_screen.char_width;
348
 
           x < (virtual_screen.cursor_x + 1) * virtual_screen.char_width;
349
 
           x++)
350
 
        {
351
 
          grub_vbe_set_pixel_index(x, y, 10);
352
 
        }
353
 
    }
354
 
}
355
 
 
356
 
static void
357
 
scroll_up (void)
358
 
{
359
 
  grub_uint32_t i;
360
 
 
361
 
  /* Scroll text buffer with one line to up.  */
362
 
  grub_memmove (virtual_screen.text_buffer,
363
 
                virtual_screen.text_buffer + virtual_screen.columns,
364
 
                sizeof (*virtual_screen.text_buffer)
365
 
                * virtual_screen.columns
366
 
                * (virtual_screen.rows - 1));
367
 
 
368
 
  /* Clear last line in text buffer.  */
369
 
  for (i = virtual_screen.columns * (virtual_screen.rows - 1);
370
 
       i < virtual_screen.columns * virtual_screen.rows;
371
 
       i++)
372
 
    {
373
 
      virtual_screen.text_buffer[i].code = ' ';
374
 
      virtual_screen.text_buffer[i].fg_color = 0;
375
 
      virtual_screen.text_buffer[i].bg_color = 0;
376
 
      virtual_screen.text_buffer[i].width = 0;
377
 
      virtual_screen.text_buffer[i].index = 0;
378
 
    }
379
 
 
380
 
  /* Scroll framebuffer with one line to up.  */
381
 
  grub_memmove (framebuffer,
382
 
                framebuffer
383
 
                + bytes_per_scan_line * virtual_screen.char_height,
384
 
                bytes_per_scan_line
385
 
                * (mode_info.y_resolution - virtual_screen.char_height));
386
 
 
387
 
  /* Clear last line in framebuffer.  */
388
 
  grub_memset (framebuffer
389
 
               + (bytes_per_scan_line
390
 
                  * (mode_info.y_resolution - virtual_screen.char_height)),
391
 
               0,
392
 
               bytes_per_scan_line * virtual_screen.char_height);
393
 
}
394
 
 
395
 
static void
396
 
grub_vesafb_putchar (grub_uint32_t c)
397
 
{
398
 
  if (c == '\a')
399
 
    /* FIXME */
400
 
    return;
401
 
 
402
 
  if (c == '\b' || c == '\n' || c == '\r')
403
 
    {
404
 
      /* Erase current cursor, if any.  */
405
 
      if (virtual_screen.cursor_state)
406
 
        write_char ();
407
 
 
408
 
      switch (c)
409
 
        {
410
 
        case '\b':
411
 
          if (virtual_screen.cursor_x > 0)
412
 
            virtual_screen.cursor_x--;
413
 
          break;
414
 
 
415
 
        case '\n':
416
 
          if (virtual_screen.cursor_y >= virtual_screen.rows - 1)
417
 
            scroll_up ();
418
 
          else
419
 
            virtual_screen.cursor_y++;
420
 
          break;
421
 
 
422
 
        case '\r':
423
 
          virtual_screen.cursor_x = 0;
424
 
          break;
425
 
        }
426
 
 
427
 
      if (virtual_screen.cursor_state)
428
 
        write_cursor ();
429
 
    }
430
 
  else
431
 
    {
432
 
      unsigned width;
433
 
      struct grub_colored_char *p;
434
 
 
435
 
      grub_virtual_screen_get_glyph (c, 0, &width);
436
 
 
437
 
      if (virtual_screen.cursor_x + width > virtual_screen.columns)
438
 
        grub_putchar ('\n');
439
 
 
440
 
      p = (virtual_screen.text_buffer +
441
 
           virtual_screen.cursor_x +
442
 
           virtual_screen.cursor_y * virtual_screen.columns);
443
 
      p->code = c;
444
 
      p->fg_color = virtual_screen.fg_color;
445
 
      p->bg_color = virtual_screen.bg_color;
446
 
      p->width = width - 1;
447
 
      p->index = 0;
448
 
 
449
 
      if (width > 1)
450
 
        {
451
 
          unsigned i;
452
 
 
453
 
          for (i = 1; i < width; i++)
454
 
            {
455
 
              p[i].code = ' ';
456
 
              p[i].width = width - 1;
457
 
              p[i].index = i;
458
 
            }
459
 
        }
460
 
 
461
 
      write_char ();
462
 
 
463
 
      virtual_screen.cursor_x += width;
464
 
      if (virtual_screen.cursor_x >= virtual_screen.columns)
465
 
        {
466
 
          virtual_screen.cursor_x = 0;
467
 
 
468
 
          if (virtual_screen.cursor_y >= virtual_screen.rows - 1)
469
 
            scroll_up ();
470
 
          else
471
 
            virtual_screen.cursor_y++;
472
 
        }
473
 
 
474
 
      if (virtual_screen.cursor_state)
475
 
        write_cursor ();
476
 
    }
477
 
}
478
 
 
479
 
static grub_ssize_t
480
 
grub_vesafb_getcharwidth (grub_uint32_t c)
481
 
{
482
 
  unsigned width;
483
 
 
484
 
  if (! grub_virtual_screen_get_glyph (c, 0, &width))
485
 
    return 0;
486
 
 
487
 
  return width;
488
 
}
489
 
 
490
 
static grub_uint16_t
491
 
grub_virtual_screen_getwh (void)
492
 
{
493
 
  return (virtual_screen.columns << 8) | virtual_screen.rows;
494
 
}
495
 
 
496
 
static grub_uint16_t
497
 
grub_virtual_screen_getxy (void)
498
 
{
499
 
  return ((virtual_screen.cursor_x << 8) | virtual_screen.cursor_y);
500
 
}
501
 
 
502
 
static void
503
 
grub_vesafb_gotoxy (grub_uint8_t x, grub_uint8_t y)
504
 
{
505
 
  if (x >= virtual_screen.columns || y >= virtual_screen.rows)
506
 
    {
507
 
      grub_error (GRUB_ERR_OUT_OF_RANGE, "invalid point (%u,%u)",
508
 
                  (unsigned) x, (unsigned) y);
509
 
      return;
510
 
    }
511
 
 
512
 
  if (virtual_screen.cursor_state)
513
 
    write_char ();
514
 
 
515
 
  virtual_screen.cursor_x = x;
516
 
  virtual_screen.cursor_y = y;
517
 
 
518
 
  if (virtual_screen.cursor_state)
519
 
    write_cursor ();
520
 
}
521
 
 
522
 
static void
523
 
grub_virtual_screen_cls (void)
524
 
{
525
 
  grub_uint32_t i;
526
 
 
527
 
  for (i = 0; i < virtual_screen.columns * virtual_screen.rows; i++)
528
 
    {
529
 
      virtual_screen.text_buffer[i].code = ' ';
530
 
      virtual_screen.text_buffer[i].fg_color = 0;
531
 
      virtual_screen.text_buffer[i].bg_color = 0;
532
 
      virtual_screen.text_buffer[i].width = 0;
533
 
      virtual_screen.text_buffer[i].index = 0;
534
 
    }
535
 
 
536
 
  virtual_screen.cursor_x = virtual_screen.cursor_y = 0;
537
 
}
538
 
 
539
 
static void
540
 
grub_vesafb_cls (void)
541
 
{
542
 
  grub_virtual_screen_cls ();
543
 
 
544
 
  grub_memset (framebuffer,
545
 
               0,
546
 
               mode_info.y_resolution * bytes_per_scan_line);
547
 
}
548
 
 
549
 
static void
550
 
grub_virtual_screen_setcolorstate (grub_term_color_state state)
551
 
{
552
 
  switch (state)
553
 
    {
554
 
    case GRUB_TERM_COLOR_STANDARD:
555
 
    case GRUB_TERM_COLOR_NORMAL:
556
 
      virtual_screen.fg_color = DEFAULT_FG_COLOR;
557
 
      virtual_screen.bg_color = DEFAULT_BG_COLOR;
558
 
      break;
559
 
    case GRUB_TERM_COLOR_HIGHLIGHT:
560
 
      virtual_screen.fg_color = DEFAULT_BG_COLOR;
561
 
      virtual_screen.bg_color = DEFAULT_FG_COLOR;
562
 
      break;
563
 
    default:
564
 
      break;
565
 
    }
566
 
}
567
 
 
568
 
static void
569
 
grub_vesafb_setcursor (int on)
570
 
{
571
 
  if (virtual_screen.cursor_state != on)
572
 
    {
573
 
      if (virtual_screen.cursor_state)
574
 
        write_char ();
575
 
      else
576
 
        write_cursor ();
577
 
 
578
 
      virtual_screen.cursor_state = on;
579
 
    }
580
 
}
581
 
 
582
 
static struct grub_term_output grub_vesafb_term =
583
 
  {
584
 
    .name = "vesafb",
585
 
    .init = grub_vesafb_mod_init,
586
 
    .fini = grub_vesafb_mod_fini,
587
 
    .putchar = grub_vesafb_putchar,
588
 
    .getcharwidth = grub_vesafb_getcharwidth,
589
 
    .getwh = grub_virtual_screen_getwh,
590
 
    .getxy = grub_virtual_screen_getxy,
591
 
    .gotoxy = grub_vesafb_gotoxy,
592
 
    .cls = grub_vesafb_cls,
593
 
    .setcolorstate = grub_virtual_screen_setcolorstate,
594
 
    .setcursor = grub_vesafb_setcursor,
595
 
    .flags = 0,
596
 
  };
597
 
 
598
 
GRUB_MOD_INIT(vesafb)
599
 
{
600
 
  grub_term_register_output ("vesafb", &grub_vesafb_term);
601
 
}
602
 
 
603
 
GRUB_MOD_FINI(vesafb)
604
 
{
605
 
  grub_term_unregister_output (&grub_vesafb_term);
606
 
}