From 6d74892b38d48e48c4aa69ff9205ef32b222c974 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Wed, 27 Apr 2016 15:33:58 +0100 Subject: dev: Fix incorrect terminal backlog handling The Terminal device currently uses the peek functionality in gem5's circular buffer implementation to send existing buffered content on the terminal when a new client attaches. This functionallity is however not implemented correctly and re-sends the same block multiple time. Add the required functionality to peek with an offset into the circular buffer and change the Terminal::accept() implementation to send the buffered contents. Signed-off-by: Andreas Sandberg Reviewed-by: Radhika Jagtap Reviewed-by: Nikos Nikoleris --- src/dev/terminal.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/dev') diff --git a/src/dev/terminal.cc b/src/dev/terminal.cc index 53e593f85..9f0ea5ea3 100644 --- a/src/dev/terminal.cc +++ b/src/dev/terminal.cc @@ -204,7 +204,7 @@ Terminal::accept() char buf[1024]; for (size_t i = 0; i < txbuf.size(); i += sizeof(buf)) { const size_t chunk_len(std::min(txbuf.size() - i, sizeof(buf))); - txbuf.peek(buf, chunk_len); + txbuf.peek(buf, i, chunk_len); write((const uint8_t *)buf, chunk_len); } } -- cgit v1.2.3