Rev 534 | Rev 557 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 534 | Rev 552 | ||
|---|---|---|---|
| Line 31... | Line 31... | ||
| 31 | #include <arch/barrier.h> |
31 | #include <arch/barrier.h> |
| 32 | #include <arch.h> |
32 | #include <arch.h> |
| 33 | #include <preemption.h> |
33 | #include <preemption.h> |
| 34 | #include <print.h> |
34 | #include <print.h> |
| 35 | #include <debug.h> |
35 | #include <debug.h> |
| - | 36 | #include <symtab.h> |
|
| 36 | 37 | ||
| 37 | #ifdef CONFIG_SMP |
38 | #ifdef CONFIG_SMP |
| 38 | 39 | ||
| 39 | /** Initialize spinlock |
40 | /** Initialize spinlock |
| 40 | * |
41 | * |
| 41 | * Initialize spinlock. |
42 | * Initialize spinlock. |
| 42 | * |
43 | * |
| 43 | * @param sl Pointer to spinlock_t structure. |
44 | * @param sl Pointer to spinlock_t structure. |
| 44 | */ |
45 | */ |
| 45 | void spinlock_initialize(spinlock_t *sl) |
46 | void spinlock_initialize(spinlock_t *sl, char *name) |
| 46 | { |
47 | { |
| 47 | sl->val = 0; |
48 | sl->val = 0; |
| - | 49 | #ifdef CONFIG_DEBUG_SPINLOCK |
|
| - | 50 | sl->name = name; |
|
| - | 51 | #endif |
|
| 48 | } |
52 | } |
| 49 | 53 | ||
| 50 | #ifdef CONFIG_DEBUG_SPINLOCK |
54 | #ifdef CONFIG_DEBUG_SPINLOCK |
| 51 | /** Lock spinlock |
55 | /** Lock spinlock |
| 52 | * |
56 | * |
| Line 57... | Line 61... | ||
| 57 | * @param sl Pointer to spinlock_t structure. |
61 | * @param sl Pointer to spinlock_t structure. |
| 58 | */ |
62 | */ |
| 59 | void spinlock_lock(spinlock_t *sl) |
63 | void spinlock_lock(spinlock_t *sl) |
| 60 | { |
64 | { |
| 61 | int i = 0; |
65 | int i = 0; |
| 62 | __address caller = ((__u32 *) &sl)[-1]; |
66 | __address caller = ((__address *) &sl)[-1]; |
| - | 67 | char *symbol; |
|
| 63 | 68 | ||
| 64 | preemption_disable(); |
69 | preemption_disable(); |
| 65 | while (test_and_set(&sl->val)) { |
70 | while (test_and_set(&sl->val)) { |
| 66 | if (i++ > 300000) { |
71 | if (i++ > 300000) { |
| 67 | printf("cpu%d: looping on spinlock %X, caller=%X\n", CPU->id, sl, caller); |
72 | printf("cpu%d: looping on spinlock %p:%s, caller=%p", |
| - | 73 | CPU->id, sl, sl->name, caller); |
|
| - | 74 | symbol = get_symtab_entry(caller); |
|
| - | 75 | if (symbol) |
|
| - | 76 | printf("(%s)", symbol); |
|
| - | 77 | printf("\n"); |
|
| 68 | i = 0; |
78 | i = 0; |
| 69 | } |
79 | } |
| 70 | } |
80 | } |
| 71 | 81 | ||
| 72 | /* |
82 | /* |