summaryrefslogtreecommitdiffstats
path: root/include/asm-s390/timex.h
diff options
context:
space:
mode:
authorJan Glauber <jan.glauber@de.ibm.com>2007-02-05 21:18:22 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2007-02-05 21:18:22 +0100
commit1b2782948997cf5a0d1747de13d43ba7dfa7c543 (patch)
tree3c9c74179f2e8feaaaf48c1ff6dad78e979ed2e5 /include/asm-s390/timex.h
parentd54853ef8cb17296ac7bce9c77430fb7c80532d0 (diff)
[S390] Support for s390 Pseudo Random Number Generator
Starting with the z9 the CPU Cryptographic Assist Facility comes with an integrated Pseudo Random Number Generator. The generator creates random numbers by an algorithm similar to the ANSI X9.17 standard. The pseudo-random numbers can be accessed via a character device driver node called /dev/prandom. Similar to /dev/urandom any amount of bytes can be read from the device without blocking. Signed-off-by: Jan Glauber <jan.glauber@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'include/asm-s390/timex.h')
-rw-r--r--include/asm-s390/timex.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/asm-s390/timex.h b/include/asm-s390/timex.h
index 5cbd55cb40c..98229db2431 100644
--- a/include/asm-s390/timex.h
+++ b/include/asm-s390/timex.h
@@ -62,6 +62,18 @@ static inline unsigned long long get_clock (void)
return clk;
}
+static inline void get_clock_extended(void *dest)
+{
+ typedef struct { unsigned long long clk[2]; } __clock_t;
+
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
+ asm volatile("stcke %0" : "=Q" (*((__clock_t *)dest)) : : "cc");
+#else /* __GNUC__ */
+ asm volatile("stcke 0(%1)" : "=m" (*((__clock_t *)dest))
+ : "a" ((__clock_t *)dest) : "cc");
+#endif /* __GNUC__ */
+}
+
static inline cycles_t get_cycles(void)
{
return (cycles_t) get_clock() >> 2;