Primitive driver that uses HYPERVISOR_console_io hypercall to provide early console.
Signed-off-by: Sergiy Kibrik <[email protected]> --- drivers/xenconsole.cc | 36 ++++++++++++++++++++++++++++++++++++ drivers/xenconsole.hh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 drivers/xenconsole.cc create mode 100644 drivers/xenconsole.hh diff --git a/drivers/xenconsole.cc b/drivers/xenconsole.cc new file mode 100644 index 0000000..fe7c5bf --- /dev/null +++ b/drivers/xenconsole.cc @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2017 Sergiy Kibrik <[email protected]> + * + * This work is open source software, licensed under the terms of the + * BSD license as described in the LICENSE file in the top-level directory. + */ + +#include <bsd/porting/netport.h> /* __dead2 defined here */ +#include <xen/hypervisor.h> + +#include "xenconsole.hh" + +namespace console { + +void XEN_Console::write(const char *str, size_t len) { + HYPERVISOR_console_write(str, len); +} + +void XEN_Console::dev_start() +{ +} + +void XEN_Console::flush() +{ +} + +bool XEN_Console::input_ready() +{ + return false; /*TODO: support input */ +} + +char XEN_Console::readch() { + return '\0'; /*TODO: support input */ +} + +} diff --git a/drivers/xenconsole.hh b/drivers/xenconsole.hh new file mode 100644 index 0000000..ec43893 --- /dev/null +++ b/drivers/xenconsole.hh @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2017 Sergiy Kibrik <[email protected]> + * + * This work is open source software, licensed under the terms of the + * BSD license as described in the LICENSE file in the top-level directory. + */ + +#ifndef XEN_CONSOLE_HH +#define XEN_CONSOLE_HH + +#include "console-driver.hh" +#include "exceptions.hh" +#include <osv/interrupt.hh> + +namespace console { + +class XEN_Console : public console_driver { +public: + virtual void write(const char *str, size_t len); + virtual void flush(); + virtual bool input_ready(); + virtual char readch(); + +private: + virtual void dev_start(); + virtual const char *thread_name() { return "xen-input"; } +}; + +} + +#endif /* XEN_CONSOLE_HH */ -- 2.7.4 -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
