Index: kernel/genarch/src/drivers/ega/ega.c
===================================================================
--- kernel/genarch/src/drivers/ega/ega.c	(revision 9979acb60a5eb42e08938818e5cc4fd945626555)
+++ kernel/genarch/src/drivers/ega/ega.c	(revision 38c64e89f6832cf6f53cb412ca15e0f1a52eef4a)
@@ -80,10 +80,34 @@
 }
 
+static void ega_show_cursor(void)
+{
+	pio_write_8(ega_base + EGA_INDEX_REG, 0x0a);
+	uint8_t stat = pio_read_8(ega_base + EGA_DATA_REG);
+	pio_write_8(ega_base + EGA_INDEX_REG, 0x0a);
+	pio_write_8(ega_base + EGA_DATA_REG, stat & (~(1 << 5)));
+}
+
 static void ega_move_cursor(void)
 {
-	pio_write_8(ega_base + EGA_INDEX_REG, 0xe);
+	pio_write_8(ega_base + EGA_INDEX_REG, 0x0e);
 	pio_write_8(ega_base + EGA_DATA_REG, (uint8_t) ((ega_cursor >> 8) & 0xff));
-	pio_write_8(ega_base + EGA_INDEX_REG, 0xf);
+	pio_write_8(ega_base + EGA_INDEX_REG, 0x0f);
 	pio_write_8(ega_base + EGA_DATA_REG, (uint8_t) (ega_cursor & 0xff));
+}
+
+static void ega_sync_cursor(void)
+{
+	pio_write_8(ega_base + EGA_INDEX_REG, 0x0e);
+	uint8_t hi = pio_read_8(ega_base + EGA_DATA_REG);
+	pio_write_8(ega_base + EGA_INDEX_REG, 0x0f);
+	uint8_t lo = pio_read_8(ega_base + EGA_DATA_REG);
+	
+	ega_cursor = (hi << 8) | lo;
+	if ((ega_cursor % EGA_COLS) != 0)
+		ega_cursor = (ega_cursor + EGA_COLS) - ega_cursor % EGA_COLS;
+	
+	ega_check_cursor();
+	ega_move_cursor();
+	ega_show_cursor();
 }
 
@@ -143,8 +167,7 @@
 	videoram = (uint8_t *) hw_map(videoram_phys, EGA_VRAM_SIZE);
 	
-	/* Clear the screen and set the cursor position. */
-	memsetw(videoram, EGA_SCREEN, 0x0720);
-	memsetw(backbuf, EGA_SCREEN, 0x0720);
-	ega_move_cursor();
+	/* Synchronize the back buffer and cursor position. */
+	memcpy(backbuf, videoram, EGA_VRAM_SIZE);
+	ega_sync_cursor();
 	
 	chardev_initialize("ega_out", &ega_console, &ega_ops);
@@ -163,4 +186,5 @@
 	memcpy(videoram, backbuf, EGA_VRAM_SIZE);
 	ega_move_cursor();
+	ega_show_cursor();
 }
 
