Thread: Use inherited baseCpu rather than cpu in SimpleThread
[gem5.git] / src / dev / terminal.cc
index bae4c9194b78dfaa62189926267778755a3a20b5..a11d45554eaa4716b159946410d3f2d3d51c5497 100644 (file)
@@ -102,6 +102,9 @@ Terminal::Terminal(const Params *p)
 {
     if (p->output) {
         outfile = simout.find(p->name);
+        if (!outfile)
+            outfile = simout.create(p->name);
+
         outfile->setf(ios::unitbuf);
     }
 
@@ -256,17 +259,13 @@ Terminal::write(const uint8_t *buf, size_t len)
 uint8_t
 Terminal::in()
 {
-    bool empty;
     uint8_t c;
 
-    empty = rxbuf.empty();
-    assert(!empty);
+    assert(!rxbuf.empty());
     rxbuf.read((char *)&c, 1);
-    empty = rxbuf.empty();
-
 
     DPRINTF(TerminalVerbose, "in: \'%c\' %#02x more: %d\n",
-            isprint(c) ? c : ' ', c, !empty);
+            isprint(c) ? c : ' ', c, !rxbuf.empty());
 
     return c;
 }