From a75c620dde287e0c599b6265940c2f518aac0e8b Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 11 Jun 2023 14:53:22 +0100 Subject: [PATCH] kexts: fbcon: support scrolling multiple lines under vgacon --- kexts/drivers/tty/fbcon/vgacon.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kexts/drivers/tty/fbcon/vgacon.c b/kexts/drivers/tty/fbcon/vgacon.c index 0c75cd0..083296d 100644 --- a/kexts/drivers/tty/fbcon/vgacon.c +++ b/kexts/drivers/tty/fbcon/vgacon.c @@ -167,10 +167,19 @@ static void vgacon_move_cursor(struct device *dev, int x, int y) static void vgacon_scroll(struct device *dev, enum tty_scroll_dir dir, int lines) { + uint16_t *src = g_console_fb + (k_console_width * lines); + uint16_t *dst = g_console_fb; + size_t n = k_console_width * (k_console_height - lines) * 2; + memmove(dst, src, n); + + dst = g_console_fb + ((k_console_height - lines) * k_console_width); + + for (int i = 0; i < k_console_width * lines; i++) { + dst[i] = VGA_CHAR(0, DEFAULT_ATTRIB); + } } - static struct tty_driver_ops vgacon_ops = { .tty_init = vgacon_init, .tty_deinit = vgacon_deinit,