aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/multiarch/arm-compat-semi/semiconsole.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tcg/multiarch/arm-compat-semi/semiconsole.c')
-rw-r--r--tests/tcg/multiarch/arm-compat-semi/semiconsole.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/tcg/multiarch/arm-compat-semi/semiconsole.c b/tests/tcg/multiarch/arm-compat-semi/semiconsole.c
new file mode 100644
index 0000000000..1d82efc589
--- /dev/null
+++ b/tests/tcg/multiarch/arm-compat-semi/semiconsole.c
@@ -0,0 +1,29 @@
+/*
+ * linux-user semihosting console
+ *
+ * Copyright (c) 2019
+ * Written by Alex Bennée <alex.bennee@linaro.org>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define SYS_READC 0x07
+
+#include <stdio.h>
+#include <stdint.h>
+#include "semicall.h"
+
+int main(void)
+{
+ char c;
+
+ printf("Semihosting Console Test\n");
+ printf("hit X to exit:");
+
+ do {
+ c = __semi_call(SYS_READC, 0);
+ printf("got '%c'\n", c);
+ } while (c != 'X');
+
+ return 0;
+}