-static inline int IS_LOCKED(struct sShortSpinlock *Lock) {
- return !!Lock->Lock;
-}
-/**
- * \brief Acquire a Short Spinlock
- * \note Stops interrupts, so be careful
- */
-static inline void SHORTLOCK(struct sShortSpinlock *Lock) {
- int v = 1;
- __ASM__ ("pushf;\n\tpop %%eax" : "=a"(Lock->IF));
- Lock->IF &= 0x200;
- __ASM__ ("cli"); // Stop task switches
- // Wait for another CPU to release
- while(v)
- __ASM__("xchgl %%eax, (%%edi)":"=a"(v):"a"(1),"D"(&Lock->Lock));
-}
-/**
- * \brief Release a short lock
- */
-static inline void SHORTREL(struct sShortSpinlock *Lock) {
- Lock->Lock = 0;
- #if 0
- __ASM__ ("pushf;\n\tor %0, (%%esp);\n\tpopf" : : "a"(Lock->IF));
- #else
- if(Lock->IF) __ASM__ ("sti");