Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 885 → Rev 886

/kernel/branches/kolibri_pe/include/atomic.h
36,17 → 36,17
 
static inline void atomic_inc(atomic_t *val) {
#ifdef USE_SMP
asm volatile ("lock inc %0\n" : "+m" (val->count));
asm volatile ("lock incl %0\n" : "+m" (val->count));
#else
asm volatile ("inc %0\n" : "+m" (val->count));
asm volatile ("incl %0\n" : "+m" (val->count));
#endif /* USE_SMP */
}
 
static inline void atomic_dec(atomic_t *val) {
#ifdef USE_SMP
asm volatile ("lock dec %0\n" : "+m" (val->count));
asm volatile ("lock decl %0\n" : "+m" (val->count));
#else
asm volatile ("dec %0\n" : "+m" (val->count));
asm volatile ("decl %0\n" : "+m" (val->count));
#endif /* USE_SMP */
}
 
98,22 → 98,20
u32_t tmp;
 
// preemption_disable();
 
asm volatile (
"0:\n"
"pause\n\t" /* Pentium 4's HT love this instruction */
"mov %1, [%0]\n\t"
"test %1, %1\n\t"
"jnz 0b\n\t" /* lightweight looping on locked spinlock */
"pause\n" /* Pentium 4's HT love this instruction */
"mov %0, %1\n"
"testl %1, %1\n"
"jnz 0b\n" /* lightweight looping on locked spinlock */
 
"inc %1\n\t" /* now use the atomic operation */
"xchg [%0], %1\n\t"
"test %1, %1\n\t"
"jnz 0b\n\t"
: "+m" (val->count), "=r"(tmp)
"incl %1\n" /* now use the atomic operation */
"xchgl %0, %1\n"
"testl %1, %1\n"
"jnz 0b\n"
: "+m" (val->count), "=&r"(tmp)
);
/*
* Prevent critical section code from bleeding out this way up.
*/
// CS_ENTER_BARRIER();
}
 
/kernel/branches/kolibri_pe/include/core.h
37,8 → 37,8
{
eflags_t tmp;
asm volatile (
"pushf\n\t"
"pop %0\n\t"
"pushfl\n\t"
"popl %0\n\t"
"cli\n"
: "=r" (tmp)
);
48,8 → 48,8
static inline void safe_sti(eflags_t efl)
{
asm volatile (
"push %0\n\t"
"popf\n"
"pushl %0\n\t"
"popfl\n"
: : "r" (efl)
);
}
57,8 → 57,8
static inline count_t fnzb(u32_t arg)
{
count_t n;
asm volatile ("xor %0, %0 \n\t"
"bsr %0, %1"
asm volatile ("xorl %0, %0 \n\t"
"bsr %1, %0"
:"=&r" (n)
:"r"(arg)
);
68,8 → 68,8
static inline count_t _bsf(u32_t arg)
{
count_t n;
asm volatile ("xor %0, %0 \n\t"
"bsf %0, %1"
asm volatile ("xorl %0, %0 \n\t"
"bsf %1, %0"
:"=&r" (n)
:"r"(arg)
);
/kernel/branches/kolibri_pe/include/slab.h
78,3 → 78,5
int flags);
 
void* __fastcall slab_alloc(slab_cache_t *cache, int flags);
void __fastcall slab_free(slab_cache_t *cache, void *obj);