cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

s390-time.h (360B)


      1#ifndef TIME_H
      2#define TIME_H
      3
      4static inline u64 get_clock(void)
      5{
      6    u64 r;
      7
      8    asm volatile("stck %0" : "=Q" (r) : : "cc");
      9    return r;
     10}
     11
     12static inline u64 get_time_ms(void)
     13{
     14    /* Bit 51 is incremented each microsecond */
     15    return (get_clock() >> 12) / 1000;
     16}
     17
     18static inline u64 get_time_seconds(void)
     19{
     20    return get_time_ms() / 1000;
     21}
     22
     23#endif