summaryrefslogtreecommitdiff
path: root/src/dev/simconsole.cc
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2006-05-28 22:21:57 -0400
committerAli Saidi <saidi@eecs.umich.edu>2006-05-28 22:21:57 -0400
commitde20b819f1dc90c83a3050c9f26b89871f38779c (patch)
tree8ae4ed02eb5ae4b67aacc7adbdb600221ac22009 /src/dev/simconsole.cc
parent5df77b865ddc29a00629a679437dee2578997559 (diff)
downloadgem5-de20b819f1dc90c83a3050c9f26b89871f38779c.tar.xz
remove some getPtr() calls by changing having function return values
instead of taking a pointer --HG-- extra : convert_revision : fd9092eaa726e91b501334d35d28dda28aaa01bd
Diffstat (limited to 'src/dev/simconsole.cc')
-rw-r--r--src/dev/simconsole.cc27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/dev/simconsole.cc b/src/dev/simconsole.cc
index c3e4f554a..e33fa18b5 100644
--- a/src/dev/simconsole.cc
+++ b/src/dev/simconsole.cc
@@ -202,32 +202,31 @@ SimConsole::write(const uint8_t *buf, size_t len)
#define RECEIVE_NONE (ULL(2) << 62)
#define RECEIVE_ERROR (ULL(3) << 62)
-bool
-SimConsole::in(uint8_t &c)
+uint8_t
+SimConsole::in()
{
- bool empty, ret;
+ bool empty;
+ uint8_t c;
empty = rxbuf.empty();
- ret = !empty;
- if (!empty) {
- rxbuf.read((char *)&c, 1);
- empty = rxbuf.empty();
- }
+ assert(!empty);
+ rxbuf.read((char *)&c, 1);
+ empty = rxbuf.empty();
- DPRINTF(ConsoleVerbose, "in: \'%c\' %#02x more: %d, return: %d\n",
- isprint(c) ? c : ' ', c, !empty, ret);
- return ret;
+ DPRINTF(ConsoleVerbose, "in: \'%c\' %#02x more: %d\n",
+ isprint(c) ? c : ' ', c, !empty);
+
+ return c;
}
uint64_t
SimConsole::console_in()
{
- uint8_t c;
uint64_t value;
- if (in(c)) {
- value = RECEIVE_SUCCESS | c;
+ if (dataAvailable()) {
+ value = RECEIVE_SUCCESS | in();
if (!rxbuf.empty())
value |= MORE_PENDING;
} else {