aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/arm
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2021-03-23 16:52:51 +0000
committerAlex Bennée <alex.bennee@linaro.org>2021-03-24 14:25:03 +0000
commit3539d84df15a29bb72d6d1eb2c39908681056d51 (patch)
treeec2ef5bf72a0e89d954ee249c805c310537e0666 /tests/tcg/arm
parent320d0bca94b4650c8fe6b02c6f24ad461f47eed8 (diff)
semihosting: move semihosting tests to multiarch
It may be arm-compat-semihosting but more than one architecture uses it so lets move the tests into the multiarch area. We gate it on the feature and split the semicall.h header between the arches. Also clean-up a bit of the Makefile messing about to one common set of runners. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210323165308.15244-6-alex.bennee@linaro.org>
Diffstat (limited to 'tests/tcg/arm')
-rw-r--r--tests/tcg/arm/Makefile.target22
-rw-r--r--tests/tcg/arm/semicall.h15
-rw-r--r--tests/tcg/arm/semiconsole.c27
-rw-r--r--tests/tcg/arm/semihosting.c26
4 files changed, 10 insertions, 80 deletions
diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target
index ec95156562..5ab59ed6ce 100644
--- a/tests/tcg/arm/Makefile.target
+++ b/tests/tcg/arm/Makefile.target
@@ -29,37 +29,31 @@ run-fcvt: fcvt
$(call run-test,fcvt,$(QEMU) $<,"$< on $(TARGET_NAME)")
$(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref)
+ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y)
+
# Semihosting smoke test for linux-user
-ARM_TESTS += semihosting
semihosting: CFLAGS += -mthumb
-run-semihosting: semihosting
- $(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)")
ARM_TESTS += semihosting-arm
-semihosting-arm: CFLAGS += -marm
+semihosting-arm: CFLAGS += -marm -I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
semihosting-arm: semihosting.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
run-semihosting-arm: semihosting-arm
$(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)")
-run-plugin-semihosting-with-%:
+run-plugin-semihosting-arm-with-%:
$(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
-plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \
$(call strip-plugin,$<) 2> $<.err, \
"$< on $(TARGET_NAME) with $*")
-ARM_TESTS += semiconsole semiconsole-arm
+ARM_TESTS += semiconsole-arm
semiconsole: CFLAGS += -mthumb
-run-semiconsole: semiconsole
- $(call skip-test, $<, "MANUAL ONLY")
-run-plugin-semiconsole-with-%:
- $(call skip-test, $<, "MANUAL ONLY")
-
-semiconsole-arm: CFLAGS += -marm
-semiconsole-arm: semiconsole.c
+semiconsole-arm: CFLAGS += -marm -I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
+semiconsole-arm: semihosting.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
run-semiconsole-arm: semiconsole-arm
@@ -68,6 +62,8 @@ run-semiconsole-arm: semiconsole-arm
run-plugin-semiconsole-arm-with-%:
$(call skip-test, $<, "MANUAL ONLY")
+endif
+
ARM_TESTS += commpage
TESTS += $(ARM_TESTS)
diff --git a/tests/tcg/arm/semicall.h b/tests/tcg/arm/semicall.h
index d4f6818192..ad8ac51310 100644
--- a/tests/tcg/arm/semicall.h
+++ b/tests/tcg/arm/semicall.h
@@ -1,5 +1,5 @@
/*
- * Semihosting Tests
+ * Semihosting Tests - ARM Helper
*
* Copyright (c) 2019
* Written by Alex Bennée <alex.bennee@linaro.org>
@@ -7,13 +7,8 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define SYS_WRITE0 0x04
-#define SYS_READC 0x07
-#define SYS_REPORTEXC 0x18
-
uintptr_t __semi_call(uintptr_t type, uintptr_t arg0)
{
-#if defined(__arm__)
register uintptr_t t asm("r0") = type;
register uintptr_t a0 asm("r1") = arg0;
#ifdef __thumb__
@@ -23,13 +18,5 @@ uintptr_t __semi_call(uintptr_t type, uintptr_t arg0)
#endif
asm(SVC : "=r" (t)
: "r" (t), "r" (a0));
-#else
- register uintptr_t t asm("x0") = type;
- register uintptr_t a0 asm("x1") = arg0;
- asm("hlt 0xf000"
- : "=r" (t)
- : "r" (t), "r" (a0));
-#endif
-
return t;
}
diff --git a/tests/tcg/arm/semiconsole.c b/tests/tcg/arm/semiconsole.c
deleted file mode 100644
index 6ef0bd2450..0000000000
--- a/tests/tcg/arm/semiconsole.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * linux-user semihosting console
- *
- * Copyright (c) 2019
- * Written by Alex Bennée <alex.bennee@linaro.org>
- *
- * SPDX-License-Identifier: GPL-3.0-or-later
- */
-
-#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;
-}
diff --git a/tests/tcg/arm/semihosting.c b/tests/tcg/arm/semihosting.c
deleted file mode 100644
index 33faac9916..0000000000
--- a/tests/tcg/arm/semihosting.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * linux-user semihosting checks
- *
- * Copyright (c) 2019
- * Written by Alex Bennée <alex.bennee@linaro.org>
- *
- * SPDX-License-Identifier: GPL-3.0-or-later
- */
-
-#include <stdint.h>
-#include "semicall.h"
-
-int main(int argc, char *argv[argc])
-{
-#if defined(__arm__)
- uintptr_t exit_code = 0x20026;
-#else
- uintptr_t exit_block[2] = {0x20026, 0};
- uintptr_t exit_code = (uintptr_t) &exit_block;
-#endif
-
- __semi_call(SYS_WRITE0, (uintptr_t) "Hello World");
- __semi_call(SYS_REPORTEXC, exit_code);
- /* if we get here we failed */
- return -1;
-}