From: Player, Timmons <timmons.pla...@spirent.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

drivers/isa-serial.cc: Prevent spinning under VMWare.

The Line Status Register (LSR) of non-existant serial ports under VMWare
(and maybe other platforms) returns 0xff.  Ignore this value instead
of polling for terminal characters that aren't there.

Fixes #567.

Signed-off-by: Timmons C. Player <timmons.pla...@spirent.com>
Message-Id: <e96fc58e-fd03-4cf3-bd80-d2405f9fd...@spirent.com>

---
diff --git a/drivers/isa-serial.cc b/drivers/isa-serial.cc
--- a/drivers/isa-serial.cc
+++ b/drivers/isa-serial.cc
@@ -82,7 +82,9 @@ void isa_serial_console::write(const char *str, size_t len)
 bool isa_serial_console::input_ready()
 {
     u8 val = pci::inb(ioport + regs::LSR);
-    return val & lsr::RECEIVE_DATA_READY;
+    // On VMWare hosts without a serial port, this register always
+    // returns 0xff.  Just ignore it instead of spinning incessantly.
+    return (val != 0xff && (val & lsr::RECEIVE_DATA_READY));
 }

 char isa_serial_console::readch()

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to