Hi
while going thru the spmlock.h and spinlock.h header files in
/usr/src/linux-2.2.14/include/asm/ directory , i found the following
piece of code which did not make any sense to me.
****************************************
1 typedef struct {
2 volatile unsigned int lock;
3 } spinlock_t;
4 typedef struct { unsigned long a[100]; } __dummy_lock_t;
5 #define __dummy_lock(lock) (*(__dummy_lock_t *)(lock))
6 extern spinlock_t kernel_flag;
7 extern __inline__ void lock_kernel(void)
8 {
9 __asm__ __volatile__(
10 "incl %1\n\t"
11 "jne 9f"
12 spin_lock_string
13 "\n9:"
14 :"=m" (__dummy_lock(&kernel_flag)),
15 "=m" (current->lock_depth));
16 }
*******************************
The above lines have been taken from the header files mentioned in the
begining and formatted in order.
- My doubt is what does (*(__dummy_lock_t *)(lock)) in line 5 resolve
to?? is it a function call ?? I don't think its a function call bcoz
i couldn't find the definition anywhere in the sources.
- In line 14, the inline assembly code expects a variable , but by the
operator precedence rule, __dummy_lock(&kernel_flag) will resolve to a
value . but the idea doesn't make sense.
Do correct me if i am wrong.
any pointers will be appreciated..
thanks
biju raman
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/linux-india-help