Index: sid/component/consoles/components.h =================================================================== RCS file: /cvs/src/src/sid/component/consoles/components.h,v retrieving revision 1.5 diff -c -p -r1.5 components.h *** sid/component/consoles/components.h 19 Aug 2005 19:43:09 -0000 1.5 --- sid/component/consoles/components.h 14 Jul 2006 19:16:02 -0000 *************** *** 1,7 **** // file.cxx - Joint header file for nearby component classes. // -*- C++ -*- ! // Copyright (C) 1999, 2000, 2003, 2005 Red Hat. // This file is part of SID and is licensed under the GPL. // See the file COPYING.SID for conditions for redistribution. --- 1,7 ---- // file.cxx - Joint header file for nearby component classes. // -*- C++ -*- ! // Copyright (C) 1999, 2000, 2003, 2005, 2006 Red Hat. // This file is part of SID and is licensed under the GPL. // See the file COPYING.SID for conditions for redistribution. *************** private: *** 106,111 **** --- 106,114 ---- callback_pin activity_pin; callback_pin stdout_pin; output_pin stdin_pin; + output_pin eof_pin; + + bool eof_p; // save & restore state string save_state ( ); Index: sid/component/consoles/sid-io-stdio.xml =================================================================== RCS file: /cvs/src/src/sid/component/consoles/sid-io-stdio.xml,v retrieving revision 1.2 diff -c -p -r1.2 sid-io-stdio.xml *** sid/component/consoles/sid-io-stdio.xml 10 Jun 2003 18:28:19 -0000 1.2 --- sid/component/consoles/sid-io-stdio.xml 14 Jul 2006 19:16:02 -0000 *************** *** 8,13 **** --- 8,14 ---- + *************** *** 45,53 **** When the poll pin is driven, the stdin stream is checked for ! unread input, without blocking. All available input is consumed, and transmitted individually by driving the stdin pin with each ! byte, in sequence. --- 46,57 ---- When the poll pin is driven, the stdin stream is checked for ! unread input, without blocking. If end of file has not been detected, the eof ! pin is driven with the value 0. All available input is consumed, and transmitted individually by driving the stdin pin with each ! byte, in sequence. When end of file is detected, the eof is driven with ! a value of 1 and no data is transmitted via the stdin pin. ! Index: sid/component/consoles/stdio.cxx =================================================================== RCS file: /cvs/src/src/sid/component/consoles/stdio.cxx,v retrieving revision 1.3 diff -c -p -r1.3 stdio.cxx *** sid/component/consoles/stdio.cxx 14 Jul 2003 18:42:14 -0000 1.3 --- sid/component/consoles/stdio.cxx 14 Jul 2006 19:16:02 -0000 *************** *** 1,7 **** // stdio.cxx - A simple console that uses standard I/O for // enunciation. -*- C++ -*- ! // Copyright (C) 1999, 2000, 2003 Red Hat. // This file is part of SID and is licensed under the GPL. // See the file COPYING.SID for conditions for redistribution. --- 1,7 ---- // stdio.cxx - A simple console that uses standard I/O for // enunciation. -*- C++ -*- ! // Copyright (C) 1999, 2000, 2003, 2006 Red Hat. // This file is part of SID and is licensed under the GPL. // See the file COPYING.SID for conditions for redistribution. *************** namespace console_stuff *** 13,23 **** stdioConsole::stdioConsole() :activity_pin(this, & stdioConsole::read), ! stdout_pin(this, & stdioConsole::write) { add_pin("poll", &activity_pin); add_pin("stdin", &stdin_pin); add_pin("stdout", &stdout_pin); add_attribute_virtual ("state-snapshot", this, & stdioConsole::save_state, & stdioConsole::restore_state); --- 13,25 ---- stdioConsole::stdioConsole() :activity_pin(this, & stdioConsole::read), ! stdout_pin(this, & stdioConsole::write), ! eof_p (false) { add_pin("poll", &activity_pin); add_pin("stdin", &stdin_pin); add_pin("stdout", &stdout_pin); + add_pin("eof", &eof_pin); add_attribute_virtual ("state-snapshot", this, & stdioConsole::save_state, & stdioConsole::restore_state); *************** stdioConsole::write(host_int_4 value) *** 32,52 **** void stdioConsole::read(host_int_4) { unsigned char buf[1000]; int len; - host_int_4 value; - // Switch to non-blocking input. long flags = fcntl(0, F_GETFL); fcntl(0, F_SETFL, flags | O_NONBLOCK); if ((len = ::read(0, buf, 1000)) > 0) { for (int i = 0; i < len; ++i) { stdin_pin.drive(buf[i]); } } // Restore flags. fcntl(0, F_SETFL, flags); --- 34,62 ---- void stdioConsole::read(host_int_4) { + // Check for EOF + if (eof_p) + return; + unsigned char buf[1000]; int len; // Switch to non-blocking input. long flags = fcntl(0, F_GETFL); fcntl(0, F_SETFL, flags | O_NONBLOCK); if ((len = ::read(0, buf, 1000)) > 0) { + eof_pin.drive (0); for (int i = 0; i < len; ++i) { stdin_pin.drive(buf[i]); } } + else if (len == 0) + { + eof_p = true; + eof_pin.drive (1); + } // Restore flags. fcntl(0, F_SETFL, flags); Index: sid/component/gloss/gloss.cxx =================================================================== RCS file: /cvs/src/src/sid/component/gloss/gloss.cxx,v retrieving revision 1.20 diff -c -p -r1.20 gloss.cxx *** sid/component/gloss/gloss.cxx 19 Aug 2005 19:44:46 -0000 1.20 --- sid/component/gloss/gloss.cxx 14 Jul 2006 19:16:03 -0000 *************** *** 1,6 **** // gloss.cxx - Gloss routines. -*- C++ -*- ! // Copyright (C) 1999, 2000, 2001, 2002, 2005 Red Hat. // This file is part of SID and is licensed under the GPL. // See the file COPYING.SID for conditions for redistribution. --- 1,6 ---- // gloss.cxx - Gloss routines. -*- C++ -*- ! // Copyright (C) 1999, 2000, 2001, 2002, 2005, 2006 Red Hat. // This file is part of SID and is licensed under the GPL. // See the file COPYING.SID for conditions for redistribution. *************** gloss32::gloss32() : *** 63,68 **** --- 65,71 ---- add_pin("debug-tx", &this->tx_pin); add_pin("debug-rx", &this->rx_pin); + add_pin("debug-rx-eof", &this->rx_eof_pin); add_attribute_ro_value ("tk tty", string("hw-visual-tty"), "gui"); add_uni_relation("cpu", &this->cpu); *************** gloss32::read (int fd, address32 addr, s *** 1543,1548 **** --- 1645,1655 ---- strbuf += c; } } + else if (rx_eof_pin.sense () != 0) + { + len_read = 0; + return true; + } else { this->blocked_p = true; Index: sid/component/gloss/gloss.h =================================================================== RCS file: /cvs/src/src/sid/component/gloss/gloss.h,v retrieving revision 1.12 diff -c -p -r1.12 gloss.h *** sid/component/gloss/gloss.h 19 Aug 2005 19:44:46 -0000 1.12 --- sid/component/gloss/gloss.h 14 Jul 2006 19:16:03 -0000 *************** *** 1,7 **** // gloss.h - Basic process emulation plus ROM monitor support. // -*- C++ -*- ! // Copyright (C) 1999, 2000, 2001, 2002, 2005 Red Hat. // This file is part of SID and is licensed under the GPL. // See the file COPYING.SID for conditions for redistribution. --- 1,7 ---- // gloss.h - Basic process emulation plus ROM monitor support. // -*- C++ -*- ! // Copyright (C) 1999, 2000, 2001, 2002, 2005, 2006 Red Hat. // This file is part of SID and is licensed under the GPL. // See the file COPYING.SID for conditions for redistribution. *************** protected: *** 119,124 **** --- 119,125 ---- callback_pin rx_pin; void rx_handler(host_int_4 byte); vector rx_buffer; + input_pin rx_eof_pin; output_pin tx_pin; // ABI-specifics, for getting syscall arguments and setting results. Index: sid/main/dynamic/commonCfg.cxx =================================================================== RCS file: /cvs/src/src/sid/main/dynamic/commonCfg.cxx,v retrieving revision 1.15 diff -c -p -r1.15 commonCfg.cxx *** sid/main/dynamic/commonCfg.cxx 26 Jun 2006 21:03:00 -0000 1.15 --- sid/main/dynamic/commonCfg.cxx 14 Jul 2006 19:16:05 -0000 *************** void BoardCfg::write_config (Writer &w) *** 1285,1290 **** --- 1285,1291 ---- assert (sess->stdio_obj); PinConnection (gloss, "debug-tx", sess->stdio_obj, "stdout").write_to(w); PinConnection (gloss, "debug-rx", sess->stdio_obj, "stdin", dst_to_src).write_to(w); + PinConnection (gloss, "debug-rx-eof", sess->stdio_obj, "eof", dst_to_src).write_to(w); PinConnection (gloss, "process-signal", sess->main_obj, "stop!").write_to(w); PinConnection (gloss, "process-signal", sess->yield_net, "input").write_to(w); }