- Timestamp:
- 2006-03-20T20:32:17Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 018d957e
- Parents:
- 9d3e185
- Location:
- generic
- Files:
-
- 5 edited
-
include/synch/spinlock.h (modified) (2 diffs)
-
include/syscall/syscall.h (modified) (1 diff)
-
src/lib/func.c (modified) (1 diff)
-
src/synch/spinlock.c (modified) (4 diffs)
-
src/syscall/syscall.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
generic/include/synch/spinlock.h
r9d3e185 r53f9821 34 34 #include <preemption.h> 35 35 #include <arch/atomic.h> 36 #include <debug.h> 36 37 37 38 #ifdef CONFIG_SMP … … 67 68 68 69 extern void spinlock_initialize(spinlock_t *sl, char *name); 69 extern void spinlock_lock(spinlock_t *sl);70 70 extern int spinlock_trylock(spinlock_t *sl); 71 extern void spinlock_unlock(spinlock_t *sl); 71 extern 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 */ 85 static 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 } 72 97 73 98 #else -
generic/include/syscall/syscall.h
r9d3e185 r53f9821 56 56 57 57 extern syshandler_t syscall_table[SYSCALL_END]; 58 extern __native syscall_handler(__native a1, __native a2, __native a3, 59 __native a4, __native id); 58 60 59 61 #endif -
generic/src/lib/func.c
r9d3e185 r53f9821 55 55 } 56 56 #else 57 atomic_set( haltstate, 1);57 atomic_set(&haltstate, 1); 58 58 #endif 59 59 -
generic/src/synch/spinlock.c
r9d3e185 r53f9821 52 52 } 53 53 54 #ifdef CONFIG_DEBUG_SPINLOCK55 54 /** Lock spinlock 56 55 * … … 61 60 * @param sl Pointer to spinlock_t structure. 62 61 */ 63 void spinlock_lock(spinlock_t *sl) 62 #ifdef CONFIG_DEBUG_SPINLOCK 63 void spinlock_lock_debug(spinlock_t *sl) 64 64 { 65 65 count_t i = 0; … … 83 83 if (deadlock_reported) 84 84 printf("cpu%d: not deadlocked\n", CPU->id); 85 86 /*87 * Prevent critical section code from bleeding out this way up.88 */89 CS_ENTER_BARRIER();90 91 }92 93 #else94 95 /** Lock spinlock96 *97 * Lock spinlock.98 *99 * @param sl Pointer to spinlock_t structure.100 */101 void spinlock_lock(spinlock_t *sl)102 {103 preemption_disable();104 105 /*106 * Each architecture has its own efficient/recommended107 * implementation of spinlock.108 */109 spinlock_arch(&sl->val);110 85 111 86 /* … … 144 119 } 145 120 146 /** Unlock spinlock147 *148 * Unlock spinlock.149 *150 * @param sl Pointer to spinlock_t structure.151 */152 void spinlock_unlock(spinlock_t *sl)153 {154 ASSERT(atomic_get(&sl->val) != 0);155 156 /*157 * Prevent critical section code from bleeding out this way down.158 */159 CS_LEAVE_BARRIER();160 161 atomic_set(&sl->val,0);162 preemption_enable();163 }164 165 121 #endif -
generic/src/syscall/syscall.c
r9d3e185 r53f9821 63 63 } 64 64 65 /** Dispatch system call */ 66 __native syscall_handler(__native a1, __native a2, __native a3, 67 __native a4, __native id) 68 { 69 if (id < SYSCALL_END) 70 return syscall_table[id](a1,a2,a3,a4); 71 else 72 panic("Undefined syscall %d", id); 73 } 74 65 75 syshandler_t syscall_table[SYSCALL_END] = { 66 76 sys_io,
Note:
See TracChangeset
for help on using the changeset viewer.
