Changeset 53f9821 in mainline for generic/include/synch/spinlock.h


Ignore:
Timestamp:
2006-03-20T20:32:17Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
018d957e
Parents:
9d3e185
Message:

Cleanup of spinlocks, now compiles both ia32 and amd64 with
and without DEBUG_SPINLOCKS. Made spinlocks inline.
Moved syscall_handler to generic (it was identical for ia32,amd64 & mips32).
Made slightly faster syscall for ia32.
Made better interrupt routines for ia32.
Allow not saving non-scratch registers during interrupt on ia32,amd64,mips32.
Aligned interrupt handlers on ia32,amd64, this should prevent problems
with different instruction lengths.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/include/synch/spinlock.h

    r9d3e185 r53f9821  
    3434#include <preemption.h>
    3535#include <arch/atomic.h>
     36#include <debug.h>
    3637
    3738#ifdef CONFIG_SMP
     
    6768
    6869extern void spinlock_initialize(spinlock_t *sl, char *name);
    69 extern void spinlock_lock(spinlock_t *sl);
    7070extern int spinlock_trylock(spinlock_t *sl);
    71 extern void spinlock_unlock(spinlock_t *sl);
     71extern void spinlock_lock_debug(spinlock_t *sl);
     72
     73#ifdef CONFIG_DEBUG_SPINLOCK
     74#  define spinlock_lock(x) spinlock_lock_debug(x)
     75#else
     76#  define spinlock_lock(x) atomic_lock_arch(&(x)->val)
     77#endif
     78
     79/** Unlock spinlock
     80 *
     81 * Unlock spinlock.
     82 *
     83 * @param sl Pointer to spinlock_t structure.
     84 */
     85static inline void spinlock_unlock(spinlock_t *sl)
     86{
     87        ASSERT(atomic_get(&sl->val) != 0);
     88
     89        /*
     90         * Prevent critical section code from bleeding out this way down.
     91         */
     92        CS_LEAVE_BARRIER();
     93       
     94        atomic_set(&sl->val,0);
     95        preemption_enable();
     96}
    7297
    7398#else
Note: See TracChangeset for help on using the changeset viewer.