|
|
@ -2,12 +2,13 @@ |
|
|
|
|
|
|
|
#include <stdint.h> |
|
|
|
#include "../lib/stacktrace.h" |
|
|
|
#include "../lib/logging.h" |
|
|
|
|
|
|
|
typedef uint32_t spinlock_t; |
|
|
|
|
|
|
|
|
|
|
|
// fast spinlocks use the same functions as the normal spinlocks
|
|
|
|
typedef struct {uint32_t val; uint8_t reserved[60];} __attribute__((aligned(64))) fast_spinlock_t; |
|
|
|
typedef union {uint32_t val; uint8_t reserved[128];} __attribute__((aligned(128))) fast_spinlock_t; |
|
|
|
|
|
|
|
|
|
|
|
static inline void spinlock_init(spinlock_t* lock) { |
|
|
@ -21,10 +22,21 @@ void _spinlock_release(void *lock); |
|
|
|
|
|
|
|
|
|
|
|
static inline void spinlock_acquire(void* lock) { |
|
|
|
|
|
|
|
//log_warn("spinlock_acquire(%lx)", (uint64_t)lock);
|
|
|
|
//stacktrace_print();
|
|
|
|
//log_warn("---------------------------");
|
|
|
|
|
|
|
|
_spinlock_acquire(lock); |
|
|
|
} |
|
|
|
|
|
|
|
static inline void spinlock_release(void* lock) { |
|
|
|
|
|
|
|
//log_warn("spinlock_release(%lx)", (uint64_t)lock);
|
|
|
|
//stacktrace_print();
|
|
|
|
//log_warn("---------------------------");
|
|
|
|
|
|
|
|
|
|
|
|
_spinlock_release(lock); |
|
|
|
} |
|
|
|
|
|
|
|