[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [PATCH] plat/xen: Add console reading support for x86_64
Reading from console is ported from Mini-OS. It currently works for x86_64 only. Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> --- plat/xen/console.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/plat/xen/console.c b/plat/xen/console.c index 070beac..fd07e87 100644 --- a/plat/xen/console.c +++ b/plat/xen/console.c @@ -244,7 +244,25 @@ int ukplat_coutk(const char *str __unused, unsigned int len __unused) return hvconsole_output(str, len); } -int ukplat_cink(char *str __unused, unsigned int maxlen __unused) +int ukplat_cink(char *str, unsigned int maxlen) { - return 0; + int read = 0; + XENCONS_RING_IDX cons, prod; + + cons = console_ring->in_cons; + prod = console_ring->in_prod; + mb(); + UK_BUGON((prod - cons) > sizeof(console_ring->in)); + + while (cons != prod && maxlen > 0) { + *(str + read) = *(console_ring->in+MASK_XENCONS_IDX(cons,console_ring->in)); + read++; + cons++; + maxlen--; + } + + mb(); + console_ring->in_cons = cons; + + return read; } -- 2.7.4 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |