diff options
author | Alex Bennée <alex.bennee@linaro.org> | 2023-11-20 15:08:31 +0000 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2023-11-23 14:10:06 +0000 |
commit | 8848c5296777f67fb2811bc434312f8b75c9a0d1 (patch) | |
tree | 0b7f338ad0e1610e46e236fc797825b9158c6c59 | |
parent | 56611e17d2ec6f53bf04c37a2e5ad203c6f9ac4b (diff) | |
download | qemu-8848c5296777f67fb2811bc434312f8b75c9a0d1.zip qemu-8848c5296777f67fb2811bc434312f8b75c9a0d1.tar.gz qemu-8848c5296777f67fb2811bc434312f8b75c9a0d1.tar.bz2 |
tests/tcg: enable semiconsole test for Arm
This still remains a MANUAL test due to blocking issues.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231120150833.2552739-13-alex.bennee@linaro.org>
-rw-r--r-- | tests/tcg/arm/Makefile.softmmu-target | 9 | ||||
-rw-r--r-- | tests/tcg/arm/system/semiconsole.c | 42 |
2 files changed, 51 insertions, 0 deletions
diff --git a/tests/tcg/arm/Makefile.softmmu-target b/tests/tcg/arm/Makefile.softmmu-target index aadc127..4c92640 100644 --- a/tests/tcg/arm/Makefile.softmmu-target +++ b/tests/tcg/arm/Makefile.softmmu-target @@ -48,6 +48,15 @@ memory: CFLAGS+=-DCHECK_UNALIGNED=0 QEMU_BASE_MACHINE=-M virt -cpu max -display none QEMU_OPTS+=$(QEMU_BASE_MACHINE) -semihosting-config enable=on,target=native,chardev=output -kernel +# console test is manual only +QEMU_SEMIHOST=-serial none -chardev stdio,mux=on,id=stdio0 -semihosting-config enable=on,chardev=stdio0 -mon chardev=stdio0,mode=readline +run-semiconsole: QEMU_OPTS=$(QEMU_BASE_MACHINE) $(QEMU_SEMIHOST) -kernel +run-semiconsole: semiconsole + $(call skip-test, $<, "MANUAL ONLY") + $(if $(V),@printf " %-7s %s %s\n" "TO RUN" $(notdir $(QEMU)) "$(QEMU_OPTS) $<") +run-plugin-semiconsole-with-%: semiconsole + $(call skip-test, $<, "MANUAL ONLY") + # Simple Record/Replay Test .PHONY: memory-record run-memory-record: memory-record memory diff --git a/tests/tcg/arm/system/semiconsole.c b/tests/tcg/arm/system/semiconsole.c new file mode 100644 index 0000000..206dd60 --- /dev/null +++ b/tests/tcg/arm/system/semiconsole.c @@ -0,0 +1,42 @@ +/* + * Semihosting Console Test + * + * Copyright (c) 2019 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include <stdint.h> +#include <minilib.h> + +#define SYS_READC 0x7 + +uintptr_t __semi_call(uintptr_t type, uintptr_t arg0) +{ + register uintptr_t t asm("r0") = type; + register uintptr_t a0 asm("r1") = arg0; +#ifdef __thumb__ +# define SVC "svc 0xab" +#else +# define SVC "svc 0x123456" +#endif + asm(SVC : "=r" (t) + : "r" (t), "r" (a0)); + + return t; +} + +int main(void) +{ + char c; + + ml_printf("Semihosting Console Test\n"); + ml_printf("hit X to exit:"); + + do { + c = __semi_call(SYS_READC, 0); + __sys_outc(c); + } while (c != 'X'); + + return 0; +} |