diff options
Diffstat (limited to 'src/dev')
-rw-r--r-- | src/dev/terminal.cc | 12 | ||||
-rw-r--r-- | src/dev/terminal.hh | 6 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/dev/terminal.cc b/src/dev/terminal.cc index b4fb50f6e..e653ee115 100644 --- a/src/dev/terminal.cc +++ b/src/dev/terminal.cc @@ -205,8 +205,12 @@ Terminal::accept() write((const uint8_t *)stream.str().c_str(), stream.str().size()); DPRINTFN("attach terminal %d\n", number); - - txbuf.readall(data_fd); + 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); + write((const uint8_t *)buf, chunk_len); + } } void @@ -329,7 +333,7 @@ Terminal::out(char c) DPRINTF(Terminal, "%s\n", buffer); delete [] buffer; } else { - linebuf.write(c); + linebuf.write(&c, 1); } } @@ -337,7 +341,7 @@ Terminal::out(char c) } #endif - txbuf.write(c); + txbuf.write(&c, 1); if (data_fd >= 0) write(c); diff --git a/src/dev/terminal.hh b/src/dev/terminal.hh index f7a860ac5..82246b2c1 100644 --- a/src/dev/terminal.hh +++ b/src/dev/terminal.hh @@ -109,11 +109,11 @@ class Terminal : public SimObject void accept(); protected: - CircleBuf txbuf; - CircleBuf rxbuf; + CircleBuf<char> txbuf; + CircleBuf<char> rxbuf; std::ostream *outfile; #if TRACING_ON == 1 - CircleBuf linebuf; + CircleBuf<char> linebuf; #endif public: |