[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 2/2] tests/tcg/aarch64: userspace system register
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PATCH v2 2/2] tests/tcg/aarch64: userspace system register test |
Date: |
Fri, 18 May 2018 12:44:24 +0100 |
Signed-off-by: Alex Bennée <address@hidden>
---
tests/tcg/aarch64/Makefile.target | 2 +-
tests/tcg/aarch64/sysregs.c | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
create mode 100644 tests/tcg/aarch64/sysregs.c
diff --git a/tests/tcg/aarch64/Makefile.target
b/tests/tcg/aarch64/Makefile.target
index ac177d9747..595927f027 100644
--- a/tests/tcg/aarch64/Makefile.target
+++ b/tests/tcg/aarch64/Makefile.target
@@ -7,7 +7,7 @@ VPATH += $(AARCH64_SRC)
# we don't build any of the ARM tests
AARCH64_TESTS=$(filter-out $(ARM_TESTS), $(TESTS))
-AARCH64_TESTS+=fcvt
+AARCH64_TESTS+=fcvt sysregs
TESTS:=$(AARCH64_TESTS)
fcvt: LDFLAGS+=-lm
diff --git a/tests/tcg/aarch64/sysregs.c b/tests/tcg/aarch64/sysregs.c
new file mode 100644
index 0000000000..0cd0c42d8c
--- /dev/null
+++ b/tests/tcg/aarch64/sysregs.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+#define get_cpu_reg(id) ({ \
+ unsigned long __val; \
+ asm("mrs %0, "#id : "=r" (__val)); \
+ printf("%-20s: 0x%016lx\n", #id, __val); \
+ })
+
+int main(void)
+{
+ get_cpu_reg(cntvct_el0);
+ get_cpu_reg(cntfrq_el0);
+ return 0;
+}
--
2.17.0