upstream: https://github.com/mirage/mirage-crypto
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add s390x enablement to mirage-crypto (#129)

* Add support for IBMz s390x architecture

Define ARCH_64BIT if IBMz s390x compiler macro is defined.

* Add cycle counting support for s390x

getticks: New function to return cycle count provided by STCK instruction.
mc_cycle_counter: Return value provided by getticks function.

authored by

David Edelsohn and committed by
GitHub
cb2c2646 42715f41

+13 -1
+12
src/native/entropy_cpu_stubs.c
··· 108 108 } 109 109 #endif 110 110 111 + #if defined (__s390x__) 112 + static inline uint64_t getticks(void) 113 + { 114 + uint64_t rval; 115 + __asm__ __volatile__ ("stck %0" : "=Q" (rval) : : "cc"); 116 + return rval; 117 + } 118 + #endif 119 + 120 + 111 121 CAMLprim value mc_cycle_counter (value __unused(unit)) { 112 122 #if defined (__i386__) || defined (__x86_64__) 113 123 return Val_long (__rdtsc ()); ··· 117 127 return Val_long (read_cycle_counter ()); 118 128 #elif defined(__riscv) && (64 == __riscv_xlen) 119 129 return Val_long (rdcycle64 ()); 130 + #elif defined (__s390x__) 131 + return Val_long (getticks ()); 120 132 #else 121 133 #error ("No known cycle-counting instruction.") 122 134 #endif
+1 -1
src/native/mirage_crypto.h
··· 47 47 48 48 #endif /* __mc_ACCELERATE__ */ 49 49 50 - #if defined (__x86_64__) || defined (__aarch64__) || defined (__powerpc64__) || (64 == __riscv_xlen) 50 + #if defined (__x86_64__) || defined (__aarch64__) || defined (__powerpc64__) || (64 == __riscv_xlen) || defined (__s390x__) 51 51 #define ARCH_64BIT 52 52 #elif defined (__i386__) || defined (__arm__) || (32 == __riscv_xlen) 53 53 #define ARCH_32BIT