|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH v2] plat/xen: Console reading support for x86_64
Implements ukplat_cink() for Xen. The code is ported
from Mini-OS. It currently works for x86_64 only.
Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
plat/xen/console.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/plat/xen/console.c b/plat/xen/console.c
index 070beac..fa74e8a 100644
--- a/plat/xen/console.c
+++ b/plat/xen/console.c
@@ -244,7 +244,26 @@ 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;
+ rmb(); /* make sure in_cons, in_prod are read before enqueuing */
+ 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--;
+ }
+
+ wmb(); /* ensure finished operation before updating in_cons */
+ 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 |