summaryrefslogtreecommitdiff
path: root/src/include/smp_sync.h
blob: 93aac357f4b7ad1262b3be393c9d875448e351c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef SMP_SYNC_INCLUDED
#define SMP_SYNC_INCLUDED

static inline void lock(uint8_t *lock) {
  asm("mov al, 1\n"
      "spinlock:\n"
      "lock xchgb [%0], al\n"
      "test al, al\n"
      "pause\n"
      "jnz spinlock\n"
      ::"r"(lock):"al");
} 

static inline void unlock(uint8_t *lock) {
  asm("lock andb [%0], 0"::"r"(lock));
}

static inline void waitup(uint8_t *loto) {
}

#define CREATE_LOTO(name)

#endif