From 588dde0cc079f98b5f17d3726972501c2d5725ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Sat, 4 Oct 2014 12:24:30 +0200
Subject: [PATCH] add s390(x) support
---
configure.ac | 2 ++
src/ticks_os.h | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/configure.ac b/configure.ac
index 361a182..7c21116 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,6 +31,7 @@ case "$host" in
powerpc*-*-rtems*) TARGET=POWERPC; TARGETDIR=powerpc;;
x86_64-*-*) TARGET=X86_64; TARGETDIR=x86;;
aarch64-*-*) TARGET=AARCH64; TARGETDIR=aarch64;;
+ s390*-*-*) TARGET=S390; TARGETDIR=s390;;
esac
AC_SUBST(AM_RUNTESTFLAGS)
@@ -48,6 +49,7 @@ AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX)
AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN)
AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD)
AM_CONDITIONAL(AARCH64, test x$TARGET = xAARCH64)
+AM_CONDITIONAL(S390, test x$TARGET = xS390)
AC_SUBST(TARGET)
AC_SUBST(TARGETDIR)
diff --git a/src/ticks_os.h b/src/ticks_os.h
index 6660016..fa535be 100644
--- a/src/ticks_os.h
+++ b/src/ticks_os.h
@@ -93,6 +93,10 @@ inline ticks_t os_gettimeoftsc()
unsigned long long ret;
asm volatile ("mftb %0" : "=r" (ret) : );
return (ticks_t)ret;
+#elif defined (__s390__)
+ unsigned long long ret;
+ asm volatile ("stck %0" : "=Q" (ret) : : "cc");
+ return (ticks_t)ret;
#elif defined(__arm__) || defined(__aarch64__)
// so the compiler will not complain. for
// arm compile, this inline is not used
--
1.9.3