Index: uspace/srv/fb/serial_console.c
===================================================================
--- uspace/srv/fb/serial_console.c	(revision f6377f722eaf2e019d585b85b3ffc5620c32f2bd)
+++ uspace/srv/fb/serial_console.c	(revision 16e9c4764ead1ecf4d92a47b804c782fe5d0b289)
@@ -47,4 +47,6 @@
 #include <console/style.h>
 
+#include "../console/screenbuffer.h"
+#include "main.h"
 #include "serial_console.h"
 
@@ -53,6 +55,6 @@
 static void serial_sgr(const unsigned int mode);
 
-static int width;
-static int height;
+static int scr_width;
+static int scr_height;
 static bool color = true;	/** True if producing color output. */
 static putc_function_t putc_function;
@@ -103,5 +105,5 @@
 void serial_goto(const unsigned int row, const unsigned int col)
 {
-	if ((row > height) || (col > width))
+	if ((row > scr_height) || (col > scr_width))
 		return;
 	
@@ -126,5 +128,5 @@
 {
 	if (i > 0) {
-		serial_goto(height - 1, 0);
+		serial_goto(scr_height - 1, 0);
 		while (i--)
 			serial_puts("\033D");
@@ -164,7 +166,82 @@
 void serial_console_init(putc_function_t putc_fn, uint32_t w, uint32_t h)
 {
-	width = w;
-	height = h;
+	scr_width = w;
+	scr_height = h;
 	putc_function = putc_fn;
+}
+
+static void serial_set_style(int style)
+{
+	if (style == STYLE_EMPHASIS) {
+		if (color) {
+			serial_sgr(SGR_RESET);
+			serial_sgr(SGR_FGCOLOR + CI_RED);
+			serial_sgr(SGR_BGCOLOR + CI_WHITE);
+		}
+		serial_sgr(SGR_BOLD);
+	} else {
+		if (color) {
+			serial_sgr(SGR_RESET);
+			serial_sgr(SGR_FGCOLOR + CI_BLACK);
+			serial_sgr(SGR_BGCOLOR + CI_WHITE);
+		}
+		serial_sgr(SGR_NORMAL_INT);
+	}
+}
+
+static void serial_set_idx(unsigned fgcolor, unsigned bgcolor,
+    unsigned flags)
+{
+	if (color) {
+		serial_sgr(SGR_RESET);
+		serial_sgr(SGR_FGCOLOR + color_map[fgcolor]);
+		serial_sgr(SGR_BGCOLOR + color_map[bgcolor]);
+	} else {
+		if (fgcolor < bgcolor)
+			serial_sgr(SGR_RESET);
+		else
+			serial_sgr(SGR_REVERSE);
+	}	
+}
+
+static void serial_set_rgb(uint32_t fgcolor, uint32_t bgcolor)
+{
+	if (fgcolor < bgcolor)
+		serial_sgr(SGR_REVERSE_OFF);
+	else
+		serial_sgr(SGR_REVERSE);	
+}
+
+static void serial_set_attrs(const attrs_t *a)
+{
+	switch (a->t) {
+	case at_style: serial_set_style(a->a.s.style); break;
+	case at_rgb: serial_set_rgb(a->a.r.fg_color, a->a.r.bg_color); break;
+	case at_idx: serial_set_idx(a->a.i.fg_color,
+	    a->a.i.bg_color, a->a.i.flags); break;
+	default: break;
+	}
+}
+
+static void draw_text_data(keyfield_t *data)
+{
+	int i, j;
+	attrs_t *a0, *a1;
+
+	serial_goto(0, 0);
+	a0 = &data[0].attrs;
+	serial_set_attrs(a0);
+
+	for (i = 0; i < scr_height; i++) {
+		for (j = 0; j < scr_width; j++) {
+			a1 = &data[i * scr_width + j].attrs;
+			if (!attrs_same(*a0, *a1))
+				serial_set_attrs(a1);
+			(*putc_function)(data[i * scr_width + j].character);
+			a0 = a1;
+/*		scr_addr[i * 2] = data[i].character;
+		scr_addr[i * 2 + 1] = attr_to_ega_style(&data[i].attrs);*/
+		}
+	}
 }
 
@@ -177,4 +254,7 @@
 	ipc_callid_t callid;
 	ipc_call_t call;
+	keyfield_t *interbuf = NULL;
+	size_t intersize = 0;
+
 	char c;
 	int lastcol = 0;
@@ -184,6 +264,8 @@
 	int fgcolor;
 	int bgcolor;
+	int flags;
 	int style;
 	int i;
+
 	
 	if (client_connected) {
@@ -199,5 +281,5 @@
 	serial_clrscr();
 	serial_goto(0, 0);
-	serial_set_scroll_region(height);
+	serial_set_scroll_region(scr_height);
 	
 	while (true) {
@@ -208,4 +290,23 @@
 			ipc_answer_0(callid, EOK);
 			return;
+		case IPC_M_SHARE_OUT:
+			/* We accept one area for data interchange */
+			intersize = IPC_GET_ARG2(call);
+			if (intersize >= scr_width * scr_height *
+			    sizeof(*interbuf)) {
+				receive_comm_area(callid, &call,
+				    (void *) &interbuf);
+				continue;
+			}
+			retval = EINVAL;
+			break;
+		case FB_DRAW_TEXT_DATA:
+			if (!interbuf) {
+				retval = EINVAL;
+				break;
+			}
+			draw_text_data(interbuf);
+			retval = 0;
+			break;
 		case FB_PUTCHAR:
 			c = IPC_GET_ARG1(call);
@@ -228,5 +329,5 @@
 			break;
 		case FB_GET_CSIZE:
-			ipc_answer_2(callid, EOK, height, width);
+			ipc_answer_2(callid, EOK, scr_height, scr_width);
 			continue;
 		case FB_CLEAR:
@@ -235,20 +336,6 @@
 			break;
 		case FB_SET_STYLE:
-			style =  IPC_GET_ARG1(call);
-			if (style == STYLE_EMPHASIS) {
-				if (color) {
-					serial_sgr(SGR_RESET);
-					serial_sgr(SGR_FGCOLOR + CI_RED);
-					serial_sgr(SGR_BGCOLOR + CI_WHITE);
-				}
-				serial_sgr(SGR_BOLD);
-			} else {
-				if (color) {
-					serial_sgr(SGR_RESET);
-					serial_sgr(SGR_FGCOLOR + CI_BLACK);
-					serial_sgr(SGR_BGCOLOR + CI_WHITE);
-				}
-				serial_sgr(SGR_NORMAL_INT);
-			}
+			style = IPC_GET_ARG1(call);
+			serial_set_style(style);
 			retval = 0;
 			break;
@@ -256,15 +343,7 @@
 			fgcolor = IPC_GET_ARG1(call);
 			bgcolor = IPC_GET_ARG2(call);
-
-			if (color) {
-				serial_sgr(SGR_RESET);
-				serial_sgr(SGR_FGCOLOR + color_map[fgcolor]);
-				serial_sgr(SGR_BGCOLOR + color_map[bgcolor]);
-			} else {
-				if (fgcolor < bgcolor)
-					serial_sgr(SGR_RESET);
-				else
-					serial_sgr(SGR_REVERSE);
-			}
+			flags = IPC_GET_ARG3(call);
+
+			serial_set_idx(fgcolor, bgcolor, flags);
 			retval = 0;
 			break;
@@ -272,13 +351,11 @@
 			fgcolor = IPC_GET_ARG1(call);
 			bgcolor = IPC_GET_ARG2(call);
-			if (fgcolor < bgcolor)
-				serial_sgr(SGR_REVERSE_OFF);
-			else
-				serial_sgr(SGR_REVERSE);
+
+			serial_set_rgb(fgcolor, bgcolor);
 			retval = 0;
 			break;
 		case FB_SCROLL:
 			i = IPC_GET_ARG1(call);
-			if ((i > height) || (i < -height)) {
+			if ((i > scr_height) || (i < -scr_height)) {
 				retval = EINVAL;
 				break;
Index: uspace/srv/fb/serial_console.h
===================================================================
--- uspace/srv/fb/serial_console.h	(revision f6377f722eaf2e019d585b85b3ffc5620c32f2bd)
+++ uspace/srv/fb/serial_console.h	(revision 16e9c4764ead1ecf4d92a47b804c782fe5d0b289)
@@ -47,5 +47,4 @@
 void serial_clrscr(void);
 void serial_scroll(int i);
-void serial_set_style(const unsigned int mode);
 void serial_cursor_disable(void);
 void serial_cursor_enable(void);
