Index: uspace/app/tetris/screen.c
===================================================================
--- uspace/app/tetris/screen.c	(revision 5b8c75a79324127135a3e17ea30905ab1f698abb)
+++ uspace/app/tetris/screen.c	(revision d2cc7e180f6a8ca583560ae28fcb1beae2fb36a1)
@@ -116,9 +116,4 @@
 {
 	console_goto(r, c);
-}
-
-static void fflush(void)
-{
-	console_flush();
 }
 
@@ -275,5 +270,5 @@
 	if (cur_so)
 		resume_normal();
- 	fflush();
+ 	fflush(stdout);
 }
 
Index: uspace/app/tetris/tetris.c
===================================================================
--- uspace/app/tetris/tetris.c	(revision 5b8c75a79324127135a3e17ea30905ab1f698abb)
+++ uspace/app/tetris/tetris.c	(revision d2cc7e180f6a8ca583560ae28fcb1beae2fb36a1)
@@ -391,5 +391,5 @@
 					scr_msg(key_msg, 0);
 					scr_msg(msg, 1);
-	//				(void) fflush(stdout);
+					(void) fflush(stdout);
 				} while (rwait((struct timeval *)NULL) == -1);
 				scr_msg(msg, 0);
Index: uspace/lib/libc/generic/console.c
===================================================================
--- uspace/lib/libc/generic/console.c	(revision 5b8c75a79324127135a3e17ea30905ab1f698abb)
+++ uspace/lib/libc/generic/console.c	(revision d2cc7e180f6a8ca583560ae28fcb1beae2fb36a1)
@@ -39,7 +39,29 @@
 #include <ipc/console.h>
 #include <ipc/services.h>
+#include <errno.h>
+#include <string.h>
 #include <console.h>
 
 static int console_phone = -1;
+
+/** Size of cbuffer. */
+#define CBUFFER_SIZE 256
+
+/** Buffer for writing characters to the console. */
+static char cbuffer[CBUFFER_SIZE];
+
+/** Pointer to end of cbuffer. */
+static char *cbuffer_end = cbuffer + CBUFFER_SIZE;
+
+/** Pointer to first available field in cbuffer. */
+static char *cbp = cbuffer;
+
+static ssize_t cons_write(const char *buf, size_t nbyte);
+static void cons_putchar(int c);
+
+static void cbuffer_flush(void);
+static void cbuffer_drain(void);
+static void cbuffer_putc(int c);
+
 
 void console_open(bool blocking)
@@ -85,4 +107,6 @@
 {
 	int cons_phone = console_phone_get(true);
+
+	cbuffer_drain();
 	async_msg_0(cons_phone, CONSOLE_CLEAR);
 }
@@ -91,4 +115,6 @@
 {
 	int cons_phone = console_phone_get(true);
+
+	cbuffer_flush();
 	async_msg_2(cons_phone, CONSOLE_GOTO, row, col);
 }
@@ -96,11 +122,116 @@
 void console_putchar(int c)
 {
+	cbuffer_putc(c);
+}
+
+/** Write all data from output buffer to the console. */
+static void cbuffer_flush(void)
+{
+	int rc;
+	int len;
+
+	len = cbp - cbuffer;
+
+	while (len > 0) {
+		rc = cons_write(cbuffer, cbp - cbuffer);
+		if (rc < 0)
+			return;
+
+		len -= rc;
+	}
+
+	cbp = cbuffer;
+}
+
+/** Drop all data in console output buffer. */
+static void cbuffer_drain(void)
+{
+	cbp = cbuffer;
+}
+
+/** Write one character to the output buffer. */
+static inline void cbuffer_putc(int c)
+{
+	if (cbp == cbuffer_end)
+		cbuffer_flush();
+
+	*cbp++ = c;
+
+	if (c == '\n')
+		cbuffer_flush();
+}
+
+/** Write one character to the console via IPC. */
+static void cons_putchar(int c)
+{
 	int cons_phone = console_phone_get(true);
 	async_msg_1(cons_phone, CONSOLE_PUTCHAR, c);
 }
 
+/** Write characters to the console via IPC. */
+static ssize_t cons_write(const char *buf, size_t nbyte) 
+{
+	int cons_phone = console_phone_get(true);
+	ipcarg_t rc;
+	ipc_call_t answer;
+	aid_t req;
+
+	async_serialize_start();
+	
+	req = async_send_0(cons_phone, CONSOLE_WRITE, &answer);
+	rc = ipc_data_write_start(cons_phone, (void *) buf, nbyte);
+
+	if (rc != EOK) {
+		async_wait_for(req, NULL);
+		async_serialize_end();
+		return (ssize_t) rc;
+	}
+
+	async_wait_for(req, &rc);
+	async_serialize_end();
+
+	if (rc == EOK)
+		return (ssize_t) IPC_GET_ARG1(answer);
+	else
+		return -1;
+}
+
+/** Write characters to the console. */
+ssize_t console_write(const char *buf, size_t nbyte) 
+{
+	size_t left;
+
+	left = nbyte;
+
+	while (left > 0) {
+		cbuffer_putc(*buf++);
+		--left;
+	}
+
+	return nbyte;
+}
+
+/** Write a NULL-terminated string to the console. */
+void console_putstr(const char *s)
+{
+	size_t len;
+	ssize_t rc;
+
+	len = strlen(s);
+	while (len > 0) {
+		rc = console_write(s, len);
+		if (rc < 0)
+			return; /* Error */
+		s += rc;
+		len -= rc;
+	}
+}
+
+/** Flush all output to the console. */
 void console_flush(void)
 {
-	int cons_phone = console_phone_get(true);
+	int cons_phone = console_phone_get(false);
+
+	cbuffer_flush();
 	async_msg_0(cons_phone, CONSOLE_FLUSH);
 }
@@ -123,4 +254,6 @@
 {
 	int cons_phone = console_phone_get(true);
+
+	cbuffer_flush();
 	async_msg_1(cons_phone, CONSOLE_SET_STYLE, style);
 }
@@ -129,4 +262,6 @@
 {
 	int cons_phone = console_phone_get(true);
+
+	cbuffer_flush();
 	async_msg_3(cons_phone, CONSOLE_SET_COLOR, fg_color, bg_color, flags);
 }
@@ -135,4 +270,6 @@
 {
 	int cons_phone = console_phone_get(true);
+
+	cbuffer_flush();
 	async_msg_2(cons_phone, CONSOLE_SET_RGB_COLOR, fg_color, bg_color);
 }
@@ -141,4 +278,6 @@
 {
 	int cons_phone = console_phone_get(true);
+
+	cbuffer_flush();
 	async_msg_1(cons_phone, CONSOLE_CURSOR_VISIBILITY, show != 0);
 }
Index: uspace/lib/libc/generic/io/io.c
===================================================================
--- uspace/lib/libc/generic/io/io.c	(revision 5b8c75a79324127135a3e17ea30905ab1f698abb)
+++ uspace/lib/libc/generic/io/io.c	(revision d2cc7e180f6a8ca583560ae28fcb1beae2fb36a1)
@@ -98,4 +98,6 @@
 {
 	unsigned char c;
+
+	flush_stdout();
 	if (read_stdin((void *) &c, 1) == 1)
 		return c;
@@ -104,4 +106,10 @@
 }
 
+int fflush(FILE *f)
+{
+	(void) f;
+	return flush_stdout();
+}
+
 /** @}
  */
Index: uspace/lib/libc/generic/io/stream.c
===================================================================
--- uspace/lib/libc/generic/io/stream.c	(revision 5b8c75a79324127135a3e17ea30905ab1f698abb)
+++ uspace/lib/libc/generic/io/stream.c	(revision d2cc7e180f6a8ca583560ae28fcb1beae2fb36a1)
@@ -81,14 +81,27 @@
 {
 	int cons_phone = console_phone_get(false);
+	int left, rc;
 
 	if (cons_phone >= 0) {
 		int i;
 
-		for (i = 0; i < count; i++)
-			console_putchar(((const char *) buf)[i]);
+		left = count;
+		while (left > 0) {
+			rc = console_write(buf, left);
+			if (rc < 0)
+				break;
+			buf += rc;
+			left -= rc;
+		}
 
 		return count;
 	} else
 		return __SYSCALL3(SYS_KLOG, 1, (sysarg_t) buf, count);
+}
+
+int flush_stdout(void)
+{
+	console_flush();
+	return 0;
 }
 
Index: uspace/lib/libc/include/console.h
===================================================================
--- uspace/lib/libc/include/console.h	(revision 5b8c75a79324127135a3e17ea30905ab1f698abb)
+++ uspace/lib/libc/include/console.h	(revision d2cc7e180f6a8ca583560ae28fcb1beae2fb36a1)
@@ -49,4 +49,6 @@
 extern void console_goto(int, int);
 extern void console_putchar(int);
+extern ssize_t console_write(const char *buf, size_t nbyte);
+extern void console_putstr(const char *s);
 extern void console_flush(void);
 
Index: uspace/lib/libc/include/io/stream.h
===================================================================
--- uspace/lib/libc/include/io/stream.h	(revision 5b8c75a79324127135a3e17ea30905ab1f698abb)
+++ uspace/lib/libc/include/io/stream.h	(revision d2cc7e180f6a8ca583560ae28fcb1beae2fb36a1)
@@ -45,4 +45,5 @@
 extern ssize_t write_stdout(const void *, size_t);
 extern ssize_t write_stderr(const void *, size_t);
+extern int flush_stdout(void);
 
 #endif
Index: uspace/lib/libc/include/ipc/console.h
===================================================================
--- uspace/lib/libc/include/ipc/console.h	(revision 5b8c75a79324127135a3e17ea30905ab1f698abb)
+++ uspace/lib/libc/include/ipc/console.h	(revision d2cc7e180f6a8ca583560ae28fcb1beae2fb36a1)
@@ -41,4 +41,5 @@
 	CONSOLE_GETKEY = IPC_FIRST_USER_METHOD,
 	CONSOLE_PUTCHAR,
+	CONSOLE_WRITE,
 	CONSOLE_CLEAR,
 	CONSOLE_GOTO,
Index: uspace/lib/libc/include/ipc/fb.h
===================================================================
--- uspace/lib/libc/include/ipc/fb.h	(revision 5b8c75a79324127135a3e17ea30905ab1f698abb)
+++ uspace/lib/libc/include/ipc/fb.h	(revision d2cc7e180f6a8ca583560ae28fcb1beae2fb36a1)
@@ -40,4 +40,5 @@
 typedef enum {
 	FB_PUTCHAR = IPC_FIRST_USER_METHOD,
+	FB_WRITE,
 	FB_CLEAR,
 	FB_GET_CSIZE,
Index: uspace/lib/libc/include/stdio.h
===================================================================
--- uspace/lib/libc/include/stdio.h	(revision 5b8c75a79324127135a3e17ea30905ab1f698abb)
+++ uspace/lib/libc/include/stdio.h	(revision d2cc7e180f6a8ca583560ae28fcb1beae2fb36a1)
@@ -70,4 +70,5 @@
 extern int puts(const char *);
 extern int putchar(int);
+extern int fflush(FILE *);
 
 extern int printf(const char *, ...);
Index: uspace/srv/console/console.c
===================================================================
--- uspace/srv/console/console.c	(revision 5b8c75a79324127135a3e17ea30905ab1f698abb)
+++ uspace/srv/console/console.c	(revision d2cc7e180f6a8ca583560ae28fcb1beae2fb36a1)
@@ -90,4 +90,21 @@
 						 * faster virtual console
 						 * switching */
+/** Size of fb_buf. */
+#define FB_BUF_SIZE 256
+
+/** Buffer for sending characters to FB driver. */
+static char fb_buf[FB_BUF_SIZE];
+
+/* Properties of fb_buf data. */
+static int fb_buf_row;		/**< Row where fb_buf data belong. */
+static int fb_buf_col;		/**< Column where fb_buf data start. */
+static int fb_console;		/**< VC to which fb_buf data belong. */
+int fb_bi = 0;			/**< Number of valid chars in fb_buf. */
+
+/** Size of cwrite_buf. */
+#define CWRITE_BUF_SIZE 256
+
+/** Buffer for receiving data via the CONSOLE_WRITE call from the client. */
+static char cwrite_buf[CWRITE_BUF_SIZE];
 
 
@@ -159,7 +176,64 @@
 }
 
+/** Write a character vector to FB driver via IPC. */
+static ssize_t fb_write(const char *buf, size_t nbyte, int row, int col)
+{
+	ipcarg_t rc;
+	ipc_call_t answer;
+	aid_t req;
+
+	async_serialize_start();
+	
+	req = async_send_2(fb_info.phone, FB_WRITE, row, col, &answer);
+	rc = ipc_data_write_start(fb_info.phone, (void *) buf, nbyte);
+
+	if (rc != EOK) {
+		async_wait_for(req, NULL);
+		async_serialize_end();
+		return (ssize_t) rc;
+	}
+
+	async_wait_for(req, &rc);
+	async_serialize_end();
+
+	if (rc == EOK)
+		return (ssize_t) IPC_GET_ARG1(answer);
+	else
+		return -1;
+}
+
+/** Flush buffered characters to FB. */
+static void fb_buf_flush(void)
+{
+	screenbuffer_t *scr;
+	int i;
+
+	scr = &(connections[fb_console].screenbuffer);
+
+	if (fb_bi > 0) {
+		if (fb_write(fb_buf, fb_bi, fb_buf_row, fb_buf_col) < 0) {
+			/* Try falling back to char-by-char. */
+			for (i = 0; i < fb_bi; i++) {
+				async_msg_3(fb_info.phone, FB_PUTCHAR, fb_buf[i],
+				    fb_buf_row, fb_buf_col + i);
+			}
+		}
+		fb_bi = 0;
+	}
+}
+
+/** Print a character to the active VC with buffering. */
 static void prtchr(char c, int row, int col)
 {
-	async_msg_3(fb_info.phone, FB_PUTCHAR, c, row, col);
+	if (fb_bi >= FB_BUF_SIZE)
+		fb_buf_flush();
+
+	if (fb_bi == 0) {
+		fb_buf_row = row;
+		fb_buf_col = col;
+		fb_console = active_console;
+	}
+
+	fb_buf[fb_bi++] = c;
 }
 
@@ -170,18 +244,24 @@
 static void write_char(int console, char key)
 {
+	bool flush_cursor = false;
 	screenbuffer_t *scr = &(connections[console].screenbuffer);
-	
+
 	switch (key) {
 	case '\n':
+		fb_buf_flush();
+		flush_cursor = true;
 		scr->position_y++;
 		scr->position_x = 0;
 		break;
 	case '\r':
+		fb_buf_flush();
 		break;
 	case '\t':
+		fb_buf_flush();
 		scr->position_x += 8;
 		scr->position_x -= scr->position_x % 8; 
 		break;
 	case '\b':
+		fb_buf_flush();
 		if (scr->position_x == 0) 
 			break;
@@ -198,6 +278,10 @@
 		scr->position_x++;
 	}
-	
-	scr->position_y += (scr->position_x >= scr->size_x);
+
+	if (scr->position_x >= scr->size_x) {
+		fb_buf_flush();
+		flush_cursor = true;
+		scr->position_y++;
+	}
 	
 	if (scr->position_y >= scr->size_y) {
@@ -208,10 +292,9 @@
 			async_msg_1(fb_info.phone, FB_SCROLL, 1);
 	}
-	
+
 	scr->position_x = scr->position_x % scr->size_x;
-	
-	if (console == active_console)
+
+	if (console == active_console && flush_cursor)
 		curs_goto(scr->position_y, scr->position_x);
-	
 }
 
@@ -226,5 +309,7 @@
 	if (newcons == active_console)
 		return;
-	
+
+	fb_buf_flush();
+
 	if (newcons == KERNEL_CONSOLE) {
 		async_serialize_start();
@@ -361,4 +446,29 @@
 }
 
+/** Handle CONSOLE_WRITE call. */
+static void cons_write(int consnum, ipc_callid_t rid, ipc_call_t *request)
+{
+	ipc_callid_t callid;
+	size_t len;
+	size_t i;
+
+	if (!ipc_data_write_receive(&callid, &len)) {
+		ipc_answer_0(callid, EINVAL);
+		ipc_answer_0(rid, EINVAL);
+	}
+
+	if (len > CWRITE_BUF_SIZE)
+		len = CWRITE_BUF_SIZE;
+
+	(void) ipc_data_write_finalize(callid, cwrite_buf, len);
+
+	for (i = 0; i < len; i++) {
+		write_char(consnum, cwrite_buf[i]);
+	}
+
+	gcons_notify_char(consnum);
+	ipc_answer_1(rid, EOK, len);
+}
+
 /** Default thread for new connections */
 static void client_connection(ipc_callid_t iid, ipc_call_t *icall)
@@ -412,4 +522,7 @@
 			gcons_notify_char(consnum);
 			break;
+		case CONSOLE_WRITE:
+			cons_write(consnum, callid, &call);
+			continue;
 		case CONSOLE_CLEAR:
 			/* Send message to fb */
@@ -422,4 +535,5 @@
 			break;
 		case CONSOLE_GOTO:
+			fb_buf_flush();
 			screenbuffer_goto(&conn->screenbuffer,
 			    IPC_GET_ARG2(call), IPC_GET_ARG1(call));
@@ -433,8 +547,10 @@
 			break;
 		case CONSOLE_FLUSH:
+			fb_buf_flush();
 			if (consnum == active_console)
 				async_req_0_0(fb_info.phone, FB_FLUSH);
 			break;
 		case CONSOLE_SET_STYLE:
+			fb_buf_flush();
 			arg1 = IPC_GET_ARG1(call);
 			screenbuffer_set_style(&conn->screenbuffer, arg1);
@@ -443,4 +559,5 @@
 			break;
 		case CONSOLE_SET_COLOR:
+			fb_buf_flush();
 			arg1 = IPC_GET_ARG1(call);
 			arg2 = IPC_GET_ARG2(call);
@@ -452,4 +569,5 @@
 			break;
 		case CONSOLE_SET_RGB_COLOR:
+			fb_buf_flush();
 			arg1 = IPC_GET_ARG1(call);
 			arg2 = IPC_GET_ARG2(call);
@@ -460,4 +578,5 @@
 			break;
 		case CONSOLE_CURSOR_VISIBILITY:
+			fb_buf_flush();
 			arg1 = IPC_GET_ARG1(call);
 			conn->screenbuffer.is_cursor_visible = arg1;
Index: uspace/srv/fb/ega.c
===================================================================
--- uspace/srv/fb/ega.c	(revision 5b8c75a79324127135a3e17ea30905ab1f698abb)
+++ uspace/srv/fb/ega.c	(revision d2cc7e180f6a8ca583560ae28fcb1beae2fb36a1)
@@ -360,5 +360,5 @@
 
 		default:
-			retval = ENOENT;
+			retval = EINVAL;
 		}
 		ipc_answer_0(callid, retval);
Index: uspace/srv/fb/fb.c
===================================================================
--- uspace/srv/fb/fb.c	(revision 5b8c75a79324127135a3e17ea30905ab1f698abb)
+++ uspace/srv/fb/fb.c	(revision d2cc7e180f6a8ca583560ae28fcb1beae2fb36a1)
@@ -1472,4 +1472,44 @@
 	return rgb_from_idx(&vport->attr, fg_color, bg_color, flags);
 }
+
+#define FB_WRITE_BUF_SIZE 256
+static char fb_write_buf[FB_WRITE_BUF_SIZE];
+
+static void fb_write(viewport_t *vport, ipc_callid_t rid, ipc_call_t *request)
+{
+	int row, col;
+	ipc_callid_t callid;
+	size_t len;
+	size_t i;
+
+	row = IPC_GET_ARG1(*request);
+	col = IPC_GET_ARG2(*request);
+
+	if ((col >= vport->cols) || (row >= vport->rows)) {
+		ipc_answer_0(callid, EINVAL);
+		ipc_answer_0(rid, EINVAL);
+		return;
+	}
+
+	if (!ipc_data_write_receive(&callid, &len)) {
+		ipc_answer_0(callid, EINVAL);
+		ipc_answer_0(rid, EINVAL);
+		return;
+	}
+
+	if (len > FB_WRITE_BUF_SIZE)
+		len = FB_WRITE_BUF_SIZE;
+	if (len >= vport->cols - col)
+		len = vport->cols - col;
+
+	(void) ipc_data_write_finalize(callid, fb_write_buf, len);
+
+	for (i = 0; i < len; i++) {
+		draw_char(vport, fb_write_buf[i], col++, row);
+	}
+
+	ipc_answer_1(rid, EOK, len);
+}
+
 
 /** Function for handling connections to FB
@@ -1547,4 +1587,9 @@
 			/* Message already answered */
 			continue;
+		case FB_WRITE:
+			fb_write(vport, callid, &call);
+			
+			/* Message already answered */
+			continue;
 		case FB_CLEAR:
 			vport_clear(vport);
Index: uspace/srv/fb/serial_console.c
===================================================================
--- uspace/srv/fb/serial_console.c	(revision 5b8c75a79324127135a3e17ea30905ab1f698abb)
+++ uspace/srv/fb/serial_console.c	(revision d2cc7e180f6a8ca583560ae28fcb1beae2fb36a1)
@@ -244,4 +244,52 @@
 }
 
+int lastcol = 0;
+int lastrow = 0;
+
+#define FB_WRITE_BUF_SIZE 256
+static char fb_write_buf[FB_WRITE_BUF_SIZE];
+
+static void fb_write(ipc_callid_t rid, ipc_call_t *request)
+{
+	int row, col;
+	ipc_callid_t callid;
+	size_t len;
+	size_t i;
+
+	row = IPC_GET_ARG1(*request);
+	col = IPC_GET_ARG2(*request);
+
+	if ((col >= scr_width) || (row >= scr_height)) {
+		ipc_answer_0(callid, EINVAL);
+		ipc_answer_0(rid, EINVAL);
+		return;
+	}
+
+	if (!ipc_data_write_receive(&callid, &len)) {
+		ipc_answer_0(callid, EINVAL);
+		ipc_answer_0(rid, EINVAL);
+		return;
+	}
+
+	if (len > FB_WRITE_BUF_SIZE)
+		len = FB_WRITE_BUF_SIZE;
+	if (len >= scr_width - col)
+		len = scr_width - col;
+
+	(void) ipc_data_write_finalize(callid, fb_write_buf, len);
+
+	if ((lastcol != col) || (lastrow != row))
+		serial_goto(row, col);
+
+	for (i = 0; i < len; i++) {
+		(*putc_function)(fb_write_buf[i]);
+	}
+
+	lastcol = col + len;
+	lastrow = row;
+
+	ipc_answer_1(rid, EOK, len);
+}
+
 /**
  * Main function of the thread serving client connections.
@@ -256,6 +304,4 @@
 
 	char c;
-	int lastcol = 0;
-	int lastrow = 0;
 	int newcol;
 	int newrow;
@@ -318,4 +364,9 @@
 			retval = 0;
 			break;
+		case FB_WRITE:
+			fb_write(callid, &call);
+			
+			/* Message already answered */
+			continue;
 		case FB_CURSOR_GOTO:
 			newrow = IPC_GET_ARG1(call);
