33a34,35
> #include <sys/boot_console.h>
> #include "boot_console_impl.h"
53c55
< #define VGA_SCREEN ((unsigned short *)video_fb)
---
> #define VGA_SCREEN (video_fb)
61a64
> static int cons_color = CONS_COLOR;
64c67,70
< static void vga_cursor_display(void);
---
> static void vga_drawc(int);
> static void vga_setpos(int, int);
> static void vga_getpos(int *, int *);
> static void vga_scroll(int);
65a72,75
> static void vga_shiftline(int);
> static void vga_eraseline(void);
> static void vga_cursor_display(boolean_t);
>
70a81,95
> static int
> get_vga_color(void)
> {
> int color;
> uint32_t fg, bg;
> uint8_t solaris_color_to_pc_color[16] = {
> 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
> };
>
> boot_get_color(&fg, &bg);
> color = solaris_color_to_pc_color[bg] << 4;
> color |= solaris_color_to_pc_color[fg];
> return (color);
> }
>
72c97
< boot_vga_init(int cons_color)
---
> boot_vga_init(bcons_dev_t *bcons_dev)
75a101
> cons_color = get_vga_color();
85c111
< vga_cursor_display();
---
> vga_cursor_display(B_TRUE);
99a126,131
>
> bcons_dev->bd_putchar = vga_drawc;
> bcons_dev->bd_eraseline = vga_eraseline;
> bcons_dev->bd_cursor = vga_cursor_display;
> bcons_dev->bd_setpos = vga_setpos;
> bcons_dev->bd_shift = vga_shiftline;
115c147
< vga_cursor_display(void)
---
> vga_cursor_display(boolean_t visible)
118a151,153
> if (fb_info.cursor.visible == visible)
> return;
>
134a170,173
>
> if (visible == B_FALSE)
> val |= (1 << 5);
>
148d186
<
150c188
< vga_clear(int color)
---
> vga_eraseline_impl(int x, int y, int color)
152c190
< unsigned short val;
---
> unsigned short val, *buf;
154a193
> buf = VGA_SCREEN + x + y * VGA_TEXT_COLS;
155a195,197
> for (i = x; i < VGA_TEXT_COLS; i++)
> buf[i] = val;
> }
157,158c199,232
< for (i = 0; i < VGA_TEXT_ROWS * VGA_TEXT_COLS; i++) {
< VGA_SCREEN[i] = val;
---
> static void
> vga_eraseline(void)
> {
> int x, y;
>
> x = fb_info.cursor.pos.x;
> y = fb_info.cursor.pos.y;
> vga_eraseline_impl(x, y, cons_color);
> }
>
> static void
> vga_shiftline(int chars)
> {
> unsigned short *src, *dst;
> int x, y, len;
>
> x = fb_info.cursor.pos.x;
> y = fb_info.cursor.pos.y;
> len = VGA_TEXT_COLS - x - chars;
> if (len <= 0)
> return;
>
> src = VGA_SCREEN + x + y * VGA_TEXT_COLS;
> dst = src + chars;
> if (dst <= src) {
> do {
> *dst++ = *src++;
> } while (--len != 0);
> } else {
> dst += len;
> src += len;
> do {
> *--dst = *--src;
> } while (--len != 0);
162,163c236,237
< void
< vga_drawc(int c, int color)
---
> static void
> vga_clear(int color)
164a239,247
> int i;
>
> for (i = 0; i < VGA_TEXT_ROWS; i++)
> vga_eraseline_impl(0, i, color);
> }
>
> static void
> vga_drawc(int c)
> {
169c252,274
< VGA_SCREEN[row*VGA_TEXT_COLS + col] = (color << 8) | c;
---
>
> if (c == '\n') {
> if (row < fb_info.terminal.y - 1)
> vga_setpos(row + 1, col);
> else
> vga_scroll(cons_color);
> return;
> }
>
> /*
> * VGA_SCREEN is an array of 16-bit unsigned ints, we do let
> * the compiler to take care of truncation here.
> */
> VGA_SCREEN[row * VGA_TEXT_COLS + col] = (cons_color << 8) | c;
>
> if (col < VGA_TEXT_COLS - 1)
> vga_setpos(row, col + 1);
> else if (row < VGA_TEXT_ROWS - 1)
> vga_setpos(row + 1, 0);
> else {
> vga_setpos(row, 0);
> vga_scroll(cons_color);
> }
172c277
< void
---
> static void
175d279
< unsigned short val;
178,180c282
< val = (color << 8) | ' ';
<
< for (i = 0; i < (VGA_TEXT_ROWS-1)*VGA_TEXT_COLS; i++) {
---
> for (i = 0; i < (VGA_TEXT_ROWS - 1) * VGA_TEXT_COLS; i++) {
183,185c285
< for (; i < VGA_TEXT_ROWS * VGA_TEXT_COLS; i++) {
< VGA_SCREEN[i] = val;
< }
---
> vga_eraseline_impl(0, VGA_TEXT_ROWS - 1, color);
188c288
< void
---
> static void
192a293,301
> if (row < 0)
> row = 0;
> if (row >= fb_info.terminal.y)
> row = fb_info.terminal.y - 1;
> if (col < 0)
> col = 0;
> if (col >= fb_info.terminal.x)
> col = fb_info.terminal.x - 1;
>
201c310
< void
---
> static void