[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH 1/2] plat/kvm: Implement scrolling for VGA text mode
Looks good! Thanks! Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> On 29.07.2018 12:39, Florian Schmidt wrote: So far, when the text output overflowed the bottom of the console, it was completely cleared, and output started from the top again. This implement a scrolling functionality when we hit the bottom of the console. Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx> --- plat/kvm/x86/vga_console.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/plat/kvm/x86/vga_console.c b/plat/kvm/x86/vga_console.c index 4746dd7..a1b5cf7 100644 --- a/plat/kvm/x86/vga_console.c +++ b/plat/kvm/x86/vga_console.c @@ -28,6 +28,7 @@#include <sys/types.h>#include <stdint.h> +#include <string.h> #include <kvm-x86/vga_console.h>/* Hardware text mode color constants. */@@ -95,6 +96,26 @@ static void terminal_putentryat(char c, uint8_t color, size_t x, size_t y)terminal_buffer[index] = vga_entry(c, color);} +static void vga_scroll(void) +{ + size_t i; + + for (i = 1; i < VGA_HEIGHT; i++) { + memcpy(terminal_buffer + ((i - 1) * VGA_WIDTH), + terminal_buffer + (i * VGA_WIDTH), VGA_WIDTH * 2); + } + for (i = 0; i < VGA_WIDTH; i++) + terminal_buffer[((VGA_HEIGHT - 1) * VGA_WIDTH) + i] + = vga_entry(' ', terminal_color); +} + +static void vga_newline(void) +{ + if (terminal_row == VGA_HEIGHT - 1) + vga_scroll(); + else + terminal_row++; +}void _libkvmplat_vga_putc(char c){ @@ -114,8 +135,7 @@ void _libkvmplat_vga_putc(char c) break; case '\n': _libkvmplat_vga_putc('\r'); - if (++terminal_row == VGA_HEIGHT) - terminal_row = 0; + vga_newline(); break; case '\r': terminal_column = 0; @@ -128,8 +148,7 @@ void _libkvmplat_vga_putc(char c)if (terminal_column == VGA_WIDTH) {terminal_column = 0; - if (++terminal_row == VGA_HEIGHT) - terminal_row = 0; + vga_newline(); } break; default: @@ -137,8 +156,7 @@ void _libkvmplat_vga_putc(char c) terminal_column, terminal_row); if (++terminal_column == VGA_WIDTH) { terminal_column = 0; - if (++terminal_row == VGA_HEIGHT) - terminal_row = 0; + vga_newline(); } break; } _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |