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

thread-posix.h (878B)


      1#ifndef QEMU_THREAD_POSIX_H
      2#define QEMU_THREAD_POSIX_H
      3
      4#include <pthread.h>
      5#include <semaphore.h>
      6
      7struct QemuMutex {
      8    pthread_mutex_t lock;
      9#ifdef CONFIG_DEBUG_MUTEX
     10    const char *file;
     11    int line;
     12#endif
     13    bool initialized;
     14};
     15
     16/*
     17 * QemuRecMutex cannot be a typedef of QemuMutex lest we have two
     18 * compatible cases in _Generic.  See qemu/lockable.h.
     19 */
     20typedef struct QemuRecMutex {
     21    QemuMutex m;
     22} QemuRecMutex;
     23
     24struct QemuCond {
     25    pthread_cond_t cond;
     26    bool initialized;
     27};
     28
     29struct QemuSemaphore {
     30#ifndef CONFIG_SEM_TIMEDWAIT
     31    pthread_mutex_t lock;
     32    pthread_cond_t cond;
     33    unsigned int count;
     34#else
     35    sem_t sem;
     36#endif
     37    bool initialized;
     38};
     39
     40struct QemuEvent {
     41#ifndef __linux__
     42    pthread_mutex_t lock;
     43    pthread_cond_t cond;
     44#endif
     45    unsigned value;
     46    bool initialized;
     47};
     48
     49struct QemuThread {
     50    pthread_t thread;
     51};
     52
     53#endif